diff --git a/Makefile b/Makefile index 1719a2d96..57e1ec0dd 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ generate-daml-codecs: .PHONY: compile-contracts compile-contracts: generate-daml-codecs @echo "Compiling contracts..." - dpm clean --all --multi-package-path ./contracts/ go run ./contracts/cmd/compile -root ./contracts -artifacts ./contracts/dars .PHONY: generate-bindings diff --git a/bindings/generated/latest/ccip/burnminttokenpool/burnminttokenpool.go b/bindings/generated/latest/ccip/burnminttokenpool/burnminttokenpool.go index 792b8b66e..6ee838158 100644 --- a/bindings/generated/latest/ccip/burnminttokenpool/burnminttokenpool.go +++ b/bindings/generated/latest/ccip/burnminttokenpool/burnminttokenpool.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" extensionapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/extensionapi" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" api "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/mcms/api" @@ -29,7 +29,7 @@ var ( const ( PackageName = "ccip-burn-mint-token-pool" - PackageID = "d1c200384a96e3cdc157ab8177d866c6ce9b13e1744954dcbc25f0b1b75aad31" + PackageID = "3c6f9cba34d1065a16b57581c350b35ef034156b2dd56451bc9536ca8fe69ead" SDKVersion = "3.4.11" ) @@ -441,12 +441,12 @@ type BurnMintTokenPool struct { // GetTemplateID returns the template ID for this template using the package name func (t BurnMintTokenPool) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t BurnMintTokenPool) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool") } // CreateCommand returns a CreateCommand for this template using the package name @@ -601,7 +601,7 @@ func (t *BurnMintTokenPool) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t BurnMintTokenPool) LockOrBurn(contractID string, args LockOrBurn) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "LockOrBurn", Arguments: argsToMap(args), @@ -611,7 +611,7 @@ func (t BurnMintTokenPool) LockOrBurn(contractID string, args LockOrBurn) *model // LockOrBurnWithPackageID exercises the LockOrBurn choice using the provided package ID instead of package name func (t BurnMintTokenPool) LockOrBurnWithPackageID(contractID string, packageID string, args LockOrBurn) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "LockOrBurn", Arguments: argsToMap(args), @@ -622,7 +622,7 @@ func (t BurnMintTokenPool) LockOrBurnWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t BurnMintTokenPool) ReleaseFromTicket(contractID string, args ReleaseFromTicket) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "ReleaseFromTicket", Arguments: argsToMap(args), @@ -632,7 +632,7 @@ func (t BurnMintTokenPool) ReleaseFromTicket(contractID string, args ReleaseFrom // ReleaseFromTicketWithPackageID exercises the ReleaseFromTicket choice using the provided package ID instead of package name func (t BurnMintTokenPool) ReleaseFromTicketWithPackageID(contractID string, packageID string, args ReleaseFromTicket) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "ReleaseFromTicket", Arguments: argsToMap(args), @@ -643,7 +643,7 @@ func (t BurnMintTokenPool) ReleaseFromTicketWithPackageID(contractID string, pac // This method uses the package name in the template ID func (t BurnMintTokenPool) SetRateLimitConfig(contractID string, args SetRateLimitConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "SetRateLimitConfig", Arguments: argsToMap(args), @@ -653,7 +653,7 @@ func (t BurnMintTokenPool) SetRateLimitConfig(contractID string, args SetRateLim // SetRateLimitConfigWithPackageID exercises the SetRateLimitConfig choice using the provided package ID instead of package name func (t BurnMintTokenPool) SetRateLimitConfigWithPackageID(contractID string, packageID string, args SetRateLimitConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "SetRateLimitConfig", Arguments: argsToMap(args), @@ -664,7 +664,7 @@ func (t BurnMintTokenPool) SetRateLimitConfigWithPackageID(contractID string, pa // This method uses the package name in the template ID func (t BurnMintTokenPool) ApplyTokenTransferFeeConfigUpdates(contractID string, args ApplyTokenTransferFeeConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "ApplyTokenTransferFeeConfigUpdates", Arguments: argsToMap(args), @@ -674,7 +674,7 @@ func (t BurnMintTokenPool) ApplyTokenTransferFeeConfigUpdates(contractID string, // ApplyTokenTransferFeeConfigUpdatesWithPackageID exercises the ApplyTokenTransferFeeConfigUpdates choice using the provided package ID instead of package name func (t BurnMintTokenPool) ApplyTokenTransferFeeConfigUpdatesWithPackageID(contractID string, packageID string, args ApplyTokenTransferFeeConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "ApplyTokenTransferFeeConfigUpdates", Arguments: argsToMap(args), @@ -685,7 +685,7 @@ func (t BurnMintTokenPool) ApplyTokenTransferFeeConfigUpdatesWithPackageID(contr // This method uses the package name in the template ID func (t BurnMintTokenPool) SetRateLimiterReferences(contractID string, args SetRateLimiterReferences) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "SetRateLimiterReferences", Arguments: argsToMap(args), @@ -695,7 +695,7 @@ func (t BurnMintTokenPool) SetRateLimiterReferences(contractID string, args SetR // SetRateLimiterReferencesWithPackageID exercises the SetRateLimiterReferences choice using the provided package ID instead of package name func (t BurnMintTokenPool) SetRateLimiterReferencesWithPackageID(contractID string, packageID string, args SetRateLimiterReferences) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "SetRateLimiterReferences", Arguments: argsToMap(args), @@ -706,7 +706,7 @@ func (t BurnMintTokenPool) SetRateLimiterReferencesWithPackageID(contractID stri // This method uses the package name in the template ID func (t BurnMintTokenPool) ApplyChainUpdates(contractID string, args ApplyChainUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "ApplyChainUpdates", Arguments: argsToMap(args), @@ -716,7 +716,7 @@ func (t BurnMintTokenPool) ApplyChainUpdates(contractID string, args ApplyChainU // ApplyChainUpdatesWithPackageID exercises the ApplyChainUpdates choice using the provided package ID instead of package name func (t BurnMintTokenPool) ApplyChainUpdatesWithPackageID(contractID string, packageID string, args ApplyChainUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "ApplyChainUpdates", Arguments: argsToMap(args), @@ -727,7 +727,7 @@ func (t BurnMintTokenPool) ApplyChainUpdatesWithPackageID(contractID string, pac // This method uses the package name in the template ID func (t BurnMintTokenPool) SetDynamicConfig(contractID string, args SetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "SetDynamicConfig", Arguments: argsToMap(args), @@ -737,7 +737,7 @@ func (t BurnMintTokenPool) SetDynamicConfig(contractID string, args SetDynamicCo // SetDynamicConfigWithPackageID exercises the SetDynamicConfig choice using the provided package ID instead of package name func (t BurnMintTokenPool) SetDynamicConfigWithPackageID(contractID string, packageID string, args SetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "SetDynamicConfig", Arguments: argsToMap(args), @@ -748,7 +748,7 @@ func (t BurnMintTokenPool) SetDynamicConfigWithPackageID(contractID string, pack // This method uses the package name in the template ID func (t BurnMintTokenPool) AddPoolReceiveContextNonContractValue(contractID string, args AddPoolReceiveContextNonContractValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "AddPoolReceiveContextNonContractValue", Arguments: argsToMap(args), @@ -758,7 +758,7 @@ func (t BurnMintTokenPool) AddPoolReceiveContextNonContractValue(contractID stri // AddPoolReceiveContextNonContractValueWithPackageID exercises the AddPoolReceiveContextNonContractValue choice using the provided package ID instead of package name func (t BurnMintTokenPool) AddPoolReceiveContextNonContractValueWithPackageID(contractID string, packageID string, args AddPoolReceiveContextNonContractValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "AddPoolReceiveContextNonContractValue", Arguments: argsToMap(args), @@ -769,7 +769,7 @@ func (t BurnMintTokenPool) AddPoolReceiveContextNonContractValueWithPackageID(co // This method uses the package name in the template ID func (t BurnMintTokenPool) AddPoolReceiveContextContractValue(contractID string, args AddPoolReceiveContextContractValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "AddPoolReceiveContextContractValue", Arguments: argsToMap(args), @@ -779,7 +779,7 @@ func (t BurnMintTokenPool) AddPoolReceiveContextContractValue(contractID string, // AddPoolReceiveContextContractValueWithPackageID exercises the AddPoolReceiveContextContractValue choice using the provided package ID instead of package name func (t BurnMintTokenPool) AddPoolReceiveContextContractValueWithPackageID(contractID string, packageID string, args AddPoolReceiveContextContractValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "AddPoolReceiveContextContractValue", Arguments: argsToMap(args), @@ -790,7 +790,7 @@ func (t BurnMintTokenPool) AddPoolReceiveContextContractValueWithPackageID(contr // This method uses the package name in the template ID func (t BurnMintTokenPool) RemovePoolReceiveContextValue(contractID string, args RemovePoolReceiveContextValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "RemovePoolReceiveContextValue", Arguments: argsToMap(args), @@ -800,7 +800,7 @@ func (t BurnMintTokenPool) RemovePoolReceiveContextValue(contractID string, args // RemovePoolReceiveContextValueWithPackageID exercises the RemovePoolReceiveContextValue choice using the provided package ID instead of package name func (t BurnMintTokenPool) RemovePoolReceiveContextValueWithPackageID(contractID string, packageID string, args RemovePoolReceiveContextValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "RemovePoolReceiveContextValue", Arguments: argsToMap(args), @@ -811,7 +811,7 @@ func (t BurnMintTokenPool) RemovePoolReceiveContextValueWithPackageID(contractID // This method uses the package name in the template ID func (t BurnMintTokenPool) ClearPoolReceiveContext(contractID string, args ClearPoolReceiveContext) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "ClearPoolReceiveContext", Arguments: argsToMap(args), @@ -821,7 +821,7 @@ func (t BurnMintTokenPool) ClearPoolReceiveContext(contractID string, args Clear // ClearPoolReceiveContextWithPackageID exercises the ClearPoolReceiveContext choice using the provided package ID instead of package name func (t BurnMintTokenPool) ClearPoolReceiveContextWithPackageID(contractID string, packageID string, args ClearPoolReceiveContext) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "ClearPoolReceiveContext", Arguments: argsToMap(args), @@ -832,7 +832,7 @@ func (t BurnMintTokenPool) ClearPoolReceiveContextWithPackageID(contractID strin // This method uses the package name in the template ID func (t BurnMintTokenPool) SetTransferTimeout(contractID string, args SetTransferTimeout) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "SetTransferTimeout", Arguments: argsToMap(args), @@ -842,7 +842,7 @@ func (t BurnMintTokenPool) SetTransferTimeout(contractID string, args SetTransfe // SetTransferTimeoutWithPackageID exercises the SetTransferTimeout choice using the provided package ID instead of package name func (t BurnMintTokenPool) SetTransferTimeoutWithPackageID(contractID string, packageID string, args SetTransferTimeout) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "SetTransferTimeout", Arguments: argsToMap(args), @@ -853,7 +853,7 @@ func (t BurnMintTokenPool) SetTransferTimeoutWithPackageID(contractID string, pa // This method uses the package name in the template ID func (t BurnMintTokenPool) GetRequiredCCVs(contractID string, args GetRequiredCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "GetRequiredCCVs", Arguments: argsToMap(args), @@ -863,7 +863,7 @@ func (t BurnMintTokenPool) GetRequiredCCVs(contractID string, args GetRequiredCC // GetRequiredCCVsWithPackageID exercises the GetRequiredCCVs choice using the provided package ID instead of package name func (t BurnMintTokenPool) GetRequiredCCVsWithPackageID(contractID string, packageID string, args GetRequiredCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "GetRequiredCCVs", Arguments: argsToMap(args), @@ -874,7 +874,7 @@ func (t BurnMintTokenPool) GetRequiredCCVsWithPackageID(contractID string, packa // This method uses the package name in the template ID func (t BurnMintTokenPool) VerifyInboundMessage(contractID string, args VerifyInboundMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "VerifyInboundMessage", Arguments: argsToMap(args), @@ -884,7 +884,7 @@ func (t BurnMintTokenPool) VerifyInboundMessage(contractID string, args VerifyIn // VerifyInboundMessageWithPackageID exercises the VerifyInboundMessage choice using the provided package ID instead of package name func (t BurnMintTokenPool) VerifyInboundMessageWithPackageID(contractID string, packageID string, args VerifyInboundMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "VerifyInboundMessage", Arguments: argsToMap(args), @@ -895,7 +895,7 @@ func (t BurnMintTokenPool) VerifyInboundMessageWithPackageID(contractID string, // This method uses the package name in the template ID func (t BurnMintTokenPool) VerifyOutboundCCVs(contractID string, args VerifyOutboundCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "VerifyOutboundCCVs", Arguments: argsToMap(args), @@ -905,7 +905,7 @@ func (t BurnMintTokenPool) VerifyOutboundCCVs(contractID string, args VerifyOutb // VerifyOutboundCCVsWithPackageID exercises the VerifyOutboundCCVs choice using the provided package ID instead of package name func (t BurnMintTokenPool) VerifyOutboundCCVsWithPackageID(contractID string, packageID string, args VerifyOutboundCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "VerifyOutboundCCVs", Arguments: argsToMap(args), @@ -916,7 +916,7 @@ func (t BurnMintTokenPool) VerifyOutboundCCVsWithPackageID(contractID string, pa // This method uses the package name in the template ID func (t BurnMintTokenPool) CalculateFee(contractID string, args CalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "CalculateFee", Arguments: argsToMap(args), @@ -926,7 +926,7 @@ func (t BurnMintTokenPool) CalculateFee(contractID string, args CalculateFee) *m // CalculateFeeWithPackageID exercises the CalculateFee choice using the provided package ID instead of package name func (t BurnMintTokenPool) CalculateFeeWithPackageID(contractID string, packageID string, args CalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "CalculateFee", Arguments: argsToMap(args), @@ -937,7 +937,7 @@ func (t BurnMintTokenPool) CalculateFeeWithPackageID(contractID string, packageI // This method uses the package name in the template ID func (t BurnMintTokenPool) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "TokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "TokenPool"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -947,7 +947,7 @@ func (t BurnMintTokenPool) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t BurnMintTokenPool) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "TokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "TokenPool"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -958,7 +958,7 @@ func (t BurnMintTokenPool) ArchiveWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t BurnMintTokenPool) GetFee(contractID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -968,7 +968,7 @@ func (t BurnMintTokenPool) GetFee(contractID string, args GetFee) *model.Exercis // GetFeeWithPackageID exercises the GetFee choice using the provided package ID instead of package name func (t BurnMintTokenPool) GetFeeWithPackageID(contractID string, packageID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "BurnMintTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "BurnMintTokenPool"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -979,7 +979,7 @@ func (t BurnMintTokenPool) GetFeeWithPackageID(contractID string, packageID stri // This method uses the package name in the template ID func (t BurnMintTokenPool) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -989,7 +989,7 @@ func (t BurnMintTokenPool) MCMSReceiverEntrypoint(contractID string, args api.MC // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t BurnMintTokenPool) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -1000,7 +1000,7 @@ func (t BurnMintTokenPool) MCMSReceiverEntrypointWithPackageID(contractID string // This method uses the package name in the template ID func (t BurnMintTokenPool) TokenPoolGetRequiredCCVs(contractID string, args extensionapi.TokenPoolGetRequiredCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_GetRequiredCCVs", Arguments: argsToMap(args), @@ -1010,7 +1010,7 @@ func (t BurnMintTokenPool) TokenPoolGetRequiredCCVs(contractID string, args exte // TokenPoolGetRequiredCCVsWithPackageID exercises the TokenPool_GetRequiredCCVs choice using the provided package ID instead of package name func (t BurnMintTokenPool) TokenPoolGetRequiredCCVsWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolGetRequiredCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_GetRequiredCCVs", Arguments: argsToMap(args), @@ -1021,7 +1021,7 @@ func (t BurnMintTokenPool) TokenPoolGetRequiredCCVsWithPackageID(contractID stri // This method uses the package name in the template ID func (t BurnMintTokenPool) TokenPoolVerifyInboundMessage(contractID string, args extensionapi.TokenPoolVerifyInboundMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_VerifyInboundMessage", Arguments: argsToMap(args), @@ -1031,7 +1031,7 @@ func (t BurnMintTokenPool) TokenPoolVerifyInboundMessage(contractID string, args // TokenPoolVerifyInboundMessageWithPackageID exercises the TokenPool_VerifyInboundMessage choice using the provided package ID instead of package name func (t BurnMintTokenPool) TokenPoolVerifyInboundMessageWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolVerifyInboundMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_VerifyInboundMessage", Arguments: argsToMap(args), @@ -1042,7 +1042,7 @@ func (t BurnMintTokenPool) TokenPoolVerifyInboundMessageWithPackageID(contractID // This method uses the package name in the template ID func (t BurnMintTokenPool) TokenPoolVerifyOutboundCCVs(contractID string, args extensionapi.TokenPoolVerifyOutboundCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_VerifyOutboundCCVs", Arguments: argsToMap(args), @@ -1052,7 +1052,7 @@ func (t BurnMintTokenPool) TokenPoolVerifyOutboundCCVs(contractID string, args e // TokenPoolVerifyOutboundCCVsWithPackageID exercises the TokenPool_VerifyOutboundCCVs choice using the provided package ID instead of package name func (t BurnMintTokenPool) TokenPoolVerifyOutboundCCVsWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolVerifyOutboundCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_VerifyOutboundCCVs", Arguments: argsToMap(args), @@ -1063,7 +1063,7 @@ func (t BurnMintTokenPool) TokenPoolVerifyOutboundCCVsWithPackageID(contractID s // This method uses the package name in the template ID func (t BurnMintTokenPool) TokenPoolReleaseFromTicket(contractID string, args extensionapi.TokenPoolReleaseFromTicket) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_ReleaseFromTicket", Arguments: argsToMap(args), @@ -1073,7 +1073,7 @@ func (t BurnMintTokenPool) TokenPoolReleaseFromTicket(contractID string, args ex // TokenPoolReleaseFromTicketWithPackageID exercises the TokenPool_ReleaseFromTicket choice using the provided package ID instead of package name func (t BurnMintTokenPool) TokenPoolReleaseFromTicketWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolReleaseFromTicket) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_ReleaseFromTicket", Arguments: argsToMap(args), @@ -1084,7 +1084,7 @@ func (t BurnMintTokenPool) TokenPoolReleaseFromTicketWithPackageID(contractID st // This method uses the package name in the template ID func (t BurnMintTokenPool) TokenPoolLockOrBurn(contractID string, args extensionapi.TokenPoolLockOrBurn) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_LockOrBurn", Arguments: argsToMap(args), @@ -1094,7 +1094,7 @@ func (t BurnMintTokenPool) TokenPoolLockOrBurn(contractID string, args extension // TokenPoolLockOrBurnWithPackageID exercises the TokenPool_LockOrBurn choice using the provided package ID instead of package name func (t BurnMintTokenPool) TokenPoolLockOrBurnWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolLockOrBurn) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_LockOrBurn", Arguments: argsToMap(args), @@ -1105,7 +1105,7 @@ func (t BurnMintTokenPool) TokenPoolLockOrBurnWithPackageID(contractID string, p // This method uses the package name in the template ID func (t BurnMintTokenPool) TokenPoolCalculateFee(contractID string, args extensionapi.TokenPoolCalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_CalculateFee", Arguments: argsToMap(args), @@ -1115,7 +1115,7 @@ func (t BurnMintTokenPool) TokenPoolCalculateFee(contractID string, args extensi // TokenPoolCalculateFeeWithPackageID exercises the TokenPool_CalculateFee choice using the provided package ID instead of package name func (t BurnMintTokenPool) TokenPoolCalculateFeeWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolCalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_CalculateFee", Arguments: argsToMap(args), @@ -1126,7 +1126,7 @@ func (t BurnMintTokenPool) TokenPoolCalculateFeeWithPackageID(contractID string, // This method uses the package name in the template ID func (t BurnMintTokenPool) TokenPoolGetFee(contractID string, args extensionapi.TokenPoolGetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_GetFee", Arguments: argsToMap(args), @@ -1136,7 +1136,7 @@ func (t BurnMintTokenPool) TokenPoolGetFee(contractID string, args extensionapi. // TokenPoolGetFeeWithPackageID exercises the TokenPool_GetFee choice using the provided package ID instead of package name func (t BurnMintTokenPool) TokenPoolGetFeeWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolGetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.BurnMintTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_GetFee", Arguments: argsToMap(args), @@ -1195,10 +1195,10 @@ func (t *BurnMintTokenPoolDeps) UnmarshalHex(data string) error { type CalculateFee struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -1210,14 +1210,14 @@ func (t CalculateFee) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["feeQuoterCid"] = model.NestedToDAMLValue(t.FeeQuoterCid) m["tokenInstrumentId"] = model.NestedToDAMLValue(t.TokenInstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1248,8 +1248,8 @@ func (t *CalculateFee) UnmarshalHex(data string) error { // CalculateFeeMCMSParams is CalculateFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type CalculateFeeMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes CalculateFeeMCMSParams to hex string for MCMS operationData. @@ -1271,7 +1271,7 @@ type ChainUpdate struct { RemoteTokenAddress types.TEXT `json:"remoteTokenAddress" hex:"bytes"` InboundCCVs []chainlinkapi.RawInstanceAddress `json:"inboundCCVs"` OutboundCCVs []chainlinkapi.RawInstanceAddress `json:"outboundCCVs"` - FinalityConfig core.FinalityConfig `json:"finalityConfig"` + FinalityConfig ccipcodec.FinalityConfig `json:"finalityConfig"` InboundRateLimiter chainlinkapi.RawInstanceAddress `json:"inboundRateLimiter"` InboundCustomBlockConfirmationsRateLimiter chainlinkapi.RawInstanceAddress `json:"inboundCustomBlockConfirmationsRateLimiter"` OutboundRateLimiter chainlinkapi.RawInstanceAddress `json:"outboundRateLimiter"` @@ -1376,10 +1376,11 @@ func (t *ClearPoolReceiveContext) UnmarshalHex(data string) error { // GetFee is a Record type type GetFee struct { - FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` - DestChainSelector types.NUMERIC `json:"destChainSelector"` - TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` - Caller types.PARTY `json:"caller"` + FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetFee to a map for DAML arguments @@ -1392,6 +1393,8 @@ func (t GetFee) ToMap() map[string]any { m["tokenInstrumentId"] = model.NestedToDAMLValue(t.TokenInstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1422,8 +1425,9 @@ func (t *GetFee) UnmarshalHex(data string) error { // GetFeeMCMSParams is GetFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetFeeMCMSParams struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetFeeMCMSParams to hex string for MCMS operationData. @@ -1440,12 +1444,13 @@ func (t *GetFeeMCMSParams) UnmarshalHex(data string) error { // GetRequiredCCVs is a Record type type GetRequiredCCVs struct { - RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` - SourceAmount types.TEXT `json:"sourceAmount"` - Finality core.FinalityConfig `json:"finality"` - ExtraData types.TEXT `json:"extraData"` - Direction extensionapi.TransferDirection `json:"direction"` - Caller types.PARTY `json:"caller"` + RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` + SourceAmount types.TEXT `json:"sourceAmount"` + Finality ccipcodec.FinalityConfig `json:"finality"` + ExtraData types.TEXT `json:"extraData"` + Direction extensionapi.TransferDirection `json:"direction"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetRequiredCCVs to a map for DAML arguments @@ -1462,6 +1467,8 @@ func (t GetRequiredCCVs) ToMap() map[string]any { m["direction"] = model.NestedToDAMLValue(t.Direction) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1492,11 +1499,12 @@ func (t *GetRequiredCCVs) UnmarshalHex(data string) error { // GetRequiredCCVsMCMSParams is GetRequiredCCVs without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetRequiredCCVsMCMSParams struct { - RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` - SourceAmount types.TEXT `json:"sourceAmount"` - Finality core.FinalityConfig `json:"finality"` - ExtraData types.TEXT `json:"extraData"` - Direction extensionapi.TransferDirection `json:"direction"` + RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` + SourceAmount types.TEXT `json:"sourceAmount"` + Finality ccipcodec.FinalityConfig `json:"finality"` + ExtraData types.TEXT `json:"extraData"` + Direction extensionapi.TransferDirection `json:"direction"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetRequiredCCVsMCMSParams to hex string for MCMS operationData. @@ -1516,10 +1524,10 @@ type LockOrBurn struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` SenderInputCids []types.CONTRACT_ID `json:"senderInputCids"` Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -1533,8 +1541,6 @@ func (t LockOrBurn) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["senderInputCids"] = func() []any { @@ -1547,6 +1553,8 @@ func (t LockOrBurn) ToMap() map[string]any { m["amount"] = t.Amount + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1577,9 +1585,9 @@ func (t *LockOrBurn) UnmarshalHex(data string) error { // LockOrBurnMCMSParams is LockOrBurn without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type LockOrBurnMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SenderInputCids []types.CONTRACT_ID `json:"senderInputCids"` Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes LockOrBurnMCMSParams to hex string for MCMS operationData. @@ -1644,8 +1652,8 @@ type ReleaseFromTicket struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` TokenReceiveTicketCid types.CONTRACT_ID `json:"tokenReceiveTicketCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -1659,10 +1667,10 @@ func (t ReleaseFromTicket) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1693,7 +1701,7 @@ func (t *ReleaseFromTicket) UnmarshalHex(data string) error { // ReleaseFromTicketMCMSParams is ReleaseFromTicket without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type ReleaseFromTicketMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes ReleaseFromTicketMCMSParams to hex string for MCMS operationData. @@ -1714,7 +1722,7 @@ type RemoteChainConfig struct { RemoteTokenAddress types.TEXT `json:"remoteTokenAddress" hex:"bytes"` InboundCCVs []chainlinkapi.RawInstanceAddress `json:"inboundCCVs"` OutboundCCVs []chainlinkapi.RawInstanceAddress `json:"outboundCCVs"` - FinalityConfig core.FinalityConfig `json:"finalityConfig"` + FinalityConfig ccipcodec.FinalityConfig `json:"finalityConfig"` InboundRateLimiter chainlinkapi.RawInstanceAddress `json:"inboundRateLimiter"` InboundCustomBlockConfirmationsRateLimiter chainlinkapi.RawInstanceAddress `json:"inboundCustomBlockConfirmationsRateLimiter"` OutboundRateLimiter chainlinkapi.RawInstanceAddress `json:"outboundRateLimiter"` @@ -2378,28 +2386,12 @@ func (v TransferTimeout) GetVariantValue() any { var _ types.VARIANT = (*TransferTimeout)(nil) -// GetVariantTagByte implements types.VariantWithTagByte interface for MCMS numeric tag encoding -func (v TransferTimeout) GetVariantTagByte() byte { - - if v.Indefinite != nil { - return 0 - } - - if v.RelativeHours != nil { - return 1 - } - - return 0xFF // Invalid/unknown variant -} - -var _ types.VariantWithTagByte = (*TransferTimeout)(nil) - // VerifyInboundMessage is a Record type type VerifyInboundMessage struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -2411,10 +2403,10 @@ func (t VerifyInboundMessage) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -2445,7 +2437,7 @@ func (t *VerifyInboundMessage) UnmarshalHex(data string) error { // VerifyInboundMessageMCMSParams is VerifyInboundMessage without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type VerifyInboundMessageMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes VerifyInboundMessageMCMSParams to hex string for MCMS operationData. @@ -2464,9 +2456,9 @@ func (t *VerifyInboundMessageMCMSParams) UnmarshalHex(data string) error { type VerifyOutboundCCVs struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -2478,12 +2470,12 @@ func (t VerifyOutboundCCVs) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["amount"] = t.Amount + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -2514,8 +2506,8 @@ func (t *VerifyOutboundCCVs) UnmarshalHex(data string) error { // VerifyOutboundCCVsMCMSParams is VerifyOutboundCCVs without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type VerifyOutboundCCVsMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` - Amount types.NUMERIC `json:"amount"` + Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes VerifyOutboundCCVsMCMSParams to hex string for MCMS operationData. diff --git a/bindings/generated/latest/ccip/ccipapi/ccipapi.go b/bindings/generated/latest/ccip/ccipapi/ccipapi.go new file mode 100644 index 000000000..480c95fbe --- /dev/null +++ b/bindings/generated/latest/ccip/ccipapi/ccipapi.go @@ -0,0 +1,2873 @@ +package ccipapi + +import ( + "errors" + "fmt" + "math/big" + "strings" + + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" + chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" + splice_api_token_holding_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" + splice_api_token_metadata_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" + "github.com/smartcontractkit/go-daml/pkg/bind" + "github.com/smartcontractkit/go-daml/pkg/codec" + "github.com/smartcontractkit/go-daml/pkg/model" + "github.com/smartcontractkit/go-daml/pkg/types" +) + +var ( + _ = fmt.Sprintf + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = model.Command{} + _ bind.BoundTemplate +) + +const ( + PackageName = "ccip-api" + PackageID = "c75fdf89323c8e97c8b2dc15e37402c69a5ad1c12c8073c7a296b1bef68bc963" + SDKVersion = "3.4.11" +) + +type Template interface { + CreateCommand() *model.CreateCommand + GetTemplateID() string +} + +// IIExecutingMessage is a DAML interface +type IIExecutingMessage interface { + + // ExecutingMessageCancelExecute executes the ExecutingMessage_CancelExecute choice + ExecutingMessageCancelExecute(contractID string, args ExecutingMessageCancelExecute) *model.ExerciseCommand + + // ExecutingMessageAddCCVVerification executes the ExecutingMessage_AddCCVVerification choice + ExecutingMessageAddCCVVerification(contractID string, args ExecutingMessageAddCCVVerification) *model.ExerciseCommand + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand +} + +// IIFeeQuoter is a DAML interface +type IIFeeQuoter interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand + + // FeeQuoterPublicFetch executes the FeeQuoter_PublicFetch choice + FeeQuoterPublicFetch(contractID string, args FeeQuoterPublicFetch) *model.ExerciseCommand + + // FeeQuoterGetTokenPrice executes the FeeQuoter_GetTokenPrice choice + FeeQuoterGetTokenPrice(contractID string, args FeeQuoterGetTokenPrice) *model.ExerciseCommand + + // FeeQuoterGetDestinationChainGasPrice executes the FeeQuoter_GetDestinationChainGasPrice choice + FeeQuoterGetDestinationChainGasPrice(contractID string, args FeeQuoterGetDestinationChainGasPrice) *model.ExerciseCommand + + // FeeQuoterGetTokenTransferFee executes the FeeQuoter_GetTokenTransferFee choice + FeeQuoterGetTokenTransferFee(contractID string, args FeeQuoterGetTokenTransferFee) *model.ExerciseCommand + + // FeeQuoterQuoteGasForExec executes the FeeQuoter_QuoteGasForExec choice + FeeQuoterQuoteGasForExec(contractID string, args FeeQuoterQuoteGasForExec) *model.ExerciseCommand + + // FeeQuoterGetFeeTokens executes the FeeQuoter_GetFeeTokens choice + FeeQuoterGetFeeTokens(contractID string, args FeeQuoterGetFeeTokens) *model.ExerciseCommand +} + +// IIGlobalConfig is a DAML interface +type IIGlobalConfig interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand + + // GlobalConfigPublicFetch executes the GlobalConfig_PublicFetch choice + GlobalConfigPublicFetch(contractID string, args GlobalConfigPublicFetch) *model.ExerciseCommand + + // GlobalConfigGetDestChainConfig executes the GlobalConfig_GetDestChainConfig choice + GlobalConfigGetDestChainConfig(contractID string, args GlobalConfigGetDestChainConfig) *model.ExerciseCommand + + // GlobalConfigGetSourceChainConfig executes the GlobalConfig_GetSourceChainConfig choice + GlobalConfigGetSourceChainConfig(contractID string, args GlobalConfigGetSourceChainConfig) *model.ExerciseCommand +} + +// IIRMNRemote is a DAML interface +type IIRMNRemote interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand + + // RMNRemotePublicFetch executes the RMNRemote_PublicFetch choice + RMNRemotePublicFetch(contractID string, args RMNRemotePublicFetch) *model.ExerciseCommand + + // RMNRemoteIsCursed executes the RMNRemote_IsCursed choice + RMNRemoteIsCursed(contractID string, args RMNRemoteIsCursed) *model.ExerciseCommand + + // RMNRemoteIsCursedForChain executes the RMNRemote_IsCursedForChain choice + RMNRemoteIsCursedForChain(contractID string, args RMNRemoteIsCursedForChain) *model.ExerciseCommand + + // RMNRemoteGetCursedSubjects executes the RMNRemote_GetCursedSubjects choice + RMNRemoteGetCursedSubjects(contractID string, args RMNRemoteGetCursedSubjects) *model.ExerciseCommand +} + +// IISendingMessage is a DAML interface +type IISendingMessage interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand + + // SendingMessageFeeTokenAmount executes the SendingMessage_FeeTokenAmount choice + SendingMessageFeeTokenAmount(contractID string, args SendingMessageFeeTokenAmount) *model.ExerciseCommand + + // SendingMessageAddCCVFee executes the SendingMessage_AddCCVFee choice + SendingMessageAddCCVFee(contractID string, args SendingMessageAddCCVFee) *model.ExerciseCommand + + // SendingMessageAddVerifierData executes the SendingMessage_AddVerifierData choice + SendingMessageAddVerifierData(contractID string, args SendingMessageAddVerifierData) *model.ExerciseCommand + + // SendingMessageAddExecutorFee executes the SendingMessage_AddExecutorFee choice + SendingMessageAddExecutorFee(contractID string, args SendingMessageAddExecutorFee) *model.ExerciseCommand +} + +// IITokenAdminRegistry is a DAML interface +type IITokenAdminRegistry interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand + + // TokenAdminRegistryPublicFetch executes the TokenAdminRegistry_PublicFetch choice + TokenAdminRegistryPublicFetch(contractID string, args TokenAdminRegistryPublicFetch) *model.ExerciseCommand + + // TokenAdminRegistryFetchTokenConfig executes the TokenAdminRegistry_FetchTokenConfig choice + TokenAdminRegistryFetchTokenConfig(contractID string, args TokenAdminRegistryFetchTokenConfig) *model.ExerciseCommand + + // TokenAdminRegistrySetPool executes the TokenAdminRegistry_SetPool choice + TokenAdminRegistrySetPool(contractID string, args TokenAdminRegistrySetPool) *model.ExerciseCommand + + // TokenAdminRegistrySetTransferFactory executes the TokenAdminRegistry_SetTransferFactory choice + TokenAdminRegistrySetTransferFactory(contractID string, args TokenAdminRegistrySetTransferFactory) *model.ExerciseCommand + + // TokenAdminRegistrySetBurnMintFactory executes the TokenAdminRegistry_SetBurnMintFactory choice + TokenAdminRegistrySetBurnMintFactory(contractID string, args TokenAdminRegistrySetBurnMintFactory) *model.ExerciseCommand + + // TokenAdminRegistryProposeAdministrator executes the TokenAdminRegistry_ProposeAdministrator choice + TokenAdminRegistryProposeAdministrator(contractID string, args TokenAdminRegistryProposeAdministrator) *model.ExerciseCommand + + // TokenAdminRegistryAcceptAdminRole executes the TokenAdminRegistry_AcceptAdminRole choice + TokenAdminRegistryAcceptAdminRole(contractID string, args TokenAdminRegistryAcceptAdminRole) *model.ExerciseCommand + + // TokenAdminRegistryTransferAdminRole executes the TokenAdminRegistry_TransferAdminRole choice + TokenAdminRegistryTransferAdminRole(contractID string, args TokenAdminRegistryTransferAdminRole) *model.ExerciseCommand + + // TokenAdminRegistryIsAdministrator executes the TokenAdminRegistry_IsAdministrator choice + TokenAdminRegistryIsAdministrator(contractID string, args TokenAdminRegistryIsAdministrator) *model.ExerciseCommand + + // TokenAdminRegistrySetInboundPoolCCVs executes the TokenAdminRegistry_SetInboundPoolCCVs choice + TokenAdminRegistrySetInboundPoolCCVs(contractID string, args TokenAdminRegistrySetInboundPoolCCVs) *model.ExerciseCommand + + // TokenAdminRegistrySetOutboundPoolCCVs executes the TokenAdminRegistry_SetOutboundPoolCCVs choice + TokenAdminRegistrySetOutboundPoolCCVs(contractID string, args TokenAdminRegistrySetOutboundPoolCCVs) *model.ExerciseCommand + + // TokenAdminRegistryAddTokenSend executes the TokenAdminRegistry_AddTokenSend choice + TokenAdminRegistryAddTokenSend(contractID string, args TokenAdminRegistryAddTokenSend) *model.ExerciseCommand + + // TokenAdminRegistryAddTokenSendFee executes the TokenAdminRegistry_AddTokenSendFee choice + TokenAdminRegistryAddTokenSendFee(contractID string, args TokenAdminRegistryAddTokenSendFee) *model.ExerciseCommand + + // TokenAdminRegistryConsumeReceiveTicket executes the TokenAdminRegistry_ConsumeReceiveTicket choice + TokenAdminRegistryConsumeReceiveTicket(contractID string, args TokenAdminRegistryConsumeReceiveTicket) *model.ExerciseCommand +} + +// IITokenConfig is a DAML interface +type IITokenConfig interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand + + // TokenConfigPublicFetch executes the TokenConfig_PublicFetch choice + TokenConfigPublicFetch(contractID string, args TokenConfigPublicFetch) *model.ExerciseCommand + + // TokenConfigAssertConfiguredTransferFactory executes the TokenConfig_AssertConfiguredTransferFactory choice + TokenConfigAssertConfiguredTransferFactory(contractID string, args TokenConfigAssertConfiguredTransferFactory) *model.ExerciseCommand + + // TokenConfigAssertConfiguredBurnMintFactory executes the TokenConfig_AssertConfiguredBurnMintFactory choice + TokenConfigAssertConfiguredBurnMintFactory(contractID string, args TokenConfigAssertConfiguredBurnMintFactory) *model.ExerciseCommand +} + +// IITokenReceiveTicket is a DAML interface +type IITokenReceiveTicket interface { + + // Consume executes the Consume choice + Consume(contractID string, args Consume) *model.ExerciseCommand + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand +} + +const ( + RmnRemoteContextKey = types.TEXT("rmn-remote") + TokenConfigContextKey = types.TEXT("token-config") + TokenAdminRegistryContextKey = types.TEXT("token-admin-registry") + FeeQuoterContextKey = types.TEXT("fee-quoter") + GlobalConfigContextKey = types.TEXT("global-config") +) + +func argsToMap(args any) map[string]any { + if args == nil { + return map[string]any{} + } + + if m, ok := args.(map[string]any); ok { + return m + } + + type mapper interface { + ToMap() map[string]any + } + if mapper, ok := args.(mapper); ok { + return mapper.ToMap() + } + + return map[string]any{"args": args} +} + +// Consume is a Record type +type Consume struct { +} + +// ToMap converts Consume to a map for DAML arguments +func (t Consume) ToMap() map[string]any { + m := make(map[string]any) + return m +} + +func (t Consume) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *Consume) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes Consume to hex string (Canton MCMS format) +func (t Consume) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes Consume from hex string (Canton MCMS format) +func (t *Consume) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// DestChainConfig is a Record type +type DestChainConfig struct { + IsEnabled types.BOOL `json:"isEnabled"` + AddressBytesLength types.INT64 `json:"addressBytesLength"` + TokenReceiverAllowed types.BOOL `json:"tokenReceiverAllowed"` + BaseExecutionGasCost types.INT64 `json:"baseExecutionGasCost"` + OffRampAddress types.TEXT `json:"offRampAddress" hex:"bytes"` + DefaultExecutor *chainlinkapi.RawInstanceAddress `json:"defaultExecutor" hex:"optional"` + LaneMandatedCCVs []chainlinkapi.RawInstanceAddress `json:"laneMandatedCCVs"` + DefaultCCVs []chainlinkapi.RawInstanceAddress `json:"defaultCCVs"` + MessageNetworkFeeUSDCents types.NUMERIC `json:"messageNetworkFeeUSDCents"` + TokenNetworkFeeUSDCents types.NUMERIC `json:"tokenNetworkFeeUSDCents"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts DestChainConfig to a map for DAML arguments +func (t DestChainConfig) ToMap() map[string]any { + m := make(map[string]any) + + m["isEnabled"] = bool(t.IsEnabled) + + m["addressBytesLength"] = int64(t.AddressBytesLength) + + m["tokenReceiverAllowed"] = bool(t.TokenReceiverAllowed) + + m["baseExecutionGasCost"] = int64(t.BaseExecutionGasCost) + + m["offRampAddress"] = string(t.OffRampAddress) + + if t.DefaultExecutor != nil { + m["defaultExecutor"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.DefaultExecutor), + } + } else { + m["defaultExecutor"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["laneMandatedCCVs"] = func() []any { + res := make([]any, 0, len(t.LaneMandatedCCVs)) + for _, e := range t.LaneMandatedCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["defaultCCVs"] = func() []any { + res := make([]any, 0, len(t.DefaultCCVs)) + for _, e := range t.DefaultCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["messageNetworkFeeUSDCents"] = t.MessageNetworkFeeUSDCents + + m["tokenNetworkFeeUSDCents"] = t.TokenNetworkFeeUSDCents + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t DestChainConfig) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *DestChainConfig) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes DestChainConfig to hex string (Canton MCMS format) +func (t DestChainConfig) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes DestChainConfig from hex string (Canton MCMS format) +func (t *DestChainConfig) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecutingMessageView is a Record type +type ExecutingMessageView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + Message ccipcodec.MessageV1 `json:"message"` + OffRamp chainlinkapi.RawInstanceAddress `json:"offRamp"` + GlobalConfig chainlinkapi.RawInstanceAddress `json:"globalConfig"` + RmnRemote chainlinkapi.RawInstanceAddress `json:"rmnRemote"` + TokenAdminRegistry chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts ExecutingMessageView to a map for DAML arguments +func (t ExecutingMessageView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["message"] = model.NestedToDAMLValue(t.Message) + + m["offRamp"] = model.NestedToDAMLValue(t.OffRamp) + + m["globalConfig"] = model.NestedToDAMLValue(t.GlobalConfig) + + m["rmnRemote"] = model.NestedToDAMLValue(t.RmnRemote) + + m["tokenAdminRegistry"] = model.NestedToDAMLValue(t.TokenAdminRegistry) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t ExecutingMessageView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutingMessageView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutingMessageView to hex string (Canton MCMS format) +func (t ExecutingMessageView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutingMessageView from hex string (Canton MCMS format) +func (t *ExecutingMessageView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecutingMessageAddCCVVerification is a Record type +type ExecutingMessageAddCCVVerification struct { + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + VersionTag types.TEXT `json:"versionTag" hex:"bytes"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts ExecutingMessageAddCCVVerification to a map for DAML arguments +func (t ExecutingMessageAddCCVVerification) ToMap() map[string]any { + m := make(map[string]any) + + m["ccvInstanceId"] = string(t.CcvInstanceId) + + m["versionTag"] = string(t.VersionTag) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t ExecutingMessageAddCCVVerification) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutingMessageAddCCVVerification) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutingMessageAddCCVVerification to hex string (Canton MCMS format) +func (t ExecutingMessageAddCCVVerification) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutingMessageAddCCVVerification from hex string (Canton MCMS format) +func (t *ExecutingMessageAddCCVVerification) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecutingMessageCancelExecute is a Record type +type ExecutingMessageCancelExecute struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts ExecutingMessageCancelExecute to a map for DAML arguments +func (t ExecutingMessageCancelExecute) ToMap() map[string]any { + m := make(map[string]any) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t ExecutingMessageCancelExecute) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutingMessageCancelExecute) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutingMessageCancelExecute to hex string (Canton MCMS format) +func (t ExecutingMessageCancelExecute) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutingMessageCancelExecute from hex string (Canton MCMS format) +func (t *ExecutingMessageCancelExecute) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// FeeQuoterView is a Record type +type FeeQuoterView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + InstanceId types.TEXT `json:"instanceId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts FeeQuoterView to a map for DAML arguments +func (t FeeQuoterView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["instanceId"] = string(t.InstanceId) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t FeeQuoterView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *FeeQuoterView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes FeeQuoterView to hex string (Canton MCMS format) +func (t FeeQuoterView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes FeeQuoterView from hex string (Canton MCMS format) +func (t *FeeQuoterView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// FeeQuoterGetDestinationChainGasPrice is a Record type +type FeeQuoterGetDestinationChainGasPrice struct { + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts FeeQuoterGetDestinationChainGasPrice to a map for DAML arguments +func (t FeeQuoterGetDestinationChainGasPrice) ToMap() map[string]any { + m := make(map[string]any) + + m["destChainSelector"] = t.DestChainSelector + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t FeeQuoterGetDestinationChainGasPrice) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *FeeQuoterGetDestinationChainGasPrice) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes FeeQuoterGetDestinationChainGasPrice to hex string (Canton MCMS format) +func (t FeeQuoterGetDestinationChainGasPrice) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes FeeQuoterGetDestinationChainGasPrice from hex string (Canton MCMS format) +func (t *FeeQuoterGetDestinationChainGasPrice) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// FeeQuoterGetFeeTokens is a Record type +type FeeQuoterGetFeeTokens struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts FeeQuoterGetFeeTokens to a map for DAML arguments +func (t FeeQuoterGetFeeTokens) ToMap() map[string]any { + m := make(map[string]any) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t FeeQuoterGetFeeTokens) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *FeeQuoterGetFeeTokens) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes FeeQuoterGetFeeTokens to hex string (Canton MCMS format) +func (t FeeQuoterGetFeeTokens) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes FeeQuoterGetFeeTokens from hex string (Canton MCMS format) +func (t *FeeQuoterGetFeeTokens) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// FeeQuoterGetTokenPrice is a Record type +type FeeQuoterGetTokenPrice struct { + Token splice_api_token_holding_v1.InstrumentId `json:"token"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts FeeQuoterGetTokenPrice to a map for DAML arguments +func (t FeeQuoterGetTokenPrice) ToMap() map[string]any { + m := make(map[string]any) + + m["token"] = model.NestedToDAMLValue(t.Token) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t FeeQuoterGetTokenPrice) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *FeeQuoterGetTokenPrice) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes FeeQuoterGetTokenPrice to hex string (Canton MCMS format) +func (t FeeQuoterGetTokenPrice) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes FeeQuoterGetTokenPrice from hex string (Canton MCMS format) +func (t *FeeQuoterGetTokenPrice) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// FeeQuoterGetTokenTransferFee is a Record type +type FeeQuoterGetTokenTransferFee struct { + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Token splice_api_token_holding_v1.InstrumentId `json:"token"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts FeeQuoterGetTokenTransferFee to a map for DAML arguments +func (t FeeQuoterGetTokenTransferFee) ToMap() map[string]any { + m := make(map[string]any) + + m["destChainSelector"] = t.DestChainSelector + + m["token"] = model.NestedToDAMLValue(t.Token) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t FeeQuoterGetTokenTransferFee) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *FeeQuoterGetTokenTransferFee) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes FeeQuoterGetTokenTransferFee to hex string (Canton MCMS format) +func (t FeeQuoterGetTokenTransferFee) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes FeeQuoterGetTokenTransferFee from hex string (Canton MCMS format) +func (t *FeeQuoterGetTokenTransferFee) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// FeeQuoterPublicFetch is a Record type +type FeeQuoterPublicFetch struct { + ExpectedAddress chainlinkapi.RawInstanceAddress `json:"expectedAddress"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts FeeQuoterPublicFetch to a map for DAML arguments +func (t FeeQuoterPublicFetch) ToMap() map[string]any { + m := make(map[string]any) + + m["expectedAddress"] = model.NestedToDAMLValue(t.ExpectedAddress) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t FeeQuoterPublicFetch) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *FeeQuoterPublicFetch) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes FeeQuoterPublicFetch to hex string (Canton MCMS format) +func (t FeeQuoterPublicFetch) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes FeeQuoterPublicFetch from hex string (Canton MCMS format) +func (t *FeeQuoterPublicFetch) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// FeeQuoterQuoteGasForExec is a Record type +type FeeQuoterQuoteGasForExec struct { + DestChainSelector types.NUMERIC `json:"destChainSelector"` + NonCalldataGas types.INT64 `json:"nonCalldataGas"` + CalldataSize types.INT64 `json:"calldataSize"` + FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts FeeQuoterQuoteGasForExec to a map for DAML arguments +func (t FeeQuoterQuoteGasForExec) ToMap() map[string]any { + m := make(map[string]any) + + m["destChainSelector"] = t.DestChainSelector + + m["nonCalldataGas"] = int64(t.NonCalldataGas) + + m["calldataSize"] = int64(t.CalldataSize) + + m["feeToken"] = model.NestedToDAMLValue(t.FeeToken) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t FeeQuoterQuoteGasForExec) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *FeeQuoterQuoteGasForExec) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes FeeQuoterQuoteGasForExec to hex string (Canton MCMS format) +func (t FeeQuoterQuoteGasForExec) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes FeeQuoterQuoteGasForExec from hex string (Canton MCMS format) +func (t *FeeQuoterQuoteGasForExec) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// GlobalConfigView is a Record type +type GlobalConfigView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts GlobalConfigView to a map for DAML arguments +func (t GlobalConfigView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t GlobalConfigView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *GlobalConfigView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes GlobalConfigView to hex string (Canton MCMS format) +func (t GlobalConfigView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes GlobalConfigView from hex string (Canton MCMS format) +func (t *GlobalConfigView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// GlobalConfigGetDestChainConfig is a Record type +type GlobalConfigGetDestChainConfig struct { + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts GlobalConfigGetDestChainConfig to a map for DAML arguments +func (t GlobalConfigGetDestChainConfig) ToMap() map[string]any { + m := make(map[string]any) + + m["destChainSelector"] = t.DestChainSelector + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t GlobalConfigGetDestChainConfig) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *GlobalConfigGetDestChainConfig) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes GlobalConfigGetDestChainConfig to hex string (Canton MCMS format) +func (t GlobalConfigGetDestChainConfig) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes GlobalConfigGetDestChainConfig from hex string (Canton MCMS format) +func (t *GlobalConfigGetDestChainConfig) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// GlobalConfigGetSourceChainConfig is a Record type +type GlobalConfigGetSourceChainConfig struct { + SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts GlobalConfigGetSourceChainConfig to a map for DAML arguments +func (t GlobalConfigGetSourceChainConfig) ToMap() map[string]any { + m := make(map[string]any) + + m["sourceChainSelector"] = t.SourceChainSelector + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t GlobalConfigGetSourceChainConfig) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *GlobalConfigGetSourceChainConfig) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes GlobalConfigGetSourceChainConfig to hex string (Canton MCMS format) +func (t GlobalConfigGetSourceChainConfig) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes GlobalConfigGetSourceChainConfig from hex string (Canton MCMS format) +func (t *GlobalConfigGetSourceChainConfig) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// GlobalConfigPublicFetch is a Record type +type GlobalConfigPublicFetch struct { + ExpectedAddress chainlinkapi.RawInstanceAddress `json:"expectedAddress"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts GlobalConfigPublicFetch to a map for DAML arguments +func (t GlobalConfigPublicFetch) ToMap() map[string]any { + m := make(map[string]any) + + m["expectedAddress"] = model.NestedToDAMLValue(t.ExpectedAddress) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t GlobalConfigPublicFetch) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *GlobalConfigPublicFetch) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes GlobalConfigPublicFetch to hex string (Canton MCMS format) +func (t GlobalConfigPublicFetch) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes GlobalConfigPublicFetch from hex string (Canton MCMS format) +func (t *GlobalConfigPublicFetch) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// MessageExecutionState is an enum type +type MessageExecutionState string + +const ( + MessageExecutionStateUNTOUCHED MessageExecutionState = "UNTOUCHED" + + MessageExecutionStateIN_PROGRESS MessageExecutionState = "IN_PROGRESS" + + MessageExecutionStateSUCCESS MessageExecutionState = "SUCCESS" + + MessageExecutionStateFAILURE MessageExecutionState = "FAILURE" +) + +func (e MessageExecutionState) GetEnumConstructor() string { return string(e) } + +func (e MessageExecutionState) GetEnumTypeID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.ExecutingMessage", "MessageExecutionState") +} + +// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name +func (e MessageExecutionState) GetEnumTypeIDWithPackageID(packageID string) string { + return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.APIV1.ExecutingMessage", "MessageExecutionState") +} + +func (e MessageExecutionState) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(e) +} + +func (e *MessageExecutionState) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, e) +} + +// MarshalHex encodes MessageExecutionState to hex string (Canton MCMS format) +func (e MessageExecutionState) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(e) +} + +// UnmarshalHex decodes MessageExecutionState from hex string (Canton MCMS format) +func (e *MessageExecutionState) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, e) +} + +var _ types.ENUM = MessageExecutionState("") + +// PoolRegistration is a Record type +type PoolRegistration struct { + PoolOwner types.PARTY `json:"poolOwner"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` +} + +// ToMap converts PoolRegistration to a map for DAML arguments +func (t PoolRegistration) ToMap() map[string]any { + m := make(map[string]any) + + m["poolOwner"] = t.PoolOwner.ToMap() + + m["poolInstanceId"] = string(t.PoolInstanceId) + + return m +} + +func (t PoolRegistration) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PoolRegistration) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PoolRegistration to hex string (Canton MCMS format) +func (t PoolRegistration) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PoolRegistration from hex string (Canton MCMS format) +func (t *PoolRegistration) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ProposeAdministratorResult is a Record type +type ProposeAdministratorResult struct { + TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + Created types.BOOL `json:"created"` + Index types.INT64 `json:"index"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts ProposeAdministratorResult to a map for DAML arguments +func (t ProposeAdministratorResult) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenAdminRegistryCid"] = model.NestedToDAMLValue(t.TokenAdminRegistryCid) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["created"] = bool(t.Created) + + m["index"] = int64(t.Index) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t ProposeAdministratorResult) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ProposeAdministratorResult) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ProposeAdministratorResult to hex string (Canton MCMS format) +func (t ProposeAdministratorResult) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ProposeAdministratorResult from hex string (Canton MCMS format) +func (t *ProposeAdministratorResult) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// QuoteGasForExecResult is a Record type +type QuoteGasForExecResult struct { + TotalGas types.INT64 `json:"totalGas"` + GasCostUSDCents types.NUMERIC `json:"gasCostUSDCents"` + FeeTokenPrice types.NUMERIC `json:"feeTokenPrice"` + PremiumMultiplier types.NUMERIC `json:"premiumMultiplier"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts QuoteGasForExecResult to a map for DAML arguments +func (t QuoteGasForExecResult) ToMap() map[string]any { + m := make(map[string]any) + + m["totalGas"] = int64(t.TotalGas) + + m["gasCostUSDCents"] = t.GasCostUSDCents + + m["feeTokenPrice"] = t.FeeTokenPrice + + m["premiumMultiplier"] = t.PremiumMultiplier + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t QuoteGasForExecResult) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *QuoteGasForExecResult) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes QuoteGasForExecResult to hex string (Canton MCMS format) +func (t QuoteGasForExecResult) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes QuoteGasForExecResult from hex string (Canton MCMS format) +func (t *QuoteGasForExecResult) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// RMNRemoteView is a Record type +type RMNRemoteView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + RmnOwner types.PARTY `json:"rmnOwner"` + InstanceId types.TEXT `json:"instanceId"` +} + +// ToMap converts RMNRemoteView to a map for DAML arguments +func (t RMNRemoteView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["rmnOwner"] = t.RmnOwner.ToMap() + + m["instanceId"] = string(t.InstanceId) + + return m +} + +func (t RMNRemoteView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *RMNRemoteView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes RMNRemoteView to hex string (Canton MCMS format) +func (t RMNRemoteView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes RMNRemoteView from hex string (Canton MCMS format) +func (t *RMNRemoteView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// RMNRemoteGetCursedSubjects is a Record type +type RMNRemoteGetCursedSubjects struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts RMNRemoteGetCursedSubjects to a map for DAML arguments +func (t RMNRemoteGetCursedSubjects) ToMap() map[string]any { + m := make(map[string]any) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t RMNRemoteGetCursedSubjects) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *RMNRemoteGetCursedSubjects) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes RMNRemoteGetCursedSubjects to hex string (Canton MCMS format) +func (t RMNRemoteGetCursedSubjects) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes RMNRemoteGetCursedSubjects from hex string (Canton MCMS format) +func (t *RMNRemoteGetCursedSubjects) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// RMNRemoteIsCursed is a Record type +type RMNRemoteIsCursed struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts RMNRemoteIsCursed to a map for DAML arguments +func (t RMNRemoteIsCursed) ToMap() map[string]any { + m := make(map[string]any) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t RMNRemoteIsCursed) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *RMNRemoteIsCursed) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes RMNRemoteIsCursed to hex string (Canton MCMS format) +func (t RMNRemoteIsCursed) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes RMNRemoteIsCursed from hex string (Canton MCMS format) +func (t *RMNRemoteIsCursed) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// RMNRemoteIsCursedForChain is a Record type +type RMNRemoteIsCursedForChain struct { + ChainSelector types.NUMERIC `json:"chainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts RMNRemoteIsCursedForChain to a map for DAML arguments +func (t RMNRemoteIsCursedForChain) ToMap() map[string]any { + m := make(map[string]any) + + m["chainSelector"] = t.ChainSelector + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t RMNRemoteIsCursedForChain) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *RMNRemoteIsCursedForChain) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes RMNRemoteIsCursedForChain to hex string (Canton MCMS format) +func (t RMNRemoteIsCursedForChain) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes RMNRemoteIsCursedForChain from hex string (Canton MCMS format) +func (t *RMNRemoteIsCursedForChain) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// RMNRemotePublicFetch is a Record type +type RMNRemotePublicFetch struct { + ExpectedAddress chainlinkapi.RawInstanceAddress `json:"expectedAddress"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts RMNRemotePublicFetch to a map for DAML arguments +func (t RMNRemotePublicFetch) ToMap() map[string]any { + m := make(map[string]any) + + m["expectedAddress"] = model.NestedToDAMLValue(t.ExpectedAddress) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t RMNRemotePublicFetch) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *RMNRemotePublicFetch) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes RMNRemotePublicFetch to hex string (Canton MCMS format) +func (t RMNRemotePublicFetch) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes RMNRemotePublicFetch from hex string (Canton MCMS format) +func (t *RMNRemotePublicFetch) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// SendingMessageView is a Record type +type SendingMessageView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + Sender types.PARTY `json:"sender"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` + OutboundPoolCCVs *[]chainlinkapi.RawInstanceAddress `json:"outboundPoolCCVs" hex:"optional"` + Router chainlinkapi.RawInstanceAddress `json:"router"` + OnRamp chainlinkapi.RawInstanceAddress `json:"onRamp"` + GlobalConfig chainlinkapi.RawInstanceAddress `json:"globalConfig"` + RmnRemote chainlinkapi.RawInstanceAddress `json:"rmnRemote"` + TokenAdminRegistry chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry"` + FeeQuoter chainlinkapi.RawInstanceAddress `json:"feeQuoter"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts SendingMessageView to a map for DAML arguments +func (t SendingMessageView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["sender"] = t.Sender.ToMap() + + m["destChainSelector"] = t.DestChainSelector + + m["requiredCCVs"] = func() []any { + res := make([]any, 0, len(t.RequiredCCVs)) + for _, e := range t.RequiredCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + if t.OutboundPoolCCVs != nil { + m["outboundPoolCCVs"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.OutboundPoolCCVs), + } + } else { + m["outboundPoolCCVs"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["router"] = model.NestedToDAMLValue(t.Router) + + m["onRamp"] = model.NestedToDAMLValue(t.OnRamp) + + m["globalConfig"] = model.NestedToDAMLValue(t.GlobalConfig) + + m["rmnRemote"] = model.NestedToDAMLValue(t.RmnRemote) + + m["tokenAdminRegistry"] = model.NestedToDAMLValue(t.TokenAdminRegistry) + + m["feeQuoter"] = model.NestedToDAMLValue(t.FeeQuoter) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t SendingMessageView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *SendingMessageView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes SendingMessageView to hex string (Canton MCMS format) +func (t SendingMessageView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SendingMessageView from hex string (Canton MCMS format) +func (t *SendingMessageView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// SendingMessageAddCCVFee is a Record type +type SendingMessageAddCCVFee struct { + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + DestGasLimit types.INT64 `json:"destGasLimit"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts SendingMessageAddCCVFee to a map for DAML arguments +func (t SendingMessageAddCCVFee) ToMap() map[string]any { + m := make(map[string]any) + + m["ccvInstanceId"] = string(t.CcvInstanceId) + + m["feeUSDCents"] = t.FeeUSDCents + + m["destGasLimit"] = int64(t.DestGasLimit) + + m["destBytesOverhead"] = int64(t.DestBytesOverhead) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t SendingMessageAddCCVFee) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *SendingMessageAddCCVFee) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes SendingMessageAddCCVFee to hex string (Canton MCMS format) +func (t SendingMessageAddCCVFee) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SendingMessageAddCCVFee from hex string (Canton MCMS format) +func (t *SendingMessageAddCCVFee) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// SendingMessageAddExecutorFee is a Record type +type SendingMessageAddExecutorFee struct { + ExecutorInstanceId types.TEXT `json:"executorInstanceId"` + ExecutorArgs types.TEXT `json:"executorArgs"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts SendingMessageAddExecutorFee to a map for DAML arguments +func (t SendingMessageAddExecutorFee) ToMap() map[string]any { + m := make(map[string]any) + + m["executorInstanceId"] = string(t.ExecutorInstanceId) + + m["executorArgs"] = string(t.ExecutorArgs) + + m["feeUSDCents"] = t.FeeUSDCents + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t SendingMessageAddExecutorFee) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *SendingMessageAddExecutorFee) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes SendingMessageAddExecutorFee to hex string (Canton MCMS format) +func (t SendingMessageAddExecutorFee) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SendingMessageAddExecutorFee from hex string (Canton MCMS format) +func (t *SendingMessageAddExecutorFee) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// SendingMessageAddVerifierData is a Record type +type SendingMessageAddVerifierData struct { + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + VersionTag types.TEXT `json:"versionTag" hex:"bytes"` + VerifierBlob types.TEXT `json:"verifierBlob"` + MessageSentObservers []types.PARTY `json:"messageSentObservers"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts SendingMessageAddVerifierData to a map for DAML arguments +func (t SendingMessageAddVerifierData) ToMap() map[string]any { + m := make(map[string]any) + + m["ccvInstanceId"] = string(t.CcvInstanceId) + + m["versionTag"] = string(t.VersionTag) + + m["verifierBlob"] = string(t.VerifierBlob) + + m["messageSentObservers"] = func() []any { + res := make([]any, 0, len(t.MessageSentObservers)) + for _, e := range t.MessageSentObservers { + res = append(res, e.ToMap()) + } + return res + }() + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t SendingMessageAddVerifierData) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *SendingMessageAddVerifierData) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes SendingMessageAddVerifierData to hex string (Canton MCMS format) +func (t SendingMessageAddVerifierData) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SendingMessageAddVerifierData from hex string (Canton MCMS format) +func (t *SendingMessageAddVerifierData) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// SendingMessageFeeTokenAmount is a Record type +type SendingMessageFeeTokenAmount struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts SendingMessageFeeTokenAmount to a map for DAML arguments +func (t SendingMessageFeeTokenAmount) ToMap() map[string]any { + m := make(map[string]any) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t SendingMessageFeeTokenAmount) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *SendingMessageFeeTokenAmount) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes SendingMessageFeeTokenAmount to hex string (Canton MCMS format) +func (t SendingMessageFeeTokenAmount) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SendingMessageFeeTokenAmount from hex string (Canton MCMS format) +func (t *SendingMessageFeeTokenAmount) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// SourceChainConfig is a Record type +type SourceChainConfig struct { + IsEnabled types.BOOL `json:"isEnabled"` + OnRampAddresses []types.TEXT `json:"onRampAddresses" hex:"[]bytes"` + DefaultCCVs []chainlinkapi.RawInstanceAddress `json:"defaultCCVs"` + LaneMandatedCCVs []chainlinkapi.RawInstanceAddress `json:"laneMandatedCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts SourceChainConfig to a map for DAML arguments +func (t SourceChainConfig) ToMap() map[string]any { + m := make(map[string]any) + + m["isEnabled"] = bool(t.IsEnabled) + + m["onRampAddresses"] = func() []any { + res := make([]any, 0, len(t.OnRampAddresses)) + for _, e := range t.OnRampAddresses { + res = append(res, string(e)) + } + return res + }() + + m["defaultCCVs"] = func() []any { + res := make([]any, 0, len(t.DefaultCCVs)) + for _, e := range t.DefaultCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["laneMandatedCCVs"] = func() []any { + res := make([]any, 0, len(t.LaneMandatedCCVs)) + for _, e := range t.LaneMandatedCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t SourceChainConfig) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *SourceChainConfig) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes SourceChainConfig to hex string (Canton MCMS format) +func (t SourceChainConfig) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SourceChainConfig from hex string (Canton MCMS format) +func (t *SourceChainConfig) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TimestampedPrice is a Record type +type TimestampedPrice struct { + Price types.NUMERIC `json:"price"` + Timestamp types.TIMESTAMP `json:"timestamp"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts TimestampedPrice to a map for DAML arguments +func (t TimestampedPrice) ToMap() map[string]any { + m := make(map[string]any) + + m["price"] = t.Price + + m["timestamp"] = t.Timestamp + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t TimestampedPrice) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TimestampedPrice) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TimestampedPrice to hex string (Canton MCMS format) +func (t TimestampedPrice) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TimestampedPrice from hex string (Canton MCMS format) +func (t *TimestampedPrice) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryView is a Record type +type TokenAdminRegistryView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + InstanceId types.TEXT `json:"instanceId"` +} + +// ToMap converts TokenAdminRegistryView to a map for DAML arguments +func (t TokenAdminRegistryView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["instanceId"] = string(t.InstanceId) + + return m +} + +func (t TokenAdminRegistryView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryView to hex string (Canton MCMS format) +func (t TokenAdminRegistryView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryView from hex string (Canton MCMS format) +func (t *TokenAdminRegistryView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryAcceptAdminRole is a Record type +type TokenAdminRegistryAcceptAdminRole struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryAcceptAdminRole to a map for DAML arguments +func (t TokenAdminRegistryAcceptAdminRole) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryAcceptAdminRole) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryAcceptAdminRole) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryAcceptAdminRole to hex string (Canton MCMS format) +func (t TokenAdminRegistryAcceptAdminRole) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryAcceptAdminRole from hex string (Canton MCMS format) +func (t *TokenAdminRegistryAcceptAdminRole) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryAddTokenSend is a Record type +type TokenAdminRegistryAddTokenSend struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Amount types.TEXT `json:"amount"` + DestTokenAddress types.TEXT `json:"destTokenAddress"` + ExtraData types.TEXT `json:"extraData"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryAddTokenSend to a map for DAML arguments +func (t TokenAdminRegistryAddTokenSend) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + + m["poolInstanceId"] = string(t.PoolInstanceId) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + m["amount"] = string(t.Amount) + + m["destTokenAddress"] = string(t.DestTokenAddress) + + m["extraData"] = string(t.ExtraData) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryAddTokenSend) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryAddTokenSend) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryAddTokenSend to hex string (Canton MCMS format) +func (t TokenAdminRegistryAddTokenSend) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryAddTokenSend from hex string (Canton MCMS format) +func (t *TokenAdminRegistryAddTokenSend) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryAddTokenSendFee is a Record type +type TokenAdminRegistryAddTokenSendFee struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + DestGasOverhead types.INT64 `json:"destGasOverhead"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryAddTokenSendFee to a map for DAML arguments +func (t TokenAdminRegistryAddTokenSendFee) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + + m["poolInstanceId"] = string(t.PoolInstanceId) + + m["feeUSDCents"] = t.FeeUSDCents + + m["destGasOverhead"] = int64(t.DestGasOverhead) + + m["destBytesOverhead"] = int64(t.DestBytesOverhead) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryAddTokenSendFee) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryAddTokenSendFee) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryAddTokenSendFee to hex string (Canton MCMS format) +func (t TokenAdminRegistryAddTokenSendFee) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryAddTokenSendFee from hex string (Canton MCMS format) +func (t *TokenAdminRegistryAddTokenSendFee) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryConsumeReceiveTicket is a Record type +type TokenAdminRegistryConsumeReceiveTicket struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + TokenReceiveTicketCid types.CONTRACT_ID `json:"tokenReceiveTicketCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryConsumeReceiveTicket to a map for DAML arguments +func (t TokenAdminRegistryConsumeReceiveTicket) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + m["poolInstanceId"] = string(t.PoolInstanceId) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryConsumeReceiveTicket) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryConsumeReceiveTicket) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryConsumeReceiveTicket to hex string (Canton MCMS format) +func (t TokenAdminRegistryConsumeReceiveTicket) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryConsumeReceiveTicket from hex string (Canton MCMS format) +func (t *TokenAdminRegistryConsumeReceiveTicket) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryFetchTokenConfig is a Record type +type TokenAdminRegistryFetchTokenConfig struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryFetchTokenConfig to a map for DAML arguments +func (t TokenAdminRegistryFetchTokenConfig) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryFetchTokenConfig) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryFetchTokenConfig) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryFetchTokenConfig to hex string (Canton MCMS format) +func (t TokenAdminRegistryFetchTokenConfig) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryFetchTokenConfig from hex string (Canton MCMS format) +func (t *TokenAdminRegistryFetchTokenConfig) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryIsAdministrator is a Record type +type TokenAdminRegistryIsAdministrator struct { + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + TokenConfigCid *types.CONTRACT_ID `json:"tokenConfigCid" hex:"optional"` + Administrator types.PARTY `json:"administrator"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryIsAdministrator to a map for DAML arguments +func (t TokenAdminRegistryIsAdministrator) ToMap() map[string]any { + m := make(map[string]any) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + if t.TokenConfigCid != nil { + m["tokenConfigCid"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenConfigCid), + } + } else { + m["tokenConfigCid"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["administrator"] = t.Administrator.ToMap() + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryIsAdministrator) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryIsAdministrator) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryIsAdministrator to hex string (Canton MCMS format) +func (t TokenAdminRegistryIsAdministrator) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryIsAdministrator from hex string (Canton MCMS format) +func (t *TokenAdminRegistryIsAdministrator) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryProposeAdministrator is a Record type +type TokenAdminRegistryProposeAdministrator struct { + TokenConfigCid *types.CONTRACT_ID `json:"tokenConfigCid" hex:"optional"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + NewAdmin types.PARTY `json:"newAdmin"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryProposeAdministrator to a map for DAML arguments +func (t TokenAdminRegistryProposeAdministrator) ToMap() map[string]any { + m := make(map[string]any) + + if t.TokenConfigCid != nil { + m["tokenConfigCid"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenConfigCid), + } + } else { + m["tokenConfigCid"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + m["newAdmin"] = t.NewAdmin.ToMap() + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryProposeAdministrator) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryProposeAdministrator) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryProposeAdministrator to hex string (Canton MCMS format) +func (t TokenAdminRegistryProposeAdministrator) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryProposeAdministrator from hex string (Canton MCMS format) +func (t *TokenAdminRegistryProposeAdministrator) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryPublicFetch is a Record type +type TokenAdminRegistryPublicFetch struct { + ExpectedAddress chainlinkapi.RawInstanceAddress `json:"expectedAddress"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryPublicFetch to a map for DAML arguments +func (t TokenAdminRegistryPublicFetch) ToMap() map[string]any { + m := make(map[string]any) + + m["expectedAddress"] = model.NestedToDAMLValue(t.ExpectedAddress) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryPublicFetch) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryPublicFetch) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryPublicFetch to hex string (Canton MCMS format) +func (t TokenAdminRegistryPublicFetch) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryPublicFetch from hex string (Canton MCMS format) +func (t *TokenAdminRegistryPublicFetch) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistrySetBurnMintFactory is a Record type +type TokenAdminRegistrySetBurnMintFactory struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + BurnMintFactory *types.CONTRACT_ID `json:"burnMintFactory" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistrySetBurnMintFactory to a map for DAML arguments +func (t TokenAdminRegistrySetBurnMintFactory) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + if t.BurnMintFactory != nil { + m["burnMintFactory"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.BurnMintFactory), + } + } else { + m["burnMintFactory"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistrySetBurnMintFactory) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistrySetBurnMintFactory) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistrySetBurnMintFactory to hex string (Canton MCMS format) +func (t TokenAdminRegistrySetBurnMintFactory) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistrySetBurnMintFactory from hex string (Canton MCMS format) +func (t *TokenAdminRegistrySetBurnMintFactory) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistrySetInboundPoolCCVs is a Record type +type TokenAdminRegistrySetInboundPoolCCVs struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistrySetInboundPoolCCVs to a map for DAML arguments +func (t TokenAdminRegistrySetInboundPoolCCVs) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) + + m["poolInstanceId"] = string(t.PoolInstanceId) + + m["poolCCVs"] = func() []any { + res := make([]any, 0, len(t.PoolCCVs)) + for _, e := range t.PoolCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistrySetInboundPoolCCVs) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistrySetInboundPoolCCVs) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistrySetInboundPoolCCVs to hex string (Canton MCMS format) +func (t TokenAdminRegistrySetInboundPoolCCVs) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistrySetInboundPoolCCVs from hex string (Canton MCMS format) +func (t *TokenAdminRegistrySetInboundPoolCCVs) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistrySetOutboundPoolCCVs is a Record type +type TokenAdminRegistrySetOutboundPoolCCVs struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistrySetOutboundPoolCCVs to a map for DAML arguments +func (t TokenAdminRegistrySetOutboundPoolCCVs) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + + m["poolInstanceId"] = string(t.PoolInstanceId) + + m["poolCCVs"] = func() []any { + res := make([]any, 0, len(t.PoolCCVs)) + for _, e := range t.PoolCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistrySetOutboundPoolCCVs) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistrySetOutboundPoolCCVs) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistrySetOutboundPoolCCVs to hex string (Canton MCMS format) +func (t TokenAdminRegistrySetOutboundPoolCCVs) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistrySetOutboundPoolCCVs from hex string (Canton MCMS format) +func (t *TokenAdminRegistrySetOutboundPoolCCVs) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistrySetPool is a Record type +type TokenAdminRegistrySetPool struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + TokenPool *PoolRegistration `json:"tokenPool" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistrySetPool to a map for DAML arguments +func (t TokenAdminRegistrySetPool) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + if t.TokenPool != nil { + m["tokenPool"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenPool), + } + } else { + m["tokenPool"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistrySetPool) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistrySetPool) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistrySetPool to hex string (Canton MCMS format) +func (t TokenAdminRegistrySetPool) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistrySetPool from hex string (Canton MCMS format) +func (t *TokenAdminRegistrySetPool) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistrySetTransferFactory is a Record type +type TokenAdminRegistrySetTransferFactory struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + TransferFactory *types.CONTRACT_ID `json:"transferFactory" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistrySetTransferFactory to a map for DAML arguments +func (t TokenAdminRegistrySetTransferFactory) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + if t.TransferFactory != nil { + m["transferFactory"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TransferFactory), + } + } else { + m["transferFactory"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistrySetTransferFactory) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistrySetTransferFactory) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistrySetTransferFactory to hex string (Canton MCMS format) +func (t TokenAdminRegistrySetTransferFactory) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistrySetTransferFactory from hex string (Canton MCMS format) +func (t *TokenAdminRegistrySetTransferFactory) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenAdminRegistryTransferAdminRole is a Record type +type TokenAdminRegistryTransferAdminRole struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + NewAdmin types.PARTY `json:"newAdmin"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenAdminRegistryTransferAdminRole to a map for DAML arguments +func (t TokenAdminRegistryTransferAdminRole) ToMap() map[string]any { + m := make(map[string]any) + + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + m["newAdmin"] = t.NewAdmin.ToMap() + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenAdminRegistryTransferAdminRole) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenAdminRegistryTransferAdminRole) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenAdminRegistryTransferAdminRole to hex string (Canton MCMS format) +func (t TokenAdminRegistryTransferAdminRole) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenAdminRegistryTransferAdminRole from hex string (Canton MCMS format) +func (t *TokenAdminRegistryTransferAdminRole) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenConfigView is a Record type +type TokenConfigView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + InstanceId types.TEXT `json:"instanceId"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + TokenPool *PoolRegistration `json:"tokenPool" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts TokenConfigView to a map for DAML arguments +func (t TokenConfigView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["instanceId"] = string(t.InstanceId) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + if t.TokenPool != nil { + m["tokenPool"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenPool), + } + } else { + m["tokenPool"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t TokenConfigView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenConfigView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenConfigView to hex string (Canton MCMS format) +func (t TokenConfigView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenConfigView from hex string (Canton MCMS format) +func (t *TokenConfigView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenConfigAssertConfiguredBurnMintFactory is a Record type +type TokenConfigAssertConfiguredBurnMintFactory struct { + SuppliedFactory types.CONTRACT_ID `json:"suppliedFactory"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenConfigAssertConfiguredBurnMintFactory to a map for DAML arguments +func (t TokenConfigAssertConfiguredBurnMintFactory) ToMap() map[string]any { + m := make(map[string]any) + + m["suppliedFactory"] = model.NestedToDAMLValue(t.SuppliedFactory) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenConfigAssertConfiguredBurnMintFactory) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenConfigAssertConfiguredBurnMintFactory) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenConfigAssertConfiguredBurnMintFactory to hex string (Canton MCMS format) +func (t TokenConfigAssertConfiguredBurnMintFactory) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenConfigAssertConfiguredBurnMintFactory from hex string (Canton MCMS format) +func (t *TokenConfigAssertConfiguredBurnMintFactory) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenConfigAssertConfiguredTransferFactory is a Record type +type TokenConfigAssertConfiguredTransferFactory struct { + SuppliedFactory types.CONTRACT_ID `json:"suppliedFactory"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenConfigAssertConfiguredTransferFactory to a map for DAML arguments +func (t TokenConfigAssertConfiguredTransferFactory) ToMap() map[string]any { + m := make(map[string]any) + + m["suppliedFactory"] = model.NestedToDAMLValue(t.SuppliedFactory) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenConfigAssertConfiguredTransferFactory) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenConfigAssertConfiguredTransferFactory) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenConfigAssertConfiguredTransferFactory to hex string (Canton MCMS format) +func (t TokenConfigAssertConfiguredTransferFactory) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenConfigAssertConfiguredTransferFactory from hex string (Canton MCMS format) +func (t *TokenConfigAssertConfiguredTransferFactory) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenConfigPublicFetch is a Record type +type TokenConfigPublicFetch struct { + ExpectedAddress chainlinkapi.RawInstanceAddress `json:"expectedAddress"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts TokenConfigPublicFetch to a map for DAML arguments +func (t TokenConfigPublicFetch) ToMap() map[string]any { + m := make(map[string]any) + + m["expectedAddress"] = model.NestedToDAMLValue(t.ExpectedAddress) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t TokenConfigPublicFetch) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenConfigPublicFetch) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenConfigPublicFetch to hex string (Canton MCMS format) +func (t TokenConfigPublicFetch) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenConfigPublicFetch from hex string (Canton MCMS format) +func (t *TokenConfigPublicFetch) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenReceiveTicketView is a Record type +type TokenReceiveTicketView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + PoolOwner types.PARTY `json:"poolOwner"` + CcvOwners []types.PARTY `json:"ccvOwners"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts TokenReceiveTicketView to a map for DAML arguments +func (t TokenReceiveTicketView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["poolOwner"] = t.PoolOwner.ToMap() + + m["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t TokenReceiveTicketView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenReceiveTicketView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenReceiveTicketView to hex string (Canton MCMS format) +func (t TokenReceiveTicketView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenReceiveTicketView from hex string (Canton MCMS format) +func (t *TokenReceiveTicketView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// IIExecutingMessageInterfaceID returns the interface ID for the IIExecutingMessage interface using the package name +func IIExecutingMessageInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.ExecutingMessage", "IExecutingMessage") +} + +// IIExecutingMessageInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IIExecutingMessageInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.APIV1.ExecutingMessage", "IExecutingMessage") +} + +// IIFeeQuoterInterfaceID returns the interface ID for the IIFeeQuoter interface using the package name +func IIFeeQuoterInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.FeeQuoter", "IFeeQuoter") +} + +// IIFeeQuoterInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IIFeeQuoterInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.APIV1.FeeQuoter", "IFeeQuoter") +} + +// IIGlobalConfigInterfaceID returns the interface ID for the IIGlobalConfig interface using the package name +func IIGlobalConfigInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.GlobalConfig", "IGlobalConfig") +} + +// IIGlobalConfigInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IIGlobalConfigInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.APIV1.GlobalConfig", "IGlobalConfig") +} + +// IIRMNRemoteInterfaceID returns the interface ID for the IIRMNRemote interface using the package name +func IIRMNRemoteInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.RMNRemote", "IRMNRemote") +} + +// IIRMNRemoteInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IIRMNRemoteInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.APIV1.RMNRemote", "IRMNRemote") +} + +// IISendingMessageInterfaceID returns the interface ID for the IISendingMessage interface using the package name +func IISendingMessageInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.SendingMessage", "ISendingMessage") +} + +// IISendingMessageInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IISendingMessageInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.APIV1.SendingMessage", "ISendingMessage") +} + +// IITokenAdminRegistryInterfaceID returns the interface ID for the IITokenAdminRegistry interface using the package name +func IITokenAdminRegistryInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.TokenAdminRegistry", "ITokenAdminRegistry") +} + +// IITokenAdminRegistryInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IITokenAdminRegistryInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.APIV1.TokenAdminRegistry", "ITokenAdminRegistry") +} + +// IITokenConfigInterfaceID returns the interface ID for the IITokenConfig interface using the package name +func IITokenConfigInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.TokenAdminRegistry", "ITokenConfig") +} + +// IITokenConfigInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IITokenConfigInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.APIV1.TokenAdminRegistry", "ITokenConfig") +} + +// IITokenReceiveTicketInterfaceID returns the interface ID for the IITokenReceiveTicket interface using the package name +func IITokenReceiveTicketInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.APIV1.ExecutingMessage", "ITokenReceiveTicket") +} + +// IITokenReceiveTicketInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IITokenReceiveTicketInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.APIV1.ExecutingMessage", "ITokenReceiveTicket") +} + +// MCMSEncoder interface for typed encoding methods. +// Implemented by Encoder for method-based encoding. +type MCMSEncoder interface { +} + +// encoder provides typed encoding methods for choice parameters (unexported). +// It wraps bind.BoundTemplate to encode parameters to hex-encoded operation data. +type encoder struct { + *bind.BoundTemplate +} + +// Contract wraps template operations with Sui-style API access. +// Use NewContract to create instances, then call Encoder() for encoding methods. +type Contract struct { + enc *encoder +} + +// NewContract creates a Contract with encoder for the given template. +// This provides Sui-style API: contract.Encoder().Method(args) +func NewContract(packageID, moduleName, templateName string) *Contract { + return &Contract{ + enc: &encoder{ + BoundTemplate: bind.NewBoundTemplate(packageID, moduleName, templateName), + }, + } +} + +// Encoder returns the encoder for Sui-style contract.Encoder().Method() usage. +func (c *Contract) Encoder() MCMSEncoder { + return c.enc +} + +// Verify MCMSEncoder interface implementation +var _ MCMSEncoder = (*encoder)(nil) diff --git a/bindings/generated/latest/ccip/ccipcodec/ccipcodec.go b/bindings/generated/latest/ccip/ccipcodec/ccipcodec.go new file mode 100644 index 000000000..81324014b --- /dev/null +++ b/bindings/generated/latest/ccip/ccipcodec/ccipcodec.go @@ -0,0 +1,391 @@ +package ccipcodec + +import ( + "errors" + "fmt" + "math/big" + "strings" + + "github.com/smartcontractkit/go-daml/pkg/bind" + "github.com/smartcontractkit/go-daml/pkg/codec" + "github.com/smartcontractkit/go-daml/pkg/model" + "github.com/smartcontractkit/go-daml/pkg/types" +) + +var ( + _ = fmt.Sprintf + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = model.Command{} + _ bind.BoundTemplate +) + +const ( + PackageName = "ccip-codec" + PackageID = "77de627f9b3ef15a9d21ea36aff1a4cb88f82a43ae289003fd7c46bff2a54e9a" + SDKVersion = "3.4.11" +) + +type Template interface { + CreateCommand() *model.CreateCommand + GetTemplateID() string +} + +const ( + MaxCCVsPerMessage = types.INT64(255) + WaitForFinalityFlag = types.TEXT("00000000") + MinBlockDepth = types.INT64(1) + MaxBlockDepth = types.INT64(65535) + FinalityConfigByteLength = types.INT64(4) + MaxNumeric0IntegerText = types.TEXT("99999999999999999999999999999999999999") + MaxUint256DecimalText = types.TEXT("115792089237316195423570985008687907853269984665640564039457584007913129639935") + MaxNumeric0DecimalText = types.TEXT("99999999999999999999999999999999999999") + UsdPerUsdCent = types.NUMERIC("100000000.") + PremiumIdentity = types.NUMERIC("10000000000.") + MinTokenDecimals = types.INT64(0) + MaxTokenDecimals = types.INT64(37) + E10PerPercent = types.NUMERIC("100000000.") + BaseNumeric = types.NUMERIC("100000000.") + BaseInt = types.INT64(100000000) +) + +func argsToMap(args any) map[string]any { + if args == nil { + return map[string]any{} + } + + if m, ok := args.(map[string]any); ok { + return m + } + + type mapper interface { + ToMap() map[string]any + } + if mapper, ok := args.(mapper); ok { + return mapper.ToMap() + } + + return map[string]any{"args": args} +} + +// DecodedFinality is a Record type +type DecodedFinality struct { + Raw types.TEXT `json:"raw"` + Requested FinalityConfig `json:"requested"` +} + +// ToMap converts DecodedFinality to a map for DAML arguments +func (t DecodedFinality) ToMap() map[string]any { + m := make(map[string]any) + + m["raw"] = string(t.Raw) + + m["requested"] = model.NestedToDAMLValue(t.Requested) + + return m +} + +func (t DecodedFinality) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *DecodedFinality) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes DecodedFinality to hex string (Canton MCMS format) +func (t DecodedFinality) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes DecodedFinality from hex string (Canton MCMS format) +func (t *DecodedFinality) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// FinalityConfig is a variant/union type +type FinalityConfig struct { + WaitForFinality *types.UNIT `json:"WaitForFinality,omitempty"` + WaitForSafe *types.UNIT `json:"WaitForSafe,omitempty"` + BlockDepth *types.INT64 `json:"BlockDepth,omitempty"` +} + +// MarshalJSON implements custom JSON marshaling for FinalityConfig +func (v FinalityConfig) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(v) +} + +// UnmarshalJSON implements custom JSON unmarshalling for FinalityConfig +func (v *FinalityConfig) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, v) +} + +// MarshalHex encodes FinalityConfig to hex string (Canton MCMS format) +func (v FinalityConfig) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(v) +} + +// UnmarshalHex decodes FinalityConfig from hex string (Canton MCMS format) +func (v *FinalityConfig) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, v) +} + +// GetVariantTag implements types.VARIANT interface +func (v FinalityConfig) GetVariantTag() string { + + if v.WaitForFinality != nil { + return "WaitForFinality" + } + + if v.WaitForSafe != nil { + return "WaitForSafe" + } + + if v.BlockDepth != nil { + return "BlockDepth" + } + + return "" +} + +// GetVariantValue implements types.VARIANT interface +func (v FinalityConfig) GetVariantValue() any { + + if v.WaitForFinality != nil { + return v.WaitForFinality + } + + if v.WaitForSafe != nil { + return v.WaitForSafe + } + + if v.BlockDepth != nil { + return v.BlockDepth + } + + return nil +} + +var _ types.VARIANT = (*FinalityConfig)(nil) + +// LocalAmountConversionResult is a Record type +type LocalAmountConversionResult struct { + LocalAmount types.NUMERIC `json:"localAmount"` + TruncatedRemainder types.TEXT `json:"truncatedRemainder"` + WasTruncated types.BOOL `json:"wasTruncated"` +} + +// ToMap converts LocalAmountConversionResult to a map for DAML arguments +func (t LocalAmountConversionResult) ToMap() map[string]any { + m := make(map[string]any) + + m["localAmount"] = t.LocalAmount + + m["truncatedRemainder"] = string(t.TruncatedRemainder) + + m["wasTruncated"] = bool(t.WasTruncated) + + return m +} + +func (t LocalAmountConversionResult) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *LocalAmountConversionResult) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes LocalAmountConversionResult to hex string (Canton MCMS format) +func (t LocalAmountConversionResult) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes LocalAmountConversionResult from hex string (Canton MCMS format) +func (t *LocalAmountConversionResult) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// MessageV1 is a Record type +type MessageV1 struct { + SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + SequenceNumber types.NUMERIC `json:"sequenceNumber"` + ExecutionGasLimit types.INT64 `json:"executionGasLimit"` + CcipReceiveGasLimit types.INT64 `json:"ccipReceiveGasLimit"` + Finality DecodedFinality `json:"finality"` + CcvAndExecutorHash types.TEXT `json:"ccvAndExecutorHash"` + OnRampAddress types.TEXT `json:"onRampAddress"` + OffRampAddress types.TEXT `json:"offRampAddress" hex:"bytes"` + Sender types.TEXT `json:"sender"` + Receiver types.TEXT `json:"receiver"` + DestBlob types.TEXT `json:"destBlob"` + TokenTransfer *TokenTransferV1 `json:"tokenTransfer" hex:"optional"` + MessageData types.TEXT `json:"messageData"` +} + +// ToMap converts MessageV1 to a map for DAML arguments +func (t MessageV1) ToMap() map[string]any { + m := make(map[string]any) + + m["sourceChainSelector"] = t.SourceChainSelector + + m["destChainSelector"] = t.DestChainSelector + + m["sequenceNumber"] = t.SequenceNumber + + m["executionGasLimit"] = int64(t.ExecutionGasLimit) + + m["ccipReceiveGasLimit"] = int64(t.CcipReceiveGasLimit) + + m["finality"] = model.NestedToDAMLValue(t.Finality) + + m["ccvAndExecutorHash"] = string(t.CcvAndExecutorHash) + + m["onRampAddress"] = string(t.OnRampAddress) + + m["offRampAddress"] = string(t.OffRampAddress) + + m["sender"] = string(t.Sender) + + m["receiver"] = string(t.Receiver) + + m["destBlob"] = string(t.DestBlob) + + if t.TokenTransfer != nil { + m["tokenTransfer"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenTransfer), + } + } else { + m["tokenTransfer"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["messageData"] = string(t.MessageData) + + return m +} + +func (t MessageV1) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *MessageV1) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes MessageV1 to hex string (Canton MCMS format) +func (t MessageV1) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes MessageV1 from hex string (Canton MCMS format) +func (t *MessageV1) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenTransferV1 is a Record type +type TokenTransferV1 struct { + Amount types.TEXT `json:"amount"` + SourcePoolAddress types.TEXT `json:"sourcePoolAddress"` + SourceTokenAddress types.TEXT `json:"sourceTokenAddress"` + DestTokenAddress types.TEXT `json:"destTokenAddress"` + TokenReceiver types.TEXT `json:"tokenReceiver"` + ExtraData types.TEXT `json:"extraData"` +} + +// ToMap converts TokenTransferV1 to a map for DAML arguments +func (t TokenTransferV1) ToMap() map[string]any { + m := make(map[string]any) + + m["amount"] = string(t.Amount) + + m["sourcePoolAddress"] = string(t.SourcePoolAddress) + + m["sourceTokenAddress"] = string(t.SourceTokenAddress) + + m["destTokenAddress"] = string(t.DestTokenAddress) + + m["tokenReceiver"] = string(t.TokenReceiver) + + m["extraData"] = string(t.ExtraData) + + return m +} + +func (t TokenTransferV1) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenTransferV1) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenTransferV1 to hex string (Canton MCMS format) +func (t TokenTransferV1) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenTransferV1 from hex string (Canton MCMS format) +func (t *TokenTransferV1) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// MCMSEncoder interface for typed encoding methods. +// Implemented by Encoder for method-based encoding. +type MCMSEncoder interface { +} + +// encoder provides typed encoding methods for choice parameters (unexported). +// It wraps bind.BoundTemplate to encode parameters to hex-encoded operation data. +type encoder struct { + *bind.BoundTemplate +} + +// Contract wraps template operations with Sui-style API access. +// Use NewContract to create instances, then call Encoder() for encoding methods. +type Contract struct { + enc *encoder +} + +// NewContract creates a Contract with encoder for the given template. +// This provides Sui-style API: contract.Encoder().Method(args) +func NewContract(packageID, moduleName, templateName string) *Contract { + return &Contract{ + enc: &encoder{ + BoundTemplate: bind.NewBoundTemplate(packageID, moduleName, templateName), + }, + } +} + +// Encoder returns the encoder for Sui-style contract.Encoder().Method() usage. +func (c *Contract) Encoder() MCMSEncoder { + return c.enc +} + +// Verify MCMSEncoder interface implementation +var _ MCMSEncoder = (*encoder)(nil) diff --git a/bindings/generated/latest/ccip/ccipruntime/ccipruntime.go b/bindings/generated/latest/ccip/ccipruntime/ccipruntime.go index 09568f17e..e119a1c4c 100644 --- a/bindings/generated/latest/ccip/ccipruntime/ccipruntime.go +++ b/bindings/generated/latest/ccip/ccipruntime/ccipruntime.go @@ -6,7 +6,10 @@ import ( "math/big" "strings" - core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + ccipapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipapi" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" + clientapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/clientapi" + events "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" extensionapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/extensionapi" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" api "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/mcms/api" @@ -29,7 +32,7 @@ var ( const ( PackageName = "ccip-runtime" - PackageID = "e72c7b81e9cc09ed2d35ba3333f561851d5f8a5f81527d05249060ad1edd1eb5" + PackageID = "bbeb73396314ccc78b391a39efa3fa4e6bf7862a48f1d590db8c1a2b484160e8" SDKVersion = "3.4.11" ) @@ -39,8 +42,8 @@ type Template interface { } const ( - OffRampKey = types.TEXT("off-ramp") - OnRampKey = types.TEXT("on-ramp") + OffRampContextKey = types.TEXT("off-ramp") + OnRampContextKey = types.TEXT("on-ramp") NoExecutionAddressBytes = types.TEXT("eba517d200000000000000000000000000000000000000000000000000000000") MessageStaticSize = types.INT64(69) MaxExecutedMessagesSize = types.INT64(25000) @@ -160,12 +163,12 @@ type ArchivedExecutedMessages struct { // GetTemplateID returns the template ID for this template using the package name func (t ArchivedExecutedMessages) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "ArchivedExecutedMessages") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "ArchivedExecutedMessages") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t ArchivedExecutedMessages) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.PerPartyRouter", "ArchivedExecutedMessages") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "ArchivedExecutedMessages") } // CreateCommand returns a CreateCommand for this template using the package name @@ -246,7 +249,7 @@ func (t *ArchivedExecutedMessages) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t ArchivedExecutedMessages) IsExecuted(contractID string, args IsExecuted) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "ArchivedExecutedMessages"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "ArchivedExecutedMessages"), ContractID: contractID, Choice: "IsExecuted", Arguments: argsToMap(args), @@ -256,7 +259,7 @@ func (t ArchivedExecutedMessages) IsExecuted(contractID string, args IsExecuted) // IsExecutedWithPackageID exercises the IsExecuted choice using the provided package ID instead of package name func (t ArchivedExecutedMessages) IsExecutedWithPackageID(contractID string, packageID string, args IsExecuted) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "ArchivedExecutedMessages"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "ArchivedExecutedMessages"), ContractID: contractID, Choice: "IsExecuted", Arguments: argsToMap(args), @@ -267,7 +270,7 @@ func (t ArchivedExecutedMessages) IsExecutedWithPackageID(contractID string, pac // This method uses the package name in the template ID func (t ArchivedExecutedMessages) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "ArchivedExecutedMessages"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "ArchivedExecutedMessages"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -277,7 +280,7 @@ func (t ArchivedExecutedMessages) Archive(contractID string) *model.ExerciseComm // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t ArchivedExecutedMessages) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "ArchivedExecutedMessages"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "ArchivedExecutedMessages"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -286,20 +289,18 @@ func (t ArchivedExecutedMessages) ArchiveWithPackageID(contractID string, packag // CCIPSend is a Record type type CCIPSend struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` FeeTokenHoldingCids []types.CONTRACT_ID `json:"feeTokenHoldingCids"` FeeTokenConfigCid types.CONTRACT_ID `json:"feeTokenConfigCid"` FeeTokenTransferFactory types.CONTRACT_ID `json:"feeTokenTransferFactory"` FeeTokenExtraArgs splice_api_token_metadata_v1.ExtraArgs `json:"feeTokenExtraArgs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts CCIPSend to a map for DAML arguments func (t CCIPSend) ToMap() map[string]any { m := make(map[string]any) - m["context"] = model.NestedToDAMLValue(t.Context) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["feeTokenHoldingCids"] = func() []any { @@ -316,6 +317,8 @@ func (t CCIPSend) ToMap() map[string]any { m["feeTokenExtraArgs"] = model.NestedToDAMLValue(t.FeeTokenExtraArgs) + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -413,7 +416,7 @@ type CCIPSendFromRouterResult struct { CcipMessageSent types.CONTRACT_ID `json:"ccipMessageSent"` VerifierBlobs []types.TEXT `json:"verifierBlobs"` MessageSentObservers []types.PARTY `json:"messageSentObservers"` - Receipts []core.Receipt `json:"receipts"` + Receipts []events.Receipt `json:"receipts"` } // ToMap converts CCIPSendFromRouterResult to a map for DAML arguments @@ -471,8 +474,8 @@ func (t *CCIPSendFromRouterResult) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// CCIPSendResult is a Record type -type CCIPSendResult struct { +// CCIPSendResult2 is a Record type +type CCIPSendResult2 struct { Router types.CONTRACT_ID `json:"router"` CcipMessageSent types.CONTRACT_ID `json:"ccipMessageSent"` MessageId types.TEXT `json:"messageId"` @@ -480,8 +483,8 @@ type CCIPSendResult struct { PendingFeeInstructions []types.CONTRACT_ID `json:"pendingFeeInstructions"` } -// ToMap converts CCIPSendResult to a map for DAML arguments -func (t CCIPSendResult) ToMap() map[string]any { +// ToMap converts CCIPSendResult2 to a map for DAML arguments +func (t CCIPSendResult2) ToMap() map[string]any { m := make(map[string]any) m["router"] = model.NestedToDAMLValue(t.Router) @@ -509,24 +512,24 @@ func (t CCIPSendResult) ToMap() map[string]any { return m } -func (t CCIPSendResult) MarshalJSON() ([]byte, error) { +func (t CCIPSendResult2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *CCIPSendResult) UnmarshalJSON(data []byte) error { +func (t *CCIPSendResult2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes CCIPSendResult to hex string (Canton MCMS format) -func (t CCIPSendResult) MarshalHex() (string, error) { +// MarshalHex encodes CCIPSendResult2 to hex string (Canton MCMS format) +func (t CCIPSendResult2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes CCIPSendResult from hex string (Canton MCMS format) -func (t *CCIPSendResult) UnmarshalHex(data string) error { +// UnmarshalHex decodes CCIPSendResult2 from hex string (Canton MCMS format) +func (t *CCIPSendResult2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -611,18 +614,18 @@ func (t *CreateRouterResult) UnmarshalHex(data string) error { // Execute is a Record type type Execute struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts Execute to a map for DAML arguments func (t Execute) ToMap() map[string]any { m := make(map[string]any) - m["context"] = model.NestedToDAMLValue(t.Context) - m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -711,12 +714,12 @@ func (t *ExecuteFromRouter) UnmarshalHex(data string) error { // ExecuteFromRouterResult is a Record type type ExecuteFromRouterResult struct { - MessageId types.TEXT `json:"messageId"` - Message core.MessageV1 `json:"message"` - SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` - SequenceNumber types.NUMERIC `json:"sequenceNumber"` - TokenReceiveTicket *types.CONTRACT_ID `json:"tokenReceiveTicket" hex:"optional"` - ExecutionStateChanged types.CONTRACT_ID `json:"executionStateChanged"` + MessageId types.TEXT `json:"messageId"` + Message ccipcodec.MessageV1 `json:"message"` + SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` + SequenceNumber types.NUMERIC `json:"sequenceNumber"` + TokenReceiveTicket *types.CONTRACT_ID `json:"tokenReceiveTicket" hex:"optional"` + ExecutionStateChanged types.CONTRACT_ID `json:"executionStateChanged"` } // ToMap converts ExecuteFromRouterResult to a map for DAML arguments @@ -770,18 +773,18 @@ func (t *ExecuteFromRouterResult) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// ExecuteResult is a Record type -type ExecuteResult struct { - Router types.CONTRACT_ID `json:"router"` - TokenReceiveTicket *types.CONTRACT_ID `json:"tokenReceiveTicket" hex:"optional"` - ExecutionStateChanged types.CONTRACT_ID `json:"executionStateChanged"` - MessageId types.TEXT `json:"messageId"` - Message core.MessageV1 `json:"message"` - State core.MessageExecutionState `json:"state"` +// ExecuteResult2 is a Record type +type ExecuteResult2 struct { + Router types.CONTRACT_ID `json:"router"` + TokenReceiveTicket *types.CONTRACT_ID `json:"tokenReceiveTicket" hex:"optional"` + ExecutionStateChanged types.CONTRACT_ID `json:"executionStateChanged"` + MessageId types.TEXT `json:"messageId"` + Message ccipcodec.MessageV1 `json:"message"` + State ccipapi.MessageExecutionState `json:"state"` } -// ToMap converts ExecuteResult to a map for DAML arguments -func (t ExecuteResult) ToMap() map[string]any { +// ToMap converts ExecuteResult2 to a map for DAML arguments +func (t ExecuteResult2) ToMap() map[string]any { m := make(map[string]any) m["router"] = model.NestedToDAMLValue(t.Router) @@ -809,24 +812,24 @@ func (t ExecuteResult) ToMap() map[string]any { return m } -func (t ExecuteResult) MarshalJSON() ([]byte, error) { +func (t ExecuteResult2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *ExecuteResult) UnmarshalJSON(data []byte) error { +func (t *ExecuteResult2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes ExecuteResult to hex string (Canton MCMS format) -func (t ExecuteResult) MarshalHex() (string, error) { +// MarshalHex encodes ExecuteResult2 to hex string (Canton MCMS format) +func (t ExecuteResult2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes ExecuteResult from hex string (Canton MCMS format) -func (t *ExecuteResult) UnmarshalHex(data string) error { +// UnmarshalHex decodes ExecuteResult2 from hex string (Canton MCMS format) +func (t *ExecuteResult2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -998,18 +1001,18 @@ func (t *FeeCalculationResult) UnmarshalHex(data string) error { // FinalizeFee2 is a Record type type FinalizeFee2 struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts FinalizeFee2 to a map for DAML arguments func (t FinalizeFee2) ToMap() map[string]any { m := make(map[string]any) - m["context"] = model.NestedToDAMLValue(t.Context) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -1085,8 +1088,9 @@ func (t *FinalizeFeeFromRouter) UnmarshalHex(data string) error { // GetExecutionState is a Record type type GetExecutionState struct { - MessageHash types.TEXT `json:"messageHash"` - Caller types.PARTY `json:"caller"` + MessageHash types.TEXT `json:"messageHash"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetExecutionState to a map for DAML arguments @@ -1095,6 +1099,8 @@ func (t GetExecutionState) ToMap() map[string]any { m["messageHash"] = string(t.MessageHash) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1125,7 +1131,8 @@ func (t *GetExecutionState) UnmarshalHex(data string) error { // GetExecutionStateMCMSParams is GetExecutionState without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetExecutionStateMCMSParams struct { - MessageHash types.TEXT `json:"messageHash"` + MessageHash types.TEXT `json:"messageHash"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetExecutionStateMCMSParams to hex string for MCMS operationData. @@ -1144,7 +1151,7 @@ func (t *GetExecutionStateMCMSParams) UnmarshalHex(data string) error { type GetFee struct { Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` DestChainSelector types.NUMERIC `json:"destChainSelector"` - Message core.Canton2AnyMessage `json:"message"` + Message clientapi.Canton2AnyMessage `json:"message"` CcvFeeQuotes []extensionapi.CrossChainVerifierFeeQuote `json:"ccvFeeQuotes"` TokenPoolFeeQuote *extensionapi.TokenPoolFeeQuote `json:"tokenPoolFeeQuote" hex:"optional"` ExecutorFeeQuote *extensionapi.ExecutorFeeQuote `json:"executorFeeQuote" hex:"optional"` @@ -1224,7 +1231,7 @@ type GetFeeFromRouter struct { GlobalConfigCid types.CONTRACT_ID `json:"globalConfigCid"` FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` DestChainSelector types.NUMERIC `json:"destChainSelector"` - Message core.Canton2AnyMessage `json:"message"` + Message clientapi.Canton2AnyMessage `json:"message"` CcvFeeQuotes []extensionapi.CrossChainVerifierFeeQuote `json:"ccvFeeQuotes"` TokenPoolFeeQuote *extensionapi.TokenPoolFeeQuote `json:"tokenPoolFeeQuote" hex:"optional"` ExecutorFeeQuote *extensionapi.ExecutorFeeQuote `json:"executorFeeQuote" hex:"optional"` @@ -1341,20 +1348,18 @@ func (t *GetFeeFromRouterResult) UnmarshalHex(data string) error { // GetRequiredCCVsForExecute is a Record type type GetRequiredCCVsForExecute struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` - Message core.MessageV1 `json:"message"` + Message ccipcodec.MessageV1 `json:"message"` ReceiverRequiredCCVs []chainlinkapi.RawInstanceAddress `json:"receiverRequiredCCVs"` ReceiverOptionalCCVs []chainlinkapi.RawInstanceAddress `json:"receiverOptionalCCVs"` ReceiverOptionalThreshold types.INT64 `json:"receiverOptionalThreshold"` TokenPoolRequiredCCVs []chainlinkapi.RawInstanceAddress `json:"tokenPoolRequiredCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts GetRequiredCCVsForExecute to a map for DAML arguments func (t GetRequiredCCVsForExecute) ToMap() map[string]any { m := make(map[string]any) - m["context"] = model.NestedToDAMLValue(t.Context) - m["message"] = model.NestedToDAMLValue(t.Message) m["receiverRequiredCCVs"] = func() []any { @@ -1383,6 +1388,8 @@ func (t GetRequiredCCVsForExecute) ToMap() map[string]any { return res }() + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -1411,7 +1418,7 @@ func (t *GetRequiredCCVsForExecute) UnmarshalHex(data string) error { // GetRequiredCCVsForExecuteFromRouter is a Record type type GetRequiredCCVsForExecuteFromRouter struct { GlobalConfigCid types.CONTRACT_ID `json:"globalConfigCid"` - Message core.MessageV1 `json:"message"` + Message ccipcodec.MessageV1 `json:"message"` ReceiverRequiredCCVs []chainlinkapi.RawInstanceAddress `json:"receiverRequiredCCVs"` ReceiverOptionalCCVs []chainlinkapi.RawInstanceAddress `json:"receiverOptionalCCVs"` ReceiverOptionalThreshold types.INT64 `json:"receiverOptionalThreshold"` @@ -1479,18 +1486,16 @@ func (t *GetRequiredCCVsForExecuteFromRouter) UnmarshalHex(data string) error { // GetRequiredCCVsForSend is a Record type type GetRequiredCCVsForSend struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` DestChainSelector types.NUMERIC `json:"destChainSelector"` - Message core.Canton2AnyMessage `json:"message"` + Message clientapi.Canton2AnyMessage `json:"message"` PoolReportedCCVs []chainlinkapi.RawInstanceAddress `json:"poolReportedCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts GetRequiredCCVsForSend to a map for DAML arguments func (t GetRequiredCCVsForSend) ToMap() map[string]any { m := make(map[string]any) - m["context"] = model.NestedToDAMLValue(t.Context) - m["destChainSelector"] = t.DestChainSelector m["message"] = model.NestedToDAMLValue(t.Message) @@ -1503,6 +1508,8 @@ func (t GetRequiredCCVsForSend) ToMap() map[string]any { return res }() + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -1532,7 +1539,7 @@ func (t *GetRequiredCCVsForSend) UnmarshalHex(data string) error { type GetRequiredCCVsForSendFromRouter struct { GlobalConfigCid types.CONTRACT_ID `json:"globalConfigCid"` DestChainSelector types.NUMERIC `json:"destChainSelector"` - Message core.Canton2AnyMessage `json:"message"` + Message clientapi.Canton2AnyMessage `json:"message"` PoolReportedCCVs []chainlinkapi.RawInstanceAddress `json:"poolReportedCCVs"` } @@ -1581,7 +1588,8 @@ func (t *GetRequiredCCVsForSendFromRouter) UnmarshalHex(data string) error { // GetSequenceNumber is a Record type type GetSequenceNumber struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts GetSequenceNumber to a map for DAML arguments @@ -1590,6 +1598,8 @@ func (t GetSequenceNumber) ToMap() map[string]any { m["destChainSelector"] = t.DestChainSelector + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -1717,12 +1727,12 @@ type OffRamp struct { // GetTemplateID returns the template ID for this template using the package name func (t OffRamp) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OffRamp", "OffRamp") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OffRamp", "OffRamp") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t OffRamp) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.OffRamp", "OffRamp") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.RuntimeV1.OffRamp", "OffRamp") } // CreateCommand returns a CreateCommand for this template using the package name @@ -1791,7 +1801,7 @@ func (t *OffRamp) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t OffRamp) ExecuteFromRouter(contractID string, args ExecuteFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OffRamp", "OffRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OffRamp", "OffRamp"), ContractID: contractID, Choice: "ExecuteFromRouter", Arguments: argsToMap(args), @@ -1801,7 +1811,7 @@ func (t OffRamp) ExecuteFromRouter(contractID string, args ExecuteFromRouter) *m // ExecuteFromRouterWithPackageID exercises the ExecuteFromRouter choice using the provided package ID instead of package name func (t OffRamp) ExecuteFromRouterWithPackageID(contractID string, packageID string, args ExecuteFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OffRamp", "OffRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OffRamp", "OffRamp"), ContractID: contractID, Choice: "ExecuteFromRouter", Arguments: argsToMap(args), @@ -1812,7 +1822,7 @@ func (t OffRamp) ExecuteFromRouterWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t OffRamp) PrepareExecute(contractID string, args PrepareExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OffRamp", "OffRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OffRamp", "OffRamp"), ContractID: contractID, Choice: "PrepareExecute", Arguments: argsToMap(args), @@ -1822,7 +1832,7 @@ func (t OffRamp) PrepareExecute(contractID string, args PrepareExecute) *model.E // PrepareExecuteWithPackageID exercises the PrepareExecute choice using the provided package ID instead of package name func (t OffRamp) PrepareExecuteWithPackageID(contractID string, packageID string, args PrepareExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OffRamp", "OffRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OffRamp", "OffRamp"), ContractID: contractID, Choice: "PrepareExecute", Arguments: argsToMap(args), @@ -1833,7 +1843,7 @@ func (t OffRamp) PrepareExecuteWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t OffRamp) GetRequiredCCVsForExecuteFromRouter(contractID string, args GetRequiredCCVsForExecuteFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OffRamp", "OffRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OffRamp", "OffRamp"), ContractID: contractID, Choice: "GetRequiredCCVsForExecuteFromRouter", Arguments: argsToMap(args), @@ -1843,7 +1853,7 @@ func (t OffRamp) GetRequiredCCVsForExecuteFromRouter(contractID string, args Get // GetRequiredCCVsForExecuteFromRouterWithPackageID exercises the GetRequiredCCVsForExecuteFromRouter choice using the provided package ID instead of package name func (t OffRamp) GetRequiredCCVsForExecuteFromRouterWithPackageID(contractID string, packageID string, args GetRequiredCCVsForExecuteFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OffRamp", "OffRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OffRamp", "OffRamp"), ContractID: contractID, Choice: "GetRequiredCCVsForExecuteFromRouter", Arguments: argsToMap(args), @@ -1854,7 +1864,7 @@ func (t OffRamp) GetRequiredCCVsForExecuteFromRouterWithPackageID(contractID str // This method uses the package name in the template ID func (t OffRamp) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OffRamp", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OffRamp", "MCMSReceiver"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -1864,7 +1874,7 @@ func (t OffRamp) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t OffRamp) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OffRamp", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OffRamp", "MCMSReceiver"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -1875,7 +1885,7 @@ func (t OffRamp) ArchiveWithPackageID(contractID string, packageID string) *mode // This method uses the package name in the template ID func (t OffRamp) SetDeps(contractID string, args SetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OffRamp", "OffRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OffRamp", "OffRamp"), ContractID: contractID, Choice: "SetDeps", Arguments: argsToMap(args), @@ -1885,7 +1895,7 @@ func (t OffRamp) SetDeps(contractID string, args SetDeps) *model.ExerciseCommand // SetDepsWithPackageID exercises the SetDeps choice using the provided package ID instead of package name func (t OffRamp) SetDepsWithPackageID(contractID string, packageID string, args SetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OffRamp", "OffRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OffRamp", "OffRamp"), ContractID: contractID, Choice: "SetDeps", Arguments: argsToMap(args), @@ -1896,7 +1906,7 @@ func (t OffRamp) SetDepsWithPackageID(contractID string, packageID string, args // This method uses the package name in the template ID func (t OffRamp) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OffRamp", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OffRamp", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -1906,7 +1916,7 @@ func (t OffRamp) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiver // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t OffRamp) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OffRamp", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OffRamp", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -1969,12 +1979,12 @@ type OnRamp struct { // GetTemplateID returns the template ID for this template using the package name func (t OnRamp) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "OnRamp") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "OnRamp") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t OnRamp) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.OnRamp", "OnRamp") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "OnRamp") } // CreateCommand returns a CreateCommand for this template using the package name @@ -2051,7 +2061,7 @@ func (t *OnRamp) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t OnRamp) CCIPSendFromRouter(contractID string, args CCIPSendFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "CCIPSendFromRouter", Arguments: argsToMap(args), @@ -2061,7 +2071,7 @@ func (t OnRamp) CCIPSendFromRouter(contractID string, args CCIPSendFromRouter) * // CCIPSendFromRouterWithPackageID exercises the CCIPSendFromRouter choice using the provided package ID instead of package name func (t OnRamp) CCIPSendFromRouterWithPackageID(contractID string, packageID string, args CCIPSendFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "CCIPSendFromRouter", Arguments: argsToMap(args), @@ -2072,7 +2082,7 @@ func (t OnRamp) CCIPSendFromRouterWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t OnRamp) GetFeeFromRouter(contractID string, args GetFeeFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "GetFeeFromRouter", Arguments: argsToMap(args), @@ -2082,7 +2092,7 @@ func (t OnRamp) GetFeeFromRouter(contractID string, args GetFeeFromRouter) *mode // GetFeeFromRouterWithPackageID exercises the GetFeeFromRouter choice using the provided package ID instead of package name func (t OnRamp) GetFeeFromRouterWithPackageID(contractID string, packageID string, args GetFeeFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "GetFeeFromRouter", Arguments: argsToMap(args), @@ -2093,7 +2103,7 @@ func (t OnRamp) GetFeeFromRouterWithPackageID(contractID string, packageID strin // This method uses the package name in the template ID func (t OnRamp) PrepareSendFromRouter(contractID string, args PrepareSendFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "PrepareSendFromRouter", Arguments: argsToMap(args), @@ -2103,7 +2113,7 @@ func (t OnRamp) PrepareSendFromRouter(contractID string, args PrepareSendFromRou // PrepareSendFromRouterWithPackageID exercises the PrepareSendFromRouter choice using the provided package ID instead of package name func (t OnRamp) PrepareSendFromRouterWithPackageID(contractID string, packageID string, args PrepareSendFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "PrepareSendFromRouter", Arguments: argsToMap(args), @@ -2114,7 +2124,7 @@ func (t OnRamp) PrepareSendFromRouterWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t OnRamp) GetRequiredCCVsForSendFromRouter(contractID string, args GetRequiredCCVsForSendFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "GetRequiredCCVsForSendFromRouter", Arguments: argsToMap(args), @@ -2124,7 +2134,7 @@ func (t OnRamp) GetRequiredCCVsForSendFromRouter(contractID string, args GetRequ // GetRequiredCCVsForSendFromRouterWithPackageID exercises the GetRequiredCCVsForSendFromRouter choice using the provided package ID instead of package name func (t OnRamp) GetRequiredCCVsForSendFromRouterWithPackageID(contractID string, packageID string, args GetRequiredCCVsForSendFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "GetRequiredCCVsForSendFromRouter", Arguments: argsToMap(args), @@ -2135,7 +2145,7 @@ func (t OnRamp) GetRequiredCCVsForSendFromRouterWithPackageID(contractID string, // This method uses the package name in the template ID func (t OnRamp) FinalizeFeeFromRouter(contractID string, args FinalizeFeeFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "FinalizeFeeFromRouter", Arguments: argsToMap(args), @@ -2145,7 +2155,7 @@ func (t OnRamp) FinalizeFeeFromRouter(contractID string, args FinalizeFeeFromRou // FinalizeFeeFromRouterWithPackageID exercises the FinalizeFeeFromRouter choice using the provided package ID instead of package name func (t OnRamp) FinalizeFeeFromRouterWithPackageID(contractID string, packageID string, args FinalizeFeeFromRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "FinalizeFeeFromRouter", Arguments: argsToMap(args), @@ -2156,7 +2166,7 @@ func (t OnRamp) FinalizeFeeFromRouterWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t OnRamp) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "MCMSReceiver"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2166,7 +2176,7 @@ func (t OnRamp) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t OnRamp) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OnRamp", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "MCMSReceiver"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2177,7 +2187,7 @@ func (t OnRamp) ArchiveWithPackageID(contractID string, packageID string) *model // This method uses the package name in the template ID func (t OnRamp) SetDeps(contractID string, args SetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "SetDeps", Arguments: argsToMap(args), @@ -2187,7 +2197,7 @@ func (t OnRamp) SetDeps(contractID string, args SetDeps) *model.ExerciseCommand // SetDepsWithPackageID exercises the SetDeps choice using the provided package ID instead of package name func (t OnRamp) SetDepsWithPackageID(contractID string, packageID string, args SetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OnRamp", "OnRamp"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "OnRamp"), ContractID: contractID, Choice: "SetDeps", Arguments: argsToMap(args), @@ -2198,7 +2208,7 @@ func (t OnRamp) SetDepsWithPackageID(contractID string, packageID string, args S // This method uses the package name in the template ID func (t OnRamp) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.OnRamp", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.OnRamp", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -2208,7 +2218,7 @@ func (t OnRamp) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverE // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t OnRamp) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.OnRamp", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.OnRamp", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -2225,7 +2235,6 @@ type OnRampDeps struct { RmnRemote chainlinkapi.RawInstanceAddress `json:"rmnRemote"` TokenAdminRegistry chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry"` FeeQuoter chainlinkapi.RawInstanceAddress `json:"feeQuoter"` - CcvRegistry chainlinkapi.RawInstanceAddress `json:"ccvRegistry"` } // ToMap converts OnRampDeps to a map for DAML arguments @@ -2240,8 +2249,6 @@ func (t OnRampDeps) ToMap() map[string]any { m["feeQuoter"] = model.NestedToDAMLValue(t.FeeQuoter) - m["ccvRegistry"] = model.NestedToDAMLValue(t.CcvRegistry) - return m } @@ -2281,12 +2288,12 @@ type PerPartyRouter struct { // GetTemplateID returns the template ID for this template using the package name func (t PerPartyRouter) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t PerPartyRouter) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter") } // CreateCommand returns a CreateCommand for this template using the package name @@ -2419,7 +2426,7 @@ func (t *PerPartyRouter) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t PerPartyRouter) CCIPSend(contractID string, args CCIPSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "CCIPSend", Arguments: argsToMap(args), @@ -2429,7 +2436,7 @@ func (t PerPartyRouter) CCIPSend(contractID string, args CCIPSend) *model.Exerci // CCIPSendWithPackageID exercises the CCIPSend choice using the provided package ID instead of package name func (t PerPartyRouter) CCIPSendWithPackageID(contractID string, packageID string, args CCIPSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "CCIPSend", Arguments: argsToMap(args), @@ -2440,7 +2447,7 @@ func (t PerPartyRouter) CCIPSendWithPackageID(contractID string, packageID strin // This method uses the package name in the template ID func (t PerPartyRouter) Execute(contractID string, args Execute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "Execute", Arguments: argsToMap(args), @@ -2450,7 +2457,7 @@ func (t PerPartyRouter) Execute(contractID string, args Execute) *model.Exercise // ExecuteWithPackageID exercises the Execute choice using the provided package ID instead of package name func (t PerPartyRouter) ExecuteWithPackageID(contractID string, packageID string, args Execute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "Execute", Arguments: argsToMap(args), @@ -2461,7 +2468,7 @@ func (t PerPartyRouter) ExecuteWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t PerPartyRouter) GetExecutionState(contractID string, args GetExecutionState) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetExecutionState", Arguments: argsToMap(args), @@ -2471,7 +2478,7 @@ func (t PerPartyRouter) GetExecutionState(contractID string, args GetExecutionSt // GetExecutionStateWithPackageID exercises the GetExecutionState choice using the provided package ID instead of package name func (t PerPartyRouter) GetExecutionStateWithPackageID(contractID string, packageID string, args GetExecutionState) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetExecutionState", Arguments: argsToMap(args), @@ -2482,7 +2489,7 @@ func (t PerPartyRouter) GetExecutionStateWithPackageID(contractID string, packag // This method uses the package name in the template ID func (t PerPartyRouter) PrepareExecute(contractID string, args PrepareExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "PrepareExecute", Arguments: argsToMap(args), @@ -2492,7 +2499,7 @@ func (t PerPartyRouter) PrepareExecute(contractID string, args PrepareExecute) * // PrepareExecuteWithPackageID exercises the PrepareExecute choice using the provided package ID instead of package name func (t PerPartyRouter) PrepareExecuteWithPackageID(contractID string, packageID string, args PrepareExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "PrepareExecute", Arguments: argsToMap(args), @@ -2503,7 +2510,7 @@ func (t PerPartyRouter) PrepareExecuteWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t PerPartyRouter) GetFee(contractID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -2513,7 +2520,7 @@ func (t PerPartyRouter) GetFee(contractID string, args GetFee) *model.ExerciseCo // GetFeeWithPackageID exercises the GetFee choice using the provided package ID instead of package name func (t PerPartyRouter) GetFeeWithPackageID(contractID string, packageID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -2524,7 +2531,7 @@ func (t PerPartyRouter) GetFeeWithPackageID(contractID string, packageID string, // This method uses the package name in the template ID func (t PerPartyRouter) PrepareSend(contractID string, args PrepareSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "PrepareSend", Arguments: argsToMap(args), @@ -2534,7 +2541,7 @@ func (t PerPartyRouter) PrepareSend(contractID string, args PrepareSend) *model. // PrepareSendWithPackageID exercises the PrepareSend choice using the provided package ID instead of package name func (t PerPartyRouter) PrepareSendWithPackageID(contractID string, packageID string, args PrepareSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "PrepareSend", Arguments: argsToMap(args), @@ -2545,7 +2552,7 @@ func (t PerPartyRouter) PrepareSendWithPackageID(contractID string, packageID st // This method uses the package name in the template ID func (t PerPartyRouter) FinalizeFee(contractID string, args FinalizeFee2) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "FinalizeFee", Arguments: argsToMap(args), @@ -2555,7 +2562,7 @@ func (t PerPartyRouter) FinalizeFee(contractID string, args FinalizeFee2) *model // FinalizeFeeWithPackageID exercises the FinalizeFee choice using the provided package ID instead of package name func (t PerPartyRouter) FinalizeFeeWithPackageID(contractID string, packageID string, args FinalizeFee2) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "FinalizeFee", Arguments: argsToMap(args), @@ -2566,7 +2573,7 @@ func (t PerPartyRouter) FinalizeFeeWithPackageID(contractID string, packageID st // This method uses the package name in the template ID func (t PerPartyRouter) GetRequiredCCVsForSend(contractID string, args GetRequiredCCVsForSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetRequiredCCVsForSend", Arguments: argsToMap(args), @@ -2576,7 +2583,7 @@ func (t PerPartyRouter) GetRequiredCCVsForSend(contractID string, args GetRequir // GetRequiredCCVsForSendWithPackageID exercises the GetRequiredCCVsForSend choice using the provided package ID instead of package name func (t PerPartyRouter) GetRequiredCCVsForSendWithPackageID(contractID string, packageID string, args GetRequiredCCVsForSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetRequiredCCVsForSend", Arguments: argsToMap(args), @@ -2587,7 +2594,7 @@ func (t PerPartyRouter) GetRequiredCCVsForSendWithPackageID(contractID string, p // This method uses the package name in the template ID func (t PerPartyRouter) GetRequiredCCVsForExecute(contractID string, args GetRequiredCCVsForExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetRequiredCCVsForExecute", Arguments: argsToMap(args), @@ -2597,18 +2604,18 @@ func (t PerPartyRouter) GetRequiredCCVsForExecute(contractID string, args GetReq // GetRequiredCCVsForExecuteWithPackageID exercises the GetRequiredCCVsForExecute choice using the provided package ID instead of package name func (t PerPartyRouter) GetRequiredCCVsForExecuteWithPackageID(contractID string, packageID string, args GetRequiredCCVsForExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetRequiredCCVsForExecute", Arguments: argsToMap(args), } } -// Archive exercises the Archive choice on this PerPartyRouter contract via the IMCMSReceiver interface +// Archive exercises the Archive choice on this PerPartyRouter contract via the IPerPartyRouter interface // This method uses the package name in the template ID func (t PerPartyRouter) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2618,7 +2625,7 @@ func (t PerPartyRouter) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t PerPartyRouter) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2629,7 +2636,7 @@ func (t PerPartyRouter) ArchiveWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t PerPartyRouter) GetSequenceNumber(contractID string, args GetSequenceNumber) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetSequenceNumber", Arguments: argsToMap(args), @@ -2639,7 +2646,7 @@ func (t PerPartyRouter) GetSequenceNumber(contractID string, args GetSequenceNum // GetSequenceNumberWithPackageID exercises the GetSequenceNumber choice using the provided package ID instead of package name func (t PerPartyRouter) GetSequenceNumberWithPackageID(contractID string, packageID string, args GetSequenceNumber) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "GetSequenceNumber", Arguments: argsToMap(args), @@ -2650,7 +2657,7 @@ func (t PerPartyRouter) GetSequenceNumberWithPackageID(contractID string, packag // This method uses the package name in the template ID func (t PerPartyRouter) SetDeps(contractID string, args SetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "SetDeps", Arguments: argsToMap(args), @@ -2660,7 +2667,7 @@ func (t PerPartyRouter) SetDeps(contractID string, args SetDeps) *model.Exercise // SetDepsWithPackageID exercises the SetDeps choice using the provided package ID instead of package name func (t PerPartyRouter) SetDepsWithPackageID(contractID string, packageID string, args SetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "SetDeps", Arguments: argsToMap(args), @@ -2671,7 +2678,7 @@ func (t PerPartyRouter) SetDepsWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t PerPartyRouter) AddCustomObservers(contractID string, args AddCustomObservers2) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "AddCustomObservers", Arguments: argsToMap(args), @@ -2681,7 +2688,7 @@ func (t PerPartyRouter) AddCustomObservers(contractID string, args AddCustomObse // AddCustomObserversWithPackageID exercises the AddCustomObservers choice using the provided package ID instead of package name func (t PerPartyRouter) AddCustomObserversWithPackageID(contractID string, packageID string, args AddCustomObservers2) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "AddCustomObservers", Arguments: argsToMap(args), @@ -2692,7 +2699,7 @@ func (t PerPartyRouter) AddCustomObserversWithPackageID(contractID string, packa // This method uses the package name in the template ID func (t PerPartyRouter) RemoveCustomObservers(contractID string, args RemoveCustomObservers2) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "RemoveCustomObservers", Arguments: argsToMap(args), @@ -2702,7 +2709,7 @@ func (t PerPartyRouter) RemoveCustomObservers(contractID string, args RemoveCust // RemoveCustomObserversWithPackageID exercises the RemoveCustomObservers choice using the provided package ID instead of package name func (t PerPartyRouter) RemoveCustomObserversWithPackageID(contractID string, packageID string, args RemoveCustomObservers2) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "RemoveCustomObservers", Arguments: argsToMap(args), @@ -2713,7 +2720,7 @@ func (t PerPartyRouter) RemoveCustomObserversWithPackageID(contractID string, pa // This method uses the package name in the template ID func (t PerPartyRouter) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -2723,17 +2730,229 @@ func (t PerPartyRouter) MCMSReceiverEntrypoint(contractID string, args api.MCMSR // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t PerPartyRouter) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), } } +// PerPartyRouterGetSequenceNumber exercises the PerPartyRouter_GetSequenceNumber choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterGetSequenceNumber(contractID string, args clientapi.PerPartyRouterGetSequenceNumber) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetSequenceNumber", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetSequenceNumberWithPackageID exercises the PerPartyRouter_GetSequenceNumber choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterGetSequenceNumberWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterGetSequenceNumber) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetSequenceNumber", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetRequiredCCVsForSend exercises the PerPartyRouter_GetRequiredCCVsForSend choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterGetRequiredCCVsForSend(contractID string, args clientapi.PerPartyRouterGetRequiredCCVsForSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetRequiredCCVsForSend", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetRequiredCCVsForSendWithPackageID exercises the PerPartyRouter_GetRequiredCCVsForSend choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterGetRequiredCCVsForSendWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterGetRequiredCCVsForSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetRequiredCCVsForSend", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetFee exercises the PerPartyRouter_GetFee choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterGetFee(contractID string, args clientapi.PerPartyRouterGetFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetFee", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetFeeWithPackageID exercises the PerPartyRouter_GetFee choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterGetFeeWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterGetFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetFee", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterPrepareSend exercises the PerPartyRouter_PrepareSend choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterPrepareSend(contractID string, args clientapi.PerPartyRouterPrepareSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_PrepareSend", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterPrepareSendWithPackageID exercises the PerPartyRouter_PrepareSend choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterPrepareSendWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterPrepareSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_PrepareSend", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterFinalizeFee exercises the PerPartyRouter_FinalizeFee choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterFinalizeFee(contractID string, args clientapi.PerPartyRouterFinalizeFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_FinalizeFee", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterFinalizeFeeWithPackageID exercises the PerPartyRouter_FinalizeFee choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterFinalizeFeeWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterFinalizeFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_FinalizeFee", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterCCIPSend exercises the PerPartyRouter_CCIPSend choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterCCIPSend(contractID string, args clientapi.PerPartyRouterCCIPSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_CCIPSend", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterCCIPSendWithPackageID exercises the PerPartyRouter_CCIPSend choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterCCIPSendWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterCCIPSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_CCIPSend", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetExecutionState exercises the PerPartyRouter_GetExecutionState choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterGetExecutionState(contractID string, args clientapi.PerPartyRouterGetExecutionState) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetExecutionState", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetExecutionStateWithPackageID exercises the PerPartyRouter_GetExecutionState choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterGetExecutionStateWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterGetExecutionState) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetExecutionState", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetRequiredCCVsForExecute exercises the PerPartyRouter_GetRequiredCCVsForExecute choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterGetRequiredCCVsForExecute(contractID string, args clientapi.PerPartyRouterGetRequiredCCVsForExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetRequiredCCVsForExecute", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterGetRequiredCCVsForExecuteWithPackageID exercises the PerPartyRouter_GetRequiredCCVsForExecute choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterGetRequiredCCVsForExecuteWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterGetRequiredCCVsForExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_GetRequiredCCVsForExecute", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterPrepareExecute exercises the PerPartyRouter_PrepareExecute choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterPrepareExecute(contractID string, args clientapi.PerPartyRouterPrepareExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_PrepareExecute", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterPrepareExecuteWithPackageID exercises the PerPartyRouter_PrepareExecute choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterPrepareExecuteWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterPrepareExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_PrepareExecute", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterExecute exercises the PerPartyRouter_Execute choice on this PerPartyRouter contract via the IPerPartyRouter interface +// This method uses the package name in the template ID +func (t PerPartyRouter) PerPartyRouterExecute(contractID string, args clientapi.PerPartyRouterExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_Execute", + Arguments: argsToMap(args), + } +} + +// PerPartyRouterExecuteWithPackageID exercises the PerPartyRouter_Execute choice using the provided package ID instead of package name +func (t PerPartyRouter) PerPartyRouterExecuteWithPackageID(contractID string, packageID string, args clientapi.PerPartyRouterExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_Execute", + Arguments: argsToMap(args), + } +} + // Verify interface implementations for PerPartyRouter var _ api.IMCMSReceiver = (*PerPartyRouter)(nil) +var _ clientapi.IPerPartyRouter = (*PerPartyRouter)(nil) + // PerPartyRouterDeps is a Record type type PerPartyRouterDeps struct { OnRamp chainlinkapi.RawInstanceAddress `json:"onRamp"` @@ -2795,12 +3014,12 @@ type PerPartyRouterFactory struct { // GetTemplateID returns the template ID for this template using the package name func (t PerPartyRouterFactory) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouterFactory") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouterFactory") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t PerPartyRouterFactory) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouterFactory") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouterFactory") } // CreateCommand returns a CreateCommand for this template using the package name @@ -2885,7 +3104,7 @@ func (t *PerPartyRouterFactory) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t PerPartyRouterFactory) CreateRouter(contractID string, args CreateRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouterFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouterFactory"), ContractID: contractID, Choice: "CreateRouter", Arguments: argsToMap(args), @@ -2895,7 +3114,7 @@ func (t PerPartyRouterFactory) CreateRouter(contractID string, args CreateRouter // CreateRouterWithPackageID exercises the CreateRouter choice using the provided package ID instead of package name func (t PerPartyRouterFactory) CreateRouterWithPackageID(contractID string, packageID string, args CreateRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouterFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouterFactory"), ContractID: contractID, Choice: "CreateRouter", Arguments: argsToMap(args), @@ -2906,7 +3125,7 @@ func (t PerPartyRouterFactory) CreateRouterWithPackageID(contractID string, pack // This method uses the package name in the template ID func (t PerPartyRouterFactory) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "MCMSReceiver"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2916,7 +3135,7 @@ func (t PerPartyRouterFactory) Archive(contractID string) *model.ExerciseCommand // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t PerPartyRouterFactory) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "MCMSReceiver"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2927,7 +3146,7 @@ func (t PerPartyRouterFactory) ArchiveWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t PerPartyRouterFactory) HasRouter(contractID string, args HasRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouterFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouterFactory"), ContractID: contractID, Choice: "HasRouter", Arguments: argsToMap(args), @@ -2937,7 +3156,7 @@ func (t PerPartyRouterFactory) HasRouter(contractID string, args HasRouter) *mod // HasRouterWithPackageID exercises the HasRouter choice using the provided package ID instead of package name func (t PerPartyRouterFactory) HasRouterWithPackageID(contractID string, packageID string, args HasRouter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouterFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouterFactory"), ContractID: contractID, Choice: "HasRouter", Arguments: argsToMap(args), @@ -2948,7 +3167,7 @@ func (t PerPartyRouterFactory) HasRouterWithPackageID(contractID string, package // This method uses the package name in the template ID func (t PerPartyRouterFactory) FactorySetDeps(contractID string, args FactorySetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "PerPartyRouterFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouterFactory"), ContractID: contractID, Choice: "FactorySetDeps", Arguments: argsToMap(args), @@ -2958,7 +3177,7 @@ func (t PerPartyRouterFactory) FactorySetDeps(contractID string, args FactorySet // FactorySetDepsWithPackageID exercises the FactorySetDeps choice using the provided package ID instead of package name func (t PerPartyRouterFactory) FactorySetDepsWithPackageID(contractID string, packageID string, args FactorySetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouterFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "PerPartyRouterFactory"), ContractID: contractID, Choice: "FactorySetDeps", Arguments: argsToMap(args), @@ -2969,7 +3188,7 @@ func (t PerPartyRouterFactory) FactorySetDepsWithPackageID(contractID string, pa // This method uses the package name in the template ID func (t PerPartyRouterFactory) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.PerPartyRouter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RuntimeV1.PerPartyRouter", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -2979,7 +3198,7 @@ func (t PerPartyRouterFactory) MCMSReceiverEntrypoint(contractID string, args ap // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t PerPartyRouterFactory) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RuntimeV1.PerPartyRouter", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -2992,14 +3211,14 @@ var _ api.IMCMSReceiver = (*PerPartyRouterFactory)(nil) // PrepareExecute is a Record type type PrepareExecute struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` EncodedMessage types.TEXT `json:"encodedMessage"` ReceiverParty types.PARTY `json:"receiverParty"` TokenReceiverParty *types.PARTY `json:"tokenReceiverParty" hex:"optional"` ReceiverRequiredCCVs []chainlinkapi.RawInstanceAddress `json:"receiverRequiredCCVs"` ReceiverOptionalCCVs []chainlinkapi.RawInstanceAddress `json:"receiverOptionalCCVs"` ReceiverOptionalThreshold types.INT64 `json:"receiverOptionalThreshold"` - ReceiverFinalityConfig core.FinalityConfig `json:"receiverFinalityConfig"` + ReceiverFinalityConfig ccipcodec.FinalityConfig `json:"receiverFinalityConfig"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -3007,8 +3226,6 @@ type PrepareExecute struct { func (t PrepareExecute) ToMap() map[string]any { m := make(map[string]any) - m["context"] = model.NestedToDAMLValue(t.Context) - m["encodedMessage"] = string(t.EncodedMessage) m["receiverParty"] = t.ReceiverParty.ToMap() @@ -3045,6 +3262,8 @@ func (t PrepareExecute) ToMap() map[string]any { m["receiverFinalityConfig"] = model.NestedToDAMLValue(t.ReceiverFinalityConfig) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -3075,14 +3294,14 @@ func (t *PrepareExecute) UnmarshalHex(data string) error { // PrepareExecuteMCMSParams is PrepareExecute without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type PrepareExecuteMCMSParams struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` EncodedMessage types.TEXT `json:"encodedMessage"` ReceiverParty types.PARTY `json:"receiverParty"` TokenReceiverParty *types.PARTY `json:"tokenReceiverParty" hex:"optional"` ReceiverRequiredCCVs []chainlinkapi.RawInstanceAddress `json:"receiverRequiredCCVs"` ReceiverOptionalCCVs []chainlinkapi.RawInstanceAddress `json:"receiverOptionalCCVs"` ReceiverOptionalThreshold types.INT64 `json:"receiverOptionalThreshold"` - ReceiverFinalityConfig core.FinalityConfig `json:"receiverFinalityConfig"` + ReceiverFinalityConfig ccipcodec.FinalityConfig `json:"receiverFinalityConfig"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes PrepareExecuteMCMSParams to hex string for MCMS operationData. @@ -3100,7 +3319,7 @@ func (t *PrepareExecuteMCMSParams) UnmarshalHex(data string) error { // PrepareSend is a Record type type PrepareSend struct { DestinationChainSelector types.NUMERIC `json:"destinationChainSelector"` - Message core.Canton2AnyMessage `json:"message"` + Message clientapi.Canton2AnyMessage `json:"message"` Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } @@ -3141,15 +3360,16 @@ func (t *PrepareSend) UnmarshalHex(data string) error { // PrepareSendFromRouter is a Record type type PrepareSendFromRouter struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - Message core.Canton2AnyMessage `json:"message"` - RouterPartyOwner types.PARTY `json:"routerPartyOwner"` - RouterInstanceId types.TEXT `json:"routerInstanceId"` - GlobalConfigCid types.CONTRACT_ID `json:"globalConfigCid"` - TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` - FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` - RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - CurrentSequenceNumber types.NUMERIC `json:"currentSequenceNumber"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Message clientapi.Canton2AnyMessage `json:"message"` + RouterPartyOwner types.PARTY `json:"routerPartyOwner"` + RouterInstanceId types.TEXT `json:"routerInstanceId"` + GlobalConfigCid types.CONTRACT_ID `json:"globalConfigCid"` + TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` + FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` + RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` + CurrentSequenceNumber types.NUMERIC `json:"currentSequenceNumber"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts PrepareSendFromRouter to a map for DAML arguments @@ -3174,6 +3394,8 @@ func (t PrepareSendFromRouter) ToMap() map[string]any { m["currentSequenceNumber"] = t.CurrentSequenceNumber + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -3325,7 +3547,6 @@ type SetDepsParams struct { RmnRemote *chainlinkapi.RawInstanceAddress `json:"rmnRemote" hex:"optional"` TokenAdminRegistry *chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry" hex:"optional"` FeeQuoter *chainlinkapi.RawInstanceAddress `json:"feeQuoter" hex:"optional"` - CcvRegistry *chainlinkapi.RawInstanceAddress `json:"ccvRegistry" hex:"optional"` } // ToMap converts SetDepsParams to a map for DAML arguments @@ -3380,18 +3601,6 @@ func (t SetDepsParams) ToMap() map[string]any { } } - if t.CcvRegistry != nil { - m["ccvRegistry"] = map[string]any{ - "_type": "optional", - "value": model.NestedToDAMLValue(*t.CcvRegistry), - } - } else { - m["ccvRegistry"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } - return m } diff --git a/bindings/generated/latest/ccip/clientapi/clientapi.go b/bindings/generated/latest/ccip/clientapi/clientapi.go new file mode 100644 index 000000000..499170e5a --- /dev/null +++ b/bindings/generated/latest/ccip/clientapi/clientapi.go @@ -0,0 +1,1388 @@ +package clientapi + +import ( + "errors" + "fmt" + "math/big" + "strings" + + ccipapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipapi" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" + extensionapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/extensionapi" + chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" + splice_api_token_holding_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" + splice_api_token_metadata_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" + "github.com/smartcontractkit/go-daml/pkg/bind" + "github.com/smartcontractkit/go-daml/pkg/codec" + "github.com/smartcontractkit/go-daml/pkg/model" + "github.com/smartcontractkit/go-daml/pkg/types" +) + +var ( + _ = fmt.Sprintf + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = model.Command{} + _ bind.BoundTemplate +) + +const ( + PackageName = "ccip-client-api" + PackageID = "556d37da759e61d9868a28782cdbd207b0330317ccac88cd4bd4d58021c6942a" + SDKVersion = "3.4.11" +) + +type Template interface { + CreateCommand() *model.CreateCommand + GetTemplateID() string +} + +// IICCIPMessageSent is a DAML interface +type IICCIPMessageSent interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand +} + +// IIExecutionStateChanged is a DAML interface +type IIExecutionStateChanged interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand +} + +// IPerPartyRouter is a DAML interface +type IPerPartyRouter interface { + + // Archive executes the Archive choice + Archive(contractID string) *model.ExerciseCommand + + // PerPartyRouterGetSequenceNumber executes the PerPartyRouter_GetSequenceNumber choice + PerPartyRouterGetSequenceNumber(contractID string, args PerPartyRouterGetSequenceNumber) *model.ExerciseCommand + + // PerPartyRouterGetRequiredCCVsForSend executes the PerPartyRouter_GetRequiredCCVsForSend choice + PerPartyRouterGetRequiredCCVsForSend(contractID string, args PerPartyRouterGetRequiredCCVsForSend) *model.ExerciseCommand + + // PerPartyRouterGetFee executes the PerPartyRouter_GetFee choice + PerPartyRouterGetFee(contractID string, args PerPartyRouterGetFee) *model.ExerciseCommand + + // PerPartyRouterPrepareSend executes the PerPartyRouter_PrepareSend choice + PerPartyRouterPrepareSend(contractID string, args PerPartyRouterPrepareSend) *model.ExerciseCommand + + // PerPartyRouterFinalizeFee executes the PerPartyRouter_FinalizeFee choice + PerPartyRouterFinalizeFee(contractID string, args PerPartyRouterFinalizeFee) *model.ExerciseCommand + + // PerPartyRouterCCIPSend executes the PerPartyRouter_CCIPSend choice + PerPartyRouterCCIPSend(contractID string, args PerPartyRouterCCIPSend) *model.ExerciseCommand + + // PerPartyRouterGetExecutionState executes the PerPartyRouter_GetExecutionState choice + PerPartyRouterGetExecutionState(contractID string, args PerPartyRouterGetExecutionState) *model.ExerciseCommand + + // PerPartyRouterGetRequiredCCVsForExecute executes the PerPartyRouter_GetRequiredCCVsForExecute choice + PerPartyRouterGetRequiredCCVsForExecute(contractID string, args PerPartyRouterGetRequiredCCVsForExecute) *model.ExerciseCommand + + // PerPartyRouterPrepareExecute executes the PerPartyRouter_PrepareExecute choice + PerPartyRouterPrepareExecute(contractID string, args PerPartyRouterPrepareExecute) *model.ExerciseCommand + + // PerPartyRouterExecute executes the PerPartyRouter_Execute choice + PerPartyRouterExecute(contractID string, args PerPartyRouterExecute) *model.ExerciseCommand +} + +func argsToMap(args any) map[string]any { + if args == nil { + return map[string]any{} + } + + if m, ok := args.(map[string]any); ok { + return m + } + + type mapper interface { + ToMap() map[string]any + } + if mapper, ok := args.(mapper); ok { + return mapper.ToMap() + } + + return map[string]any{"args": args} +} + +// CCIPMessageSentView is a Record type +type CCIPMessageSentView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + MessageId types.TEXT `json:"messageId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts CCIPMessageSentView to a map for DAML arguments +func (t CCIPMessageSentView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["messageId"] = string(t.MessageId) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t CCIPMessageSentView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *CCIPMessageSentView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes CCIPMessageSentView to hex string (Canton MCMS format) +func (t CCIPMessageSentView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes CCIPMessageSentView from hex string (Canton MCMS format) +func (t *CCIPMessageSentView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// CCIPSendResult is a Record type +type CCIPSendResult struct { + Router types.CONTRACT_ID `json:"router"` + CcipMessageSent types.CONTRACT_ID `json:"ccipMessageSent"` + MessageId types.TEXT `json:"messageId"` + FeeChangeCids []types.CONTRACT_ID `json:"feeChangeCids"` + PendingFeeInstructions []types.CONTRACT_ID `json:"pendingFeeInstructions"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts CCIPSendResult to a map for DAML arguments +func (t CCIPSendResult) ToMap() map[string]any { + m := make(map[string]any) + + m["router"] = model.NestedToDAMLValue(t.Router) + + m["ccipMessageSent"] = model.NestedToDAMLValue(t.CcipMessageSent) + + m["messageId"] = string(t.MessageId) + + m["feeChangeCids"] = func() []any { + res := make([]any, 0, len(t.FeeChangeCids)) + for _, e := range t.FeeChangeCids { + res = append(res, e) + } + return res + }() + + m["pendingFeeInstructions"] = func() []any { + res := make([]any, 0, len(t.PendingFeeInstructions)) + for _, e := range t.PendingFeeInstructions { + res = append(res, e) + } + return res + }() + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t CCIPSendResult) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *CCIPSendResult) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes CCIPSendResult to hex string (Canton MCMS format) +func (t CCIPSendResult) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes CCIPSendResult from hex string (Canton MCMS format) +func (t *CCIPSendResult) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// CCVExtraArg is a Record type +type CCVExtraArg struct { + CcvAddress chainlinkapi.RawInstanceAddress `json:"ccvAddress"` + CcvArgs types.TEXT `json:"ccvArgs"` +} + +// ToMap converts CCVExtraArg to a map for DAML arguments +func (t CCVExtraArg) ToMap() map[string]any { + m := make(map[string]any) + + m["ccvAddress"] = model.NestedToDAMLValue(t.CcvAddress) + + m["ccvArgs"] = string(t.CcvArgs) + + return m +} + +func (t CCVExtraArg) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *CCVExtraArg) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes CCVExtraArg to hex string (Canton MCMS format) +func (t CCVExtraArg) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes CCVExtraArg from hex string (Canton MCMS format) +func (t *CCVExtraArg) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// Canton2AnyMessage is a Record type +type Canton2AnyMessage struct { + Receiver types.TEXT `json:"receiver"` + Payload types.TEXT `json:"payload"` + TokenTransfer *TokenTransfer `json:"tokenTransfer" hex:"optional"` + FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` + ExtraArgs ExtraArgs `json:"extraArgs"` +} + +// ToMap converts Canton2AnyMessage to a map for DAML arguments +func (t Canton2AnyMessage) ToMap() map[string]any { + m := make(map[string]any) + + m["receiver"] = string(t.Receiver) + + m["payload"] = string(t.Payload) + + if t.TokenTransfer != nil { + m["tokenTransfer"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenTransfer), + } + } else { + m["tokenTransfer"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["feeToken"] = model.NestedToDAMLValue(t.FeeToken) + + m["extraArgs"] = model.NestedToDAMLValue(t.ExtraArgs) + + return m +} + +func (t Canton2AnyMessage) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *Canton2AnyMessage) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes Canton2AnyMessage to hex string (Canton MCMS format) +func (t Canton2AnyMessage) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes Canton2AnyMessage from hex string (Canton MCMS format) +func (t *Canton2AnyMessage) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecuteResult is a Record type +type ExecuteResult struct { + Router types.CONTRACT_ID `json:"router"` + TokenReceiveTicket *types.CONTRACT_ID `json:"tokenReceiveTicket" hex:"optional"` + ExecutionStateChanged types.CONTRACT_ID `json:"executionStateChanged"` + MessageId types.TEXT `json:"messageId"` + Message ccipcodec.MessageV1 `json:"message"` + State ccipapi.MessageExecutionState `json:"state"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts ExecuteResult to a map for DAML arguments +func (t ExecuteResult) ToMap() map[string]any { + m := make(map[string]any) + + m["router"] = model.NestedToDAMLValue(t.Router) + + if t.TokenReceiveTicket != nil { + m["tokenReceiveTicket"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenReceiveTicket), + } + } else { + m["tokenReceiveTicket"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["executionStateChanged"] = model.NestedToDAMLValue(t.ExecutionStateChanged) + + m["messageId"] = string(t.MessageId) + + m["message"] = model.NestedToDAMLValue(t.Message) + + m["state"] = model.NestedToDAMLValue(t.State) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t ExecuteResult) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecuteResult) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecuteResult to hex string (Canton MCMS format) +func (t ExecuteResult) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecuteResult from hex string (Canton MCMS format) +func (t *ExecuteResult) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecutionStateChangedView is a Record type +type ExecutionStateChangedView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + MessageId types.TEXT `json:"messageId"` + State ccipapi.MessageExecutionState `json:"state"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts ExecutionStateChangedView to a map for DAML arguments +func (t ExecutionStateChangedView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["messageId"] = string(t.MessageId) + + m["state"] = model.NestedToDAMLValue(t.State) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t ExecutionStateChangedView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutionStateChangedView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutionStateChangedView to hex string (Canton MCMS format) +func (t ExecutionStateChangedView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutionStateChangedView from hex string (Canton MCMS format) +func (t *ExecutionStateChangedView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecutorExtraArg is a variant/union type +type ExecutorExtraArg struct { + ExecutorNoExecutor *types.UNIT `json:"Executor_NoExecutor,omitempty"` + ExecutorUseDefault *ExecutorUseDefault `json:"Executor_UseDefault,omitempty"` + ExecutorWithAddress *ExecutorWithAddress `json:"Executor_WithAddress,omitempty"` +} + +// MarshalJSON implements custom JSON marshaling for ExecutorExtraArg +func (v ExecutorExtraArg) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(v) +} + +// UnmarshalJSON implements custom JSON unmarshalling for ExecutorExtraArg +func (v *ExecutorExtraArg) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, v) +} + +// MarshalHex encodes ExecutorExtraArg to hex string (Canton MCMS format) +func (v ExecutorExtraArg) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(v) +} + +// UnmarshalHex decodes ExecutorExtraArg from hex string (Canton MCMS format) +func (v *ExecutorExtraArg) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, v) +} + +// GetVariantTag implements types.VARIANT interface +func (v ExecutorExtraArg) GetVariantTag() string { + + if v.ExecutorNoExecutor != nil { + return "Executor_NoExecutor" + } + + if v.ExecutorUseDefault != nil { + return "Executor_UseDefault" + } + + if v.ExecutorWithAddress != nil { + return "Executor_WithAddress" + } + + return "" +} + +// GetVariantValue implements types.VARIANT interface +func (v ExecutorExtraArg) GetVariantValue() any { + + if v.ExecutorNoExecutor != nil { + return v.ExecutorNoExecutor + } + + if v.ExecutorUseDefault != nil { + return v.ExecutorUseDefault + } + + if v.ExecutorWithAddress != nil { + return v.ExecutorWithAddress + } + + return nil +} + +var _ types.VARIANT = (*ExecutorExtraArg)(nil) + +// ExecutorUseDefault is a Record type +type ExecutorUseDefault struct { + ExecutorArgs types.TEXT `json:"executorArgs"` +} + +// ToMap converts ExecutorUseDefault to a map for DAML arguments +func (t ExecutorUseDefault) ToMap() map[string]any { + m := make(map[string]any) + + m["executorArgs"] = string(t.ExecutorArgs) + + return m +} + +func (t ExecutorUseDefault) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutorUseDefault) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutorUseDefault to hex string (Canton MCMS format) +func (t ExecutorUseDefault) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutorUseDefault from hex string (Canton MCMS format) +func (t *ExecutorUseDefault) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecutorWithAddress is a Record type +type ExecutorWithAddress struct { + ExecutorAddress chainlinkapi.RawInstanceAddress `json:"executorAddress"` + ExecutorArgs types.TEXT `json:"executorArgs"` +} + +// ToMap converts ExecutorWithAddress to a map for DAML arguments +func (t ExecutorWithAddress) ToMap() map[string]any { + m := make(map[string]any) + + m["executorAddress"] = model.NestedToDAMLValue(t.ExecutorAddress) + + m["executorArgs"] = string(t.ExecutorArgs) + + return m +} + +func (t ExecutorWithAddress) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutorWithAddress) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutorWithAddress to hex string (Canton MCMS format) +func (t ExecutorWithAddress) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutorWithAddress from hex string (Canton MCMS format) +func (t *ExecutorWithAddress) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExtraArgs is a variant/union type +type ExtraArgs struct { + V3 *GenericExtraArgsV3 `json:"V3,omitempty"` +} + +// MarshalJSON implements custom JSON marshaling for ExtraArgs +func (v ExtraArgs) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(v) +} + +// UnmarshalJSON implements custom JSON unmarshalling for ExtraArgs +func (v *ExtraArgs) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, v) +} + +// MarshalHex encodes ExtraArgs to hex string (Canton MCMS format) +func (v ExtraArgs) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(v) +} + +// UnmarshalHex decodes ExtraArgs from hex string (Canton MCMS format) +func (v *ExtraArgs) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, v) +} + +// GetVariantTag implements types.VARIANT interface +func (v ExtraArgs) GetVariantTag() string { + + if v.V3 != nil { + return "V3" + } + + return "" +} + +// GetVariantValue implements types.VARIANT interface +func (v ExtraArgs) GetVariantValue() any { + + if v.V3 != nil { + return v.V3 + } + + return nil +} + +var _ types.VARIANT = (*ExtraArgs)(nil) + +// GenericExtraArgsV3 is a Record type +type GenericExtraArgsV3 struct { + GasLimit types.INT64 `json:"gasLimit"` + Ccvs []CCVExtraArg `json:"ccvs"` + Executor ExecutorExtraArg `json:"executor"` + TokenReceiver types.TEXT `json:"tokenReceiver"` + TokenArgs types.TEXT `json:"tokenArgs"` +} + +// ToMap converts GenericExtraArgsV3 to a map for DAML arguments +func (t GenericExtraArgsV3) ToMap() map[string]any { + m := make(map[string]any) + + m["gasLimit"] = int64(t.GasLimit) + + m["ccvs"] = func() []any { + res := make([]any, 0, len(t.Ccvs)) + for _, e := range t.Ccvs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["executor"] = model.NestedToDAMLValue(t.Executor) + + m["tokenReceiver"] = string(t.TokenReceiver) + + m["tokenArgs"] = string(t.TokenArgs) + + return m +} + +func (t GenericExtraArgsV3) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *GenericExtraArgsV3) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes GenericExtraArgsV3 to hex string (Canton MCMS format) +func (t GenericExtraArgsV3) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes GenericExtraArgsV3 from hex string (Canton MCMS format) +func (t *GenericExtraArgsV3) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// GetFeeResult is a Record type +type GetFeeResult struct { + FeeTokenAmount types.NUMERIC `json:"feeTokenAmount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts GetFeeResult to a map for DAML arguments +func (t GetFeeResult) ToMap() map[string]any { + m := make(map[string]any) + + m["feeTokenAmount"] = t.FeeTokenAmount + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t GetFeeResult) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *GetFeeResult) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes GetFeeResult to hex string (Canton MCMS format) +func (t GetFeeResult) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes GetFeeResult from hex string (Canton MCMS format) +func (t *GetFeeResult) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterView is a Record type +type PerPartyRouterView struct { + CcipOwner types.PARTY `json:"ccipOwner"` + Owner types.PARTY `json:"owner"` +} + +// ToMap converts PerPartyRouterView to a map for DAML arguments +func (t PerPartyRouterView) ToMap() map[string]any { + m := make(map[string]any) + + m["ccipOwner"] = t.CcipOwner.ToMap() + + m["owner"] = t.Owner.ToMap() + + return m +} + +func (t PerPartyRouterView) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterView) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterView to hex string (Canton MCMS format) +func (t PerPartyRouterView) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterView from hex string (Canton MCMS format) +func (t *PerPartyRouterView) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterCCIPSend is a Record type +type PerPartyRouterCCIPSend struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + FeeTokenHoldingCids []types.CONTRACT_ID `json:"feeTokenHoldingCids"` + FeeTokenConfigCid types.CONTRACT_ID `json:"feeTokenConfigCid"` + FeeTokenTransferFactory types.CONTRACT_ID `json:"feeTokenTransferFactory"` + FeeTokenExtraArgs splice_api_token_metadata_v1.ExtraArgs `json:"feeTokenExtraArgs"` +} + +// ToMap converts PerPartyRouterCCIPSend to a map for DAML arguments +func (t PerPartyRouterCCIPSend) ToMap() map[string]any { + m := make(map[string]any) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + + m["feeTokenHoldingCids"] = func() []any { + res := make([]any, 0, len(t.FeeTokenHoldingCids)) + for _, e := range t.FeeTokenHoldingCids { + res = append(res, e) + } + return res + }() + + m["feeTokenConfigCid"] = model.NestedToDAMLValue(t.FeeTokenConfigCid) + + m["feeTokenTransferFactory"] = model.NestedToDAMLValue(t.FeeTokenTransferFactory) + + m["feeTokenExtraArgs"] = model.NestedToDAMLValue(t.FeeTokenExtraArgs) + + return m +} + +func (t PerPartyRouterCCIPSend) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterCCIPSend) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterCCIPSend to hex string (Canton MCMS format) +func (t PerPartyRouterCCIPSend) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterCCIPSend from hex string (Canton MCMS format) +func (t *PerPartyRouterCCIPSend) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterExecute is a Record type +type PerPartyRouterExecute struct { + ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts PerPartyRouterExecute to a map for DAML arguments +func (t PerPartyRouterExecute) ToMap() map[string]any { + m := make(map[string]any) + + m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t PerPartyRouterExecute) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterExecute) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterExecute to hex string (Canton MCMS format) +func (t PerPartyRouterExecute) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterExecute from hex string (Canton MCMS format) +func (t *PerPartyRouterExecute) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterFinalizeFee is a Record type +type PerPartyRouterFinalizeFee struct { + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts PerPartyRouterFinalizeFee to a map for DAML arguments +func (t PerPartyRouterFinalizeFee) ToMap() map[string]any { + m := make(map[string]any) + + m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t PerPartyRouterFinalizeFee) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterFinalizeFee) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterFinalizeFee to hex string (Canton MCMS format) +func (t PerPartyRouterFinalizeFee) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterFinalizeFee from hex string (Canton MCMS format) +func (t *PerPartyRouterFinalizeFee) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterGetExecutionState is a Record type +type PerPartyRouterGetExecutionState struct { + MessageHash types.TEXT `json:"messageHash"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts PerPartyRouterGetExecutionState to a map for DAML arguments +func (t PerPartyRouterGetExecutionState) ToMap() map[string]any { + m := make(map[string]any) + + m["messageHash"] = string(t.MessageHash) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t PerPartyRouterGetExecutionState) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterGetExecutionState) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterGetExecutionState to hex string (Canton MCMS format) +func (t PerPartyRouterGetExecutionState) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterGetExecutionState from hex string (Canton MCMS format) +func (t *PerPartyRouterGetExecutionState) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterGetFee is a Record type +type PerPartyRouterGetFee struct { + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Message Canton2AnyMessage `json:"message"` + CcvFeeQuotes []extensionapi.CrossChainVerifierFeeQuote `json:"ccvFeeQuotes"` + TokenPoolFeeQuote *extensionapi.TokenPoolFeeQuote `json:"tokenPoolFeeQuote" hex:"optional"` + ExecutorFeeQuote *extensionapi.ExecutorFeeQuote `json:"executorFeeQuote" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts PerPartyRouterGetFee to a map for DAML arguments +func (t PerPartyRouterGetFee) ToMap() map[string]any { + m := make(map[string]any) + + m["destChainSelector"] = t.DestChainSelector + + m["message"] = model.NestedToDAMLValue(t.Message) + + m["ccvFeeQuotes"] = func() []any { + res := make([]any, 0, len(t.CcvFeeQuotes)) + for _, e := range t.CcvFeeQuotes { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + if t.TokenPoolFeeQuote != nil { + m["tokenPoolFeeQuote"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenPoolFeeQuote), + } + } else { + m["tokenPoolFeeQuote"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + if t.ExecutorFeeQuote != nil { + m["executorFeeQuote"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.ExecutorFeeQuote), + } + } else { + m["executorFeeQuote"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t PerPartyRouterGetFee) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterGetFee) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterGetFee to hex string (Canton MCMS format) +func (t PerPartyRouterGetFee) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterGetFee from hex string (Canton MCMS format) +func (t *PerPartyRouterGetFee) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterGetRequiredCCVsForExecute is a Record type +type PerPartyRouterGetRequiredCCVsForExecute struct { + Message ccipcodec.MessageV1 `json:"message"` + ReceiverRequiredCCVs []chainlinkapi.RawInstanceAddress `json:"receiverRequiredCCVs"` + ReceiverOptionalCCVs []chainlinkapi.RawInstanceAddress `json:"receiverOptionalCCVs"` + ReceiverOptionalThreshold types.INT64 `json:"receiverOptionalThreshold"` + TokenPoolRequiredCCVs []chainlinkapi.RawInstanceAddress `json:"tokenPoolRequiredCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts PerPartyRouterGetRequiredCCVsForExecute to a map for DAML arguments +func (t PerPartyRouterGetRequiredCCVsForExecute) ToMap() map[string]any { + m := make(map[string]any) + + m["message"] = model.NestedToDAMLValue(t.Message) + + m["receiverRequiredCCVs"] = func() []any { + res := make([]any, 0, len(t.ReceiverRequiredCCVs)) + for _, e := range t.ReceiverRequiredCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["receiverOptionalCCVs"] = func() []any { + res := make([]any, 0, len(t.ReceiverOptionalCCVs)) + for _, e := range t.ReceiverOptionalCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["receiverOptionalThreshold"] = int64(t.ReceiverOptionalThreshold) + + m["tokenPoolRequiredCCVs"] = func() []any { + res := make([]any, 0, len(t.TokenPoolRequiredCCVs)) + for _, e := range t.TokenPoolRequiredCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t PerPartyRouterGetRequiredCCVsForExecute) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterGetRequiredCCVsForExecute) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterGetRequiredCCVsForExecute to hex string (Canton MCMS format) +func (t PerPartyRouterGetRequiredCCVsForExecute) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterGetRequiredCCVsForExecute from hex string (Canton MCMS format) +func (t *PerPartyRouterGetRequiredCCVsForExecute) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterGetRequiredCCVsForSend is a Record type +type PerPartyRouterGetRequiredCCVsForSend struct { + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Message Canton2AnyMessage `json:"message"` + PoolReportedCCVs []chainlinkapi.RawInstanceAddress `json:"poolReportedCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts PerPartyRouterGetRequiredCCVsForSend to a map for DAML arguments +func (t PerPartyRouterGetRequiredCCVsForSend) ToMap() map[string]any { + m := make(map[string]any) + + m["destChainSelector"] = t.DestChainSelector + + m["message"] = model.NestedToDAMLValue(t.Message) + + m["poolReportedCCVs"] = func() []any { + res := make([]any, 0, len(t.PoolReportedCCVs)) + for _, e := range t.PoolReportedCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t PerPartyRouterGetRequiredCCVsForSend) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterGetRequiredCCVsForSend) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterGetRequiredCCVsForSend to hex string (Canton MCMS format) +func (t PerPartyRouterGetRequiredCCVsForSend) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterGetRequiredCCVsForSend from hex string (Canton MCMS format) +func (t *PerPartyRouterGetRequiredCCVsForSend) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterGetSequenceNumber is a Record type +type PerPartyRouterGetSequenceNumber struct { + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts PerPartyRouterGetSequenceNumber to a map for DAML arguments +func (t PerPartyRouterGetSequenceNumber) ToMap() map[string]any { + m := make(map[string]any) + + m["destChainSelector"] = t.DestChainSelector + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t PerPartyRouterGetSequenceNumber) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterGetSequenceNumber) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterGetSequenceNumber to hex string (Canton MCMS format) +func (t PerPartyRouterGetSequenceNumber) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterGetSequenceNumber from hex string (Canton MCMS format) +func (t *PerPartyRouterGetSequenceNumber) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterPrepareExecute is a Record type +type PerPartyRouterPrepareExecute struct { + EncodedMessage types.TEXT `json:"encodedMessage"` + ReceiverParty types.PARTY `json:"receiverParty"` + TokenReceiverParty *types.PARTY `json:"tokenReceiverParty" hex:"optional"` + ReceiverRequiredCCVs []chainlinkapi.RawInstanceAddress `json:"receiverRequiredCCVs"` + ReceiverOptionalCCVs []chainlinkapi.RawInstanceAddress `json:"receiverOptionalCCVs"` + ReceiverOptionalThreshold types.INT64 `json:"receiverOptionalThreshold"` + ReceiverFinalityConfig ccipcodec.FinalityConfig `json:"receiverFinalityConfig"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` +} + +// ToMap converts PerPartyRouterPrepareExecute to a map for DAML arguments +func (t PerPartyRouterPrepareExecute) ToMap() map[string]any { + m := make(map[string]any) + + m["encodedMessage"] = string(t.EncodedMessage) + + m["receiverParty"] = t.ReceiverParty.ToMap() + + if t.TokenReceiverParty != nil { + m["tokenReceiverParty"] = map[string]any{ + "_type": "optional", + "value": (*t.TokenReceiverParty).ToMap(), + } + } else { + m["tokenReceiverParty"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["receiverRequiredCCVs"] = func() []any { + res := make([]any, 0, len(t.ReceiverRequiredCCVs)) + for _, e := range t.ReceiverRequiredCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["receiverOptionalCCVs"] = func() []any { + res := make([]any, 0, len(t.ReceiverOptionalCCVs)) + for _, e := range t.ReceiverOptionalCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["receiverOptionalThreshold"] = int64(t.ReceiverOptionalThreshold) + + m["receiverFinalityConfig"] = model.NestedToDAMLValue(t.ReceiverFinalityConfig) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + + return m +} + +func (t PerPartyRouterPrepareExecute) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterPrepareExecute) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterPrepareExecute to hex string (Canton MCMS format) +func (t PerPartyRouterPrepareExecute) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterPrepareExecute from hex string (Canton MCMS format) +func (t *PerPartyRouterPrepareExecute) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// PerPartyRouterPrepareSend is a Record type +type PerPartyRouterPrepareSend struct { + DestinationChainSelector types.NUMERIC `json:"destinationChainSelector"` + Message Canton2AnyMessage `json:"message"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// ToMap converts PerPartyRouterPrepareSend to a map for DAML arguments +func (t PerPartyRouterPrepareSend) ToMap() map[string]any { + m := make(map[string]any) + + m["destinationChainSelector"] = t.DestinationChainSelector + + m["message"] = model.NestedToDAMLValue(t.Message) + + m["context"] = model.NestedToDAMLValue(t.Context) + + return m +} + +func (t PerPartyRouterPrepareSend) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *PerPartyRouterPrepareSend) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes PerPartyRouterPrepareSend to hex string (Canton MCMS format) +func (t PerPartyRouterPrepareSend) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes PerPartyRouterPrepareSend from hex string (Canton MCMS format) +func (t *PerPartyRouterPrepareSend) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenTransfer is a Record type +type TokenTransfer struct { + Token splice_api_token_holding_v1.InstrumentId `json:"token"` + Amount types.NUMERIC `json:"amount"` +} + +// ToMap converts TokenTransfer to a map for DAML arguments +func (t TokenTransfer) ToMap() map[string]any { + m := make(map[string]any) + + m["token"] = model.NestedToDAMLValue(t.Token) + + m["amount"] = t.Amount + + return m +} + +func (t TokenTransfer) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenTransfer) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenTransfer to hex string (Canton MCMS format) +func (t TokenTransfer) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenTransfer from hex string (Canton MCMS format) +func (t *TokenTransfer) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// IICCIPMessageSentInterfaceID returns the interface ID for the IICCIPMessageSent interface using the package name +func IICCIPMessageSentInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ClientV1", "ICCIPMessageSent") +} + +// IICCIPMessageSentInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IICCIPMessageSentInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.ClientV1", "ICCIPMessageSent") +} + +// IIExecutionStateChangedInterfaceID returns the interface ID for the IIExecutionStateChanged interface using the package name +func IIExecutionStateChangedInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ClientV1", "IExecutionStateChanged") +} + +// IIExecutionStateChangedInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IIExecutionStateChangedInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.ClientV1", "IExecutionStateChanged") +} + +// IPerPartyRouterInterfaceID returns the interface ID for the IPerPartyRouter interface using the package name +func IPerPartyRouterInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ClientV1", "PerPartyRouter") +} + +// IPerPartyRouterInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IPerPartyRouterInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.ClientV1", "PerPartyRouter") +} + +// MCMSEncoder interface for typed encoding methods. +// Implemented by Encoder for method-based encoding. +type MCMSEncoder interface { +} + +// encoder provides typed encoding methods for choice parameters (unexported). +// It wraps bind.BoundTemplate to encode parameters to hex-encoded operation data. +type encoder struct { + *bind.BoundTemplate +} + +// Contract wraps template operations with Sui-style API access. +// Use NewContract to create instances, then call Encoder() for encoding methods. +type Contract struct { + enc *encoder +} + +// NewContract creates a Contract with encoder for the given template. +// This provides Sui-style API: contract.Encoder().Method(args) +func NewContract(packageID, moduleName, templateName string) *Contract { + return &Contract{ + enc: &encoder{ + BoundTemplate: bind.NewBoundTemplate(packageID, moduleName, templateName), + }, + } +} + +// Encoder returns the encoder for Sui-style contract.Encoder().Method() usage. +func (c *Contract) Encoder() MCMSEncoder { + return c.enc +} + +// Verify MCMSEncoder interface implementation +var _ MCMSEncoder = (*encoder)(nil) diff --git a/bindings/generated/latest/ccip/committeeverifier/committeeverifier.go b/bindings/generated/latest/ccip/committeeverifier/committeeverifier.go index e608f4900..20b7e3e43 100644 --- a/bindings/generated/latest/ccip/committeeverifier/committeeverifier.go +++ b/bindings/generated/latest/ccip/committeeverifier/committeeverifier.go @@ -27,7 +27,7 @@ var ( const ( PackageName = "ccip-committee-verifier" - PackageID = "5ae7d01fcbf94b3a26bb9b5b8c8d1431eeebb652a951d3f6cbdf4d8991e62499" + PackageID = "9d6be72567fd0d602a51bb77008efa306f34efcd81b1ff636e75ae56983f0626" SDKVersion = "3.4.11" ) @@ -447,7 +447,7 @@ func (t *ApplySignatureConfigsParams) UnmarshalHex(data string) error { // CalculateFee is a Record type type CalculateFee struct { SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -457,7 +457,7 @@ func (t CalculateFee) ToMap() map[string]any { m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) m["caller"] = t.Caller.ToMap() @@ -489,7 +489,7 @@ func (t *CalculateFee) UnmarshalHex(data string) error { // CalculateFeeMCMSParams is CalculateFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type CalculateFeeMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes CalculateFeeMCMSParams to hex string for MCMS operationData. @@ -522,12 +522,12 @@ type CommitteeVerifier struct { // GetTemplateID returns the template ID for this template using the package name func (t CommitteeVerifier) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t CommitteeVerifier) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier") } // CreateCommand returns a CreateCommand for this template using the package name @@ -712,7 +712,7 @@ func (t *CommitteeVerifier) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t CommitteeVerifier) VerifyMessage(contractID string, args VerifyMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "VerifyMessage", Arguments: argsToMap(args), @@ -722,7 +722,7 @@ func (t CommitteeVerifier) VerifyMessage(contractID string, args VerifyMessage) // VerifyMessageWithPackageID exercises the VerifyMessage choice using the provided package ID instead of package name func (t CommitteeVerifier) VerifyMessageWithPackageID(contractID string, packageID string, args VerifyMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "VerifyMessage", Arguments: argsToMap(args), @@ -733,7 +733,7 @@ func (t CommitteeVerifier) VerifyMessageWithPackageID(contractID string, package // This method uses the package name in the template ID func (t CommitteeVerifier) ApplySignatureConfigs(contractID string, args ApplySignatureConfigs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "ApplySignatureConfigs", Arguments: argsToMap(args), @@ -743,7 +743,7 @@ func (t CommitteeVerifier) ApplySignatureConfigs(contractID string, args ApplySi // ApplySignatureConfigsWithPackageID exercises the ApplySignatureConfigs choice using the provided package ID instead of package name func (t CommitteeVerifier) ApplySignatureConfigsWithPackageID(contractID string, packageID string, args ApplySignatureConfigs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "ApplySignatureConfigs", Arguments: argsToMap(args), @@ -754,7 +754,7 @@ func (t CommitteeVerifier) ApplySignatureConfigsWithPackageID(contractID string, // This method uses the package name in the template ID func (t CommitteeVerifier) ApplyAllowListUpdates(contractID string, args ApplyAllowListUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "ApplyAllowListUpdates", Arguments: argsToMap(args), @@ -764,7 +764,7 @@ func (t CommitteeVerifier) ApplyAllowListUpdates(contractID string, args ApplyAl // ApplyAllowListUpdatesWithPackageID exercises the ApplyAllowListUpdates choice using the provided package ID instead of package name func (t CommitteeVerifier) ApplyAllowListUpdatesWithPackageID(contractID string, packageID string, args ApplyAllowListUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "ApplyAllowListUpdates", Arguments: argsToMap(args), @@ -775,7 +775,7 @@ func (t CommitteeVerifier) ApplyAllowListUpdatesWithPackageID(contractID string, // This method uses the package name in the template ID func (t CommitteeVerifier) ApplyRemoteChainConfigUpdates(contractID string, args ApplyRemoteChainConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "ApplyRemoteChainConfigUpdates", Arguments: argsToMap(args), @@ -785,7 +785,7 @@ func (t CommitteeVerifier) ApplyRemoteChainConfigUpdates(contractID string, args // ApplyRemoteChainConfigUpdatesWithPackageID exercises the ApplyRemoteChainConfigUpdates choice using the provided package ID instead of package name func (t CommitteeVerifier) ApplyRemoteChainConfigUpdatesWithPackageID(contractID string, packageID string, args ApplyRemoteChainConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "ApplyRemoteChainConfigUpdates", Arguments: argsToMap(args), @@ -796,7 +796,7 @@ func (t CommitteeVerifier) ApplyRemoteChainConfigUpdatesWithPackageID(contractID // This method uses the package name in the template ID func (t CommitteeVerifier) AcceptStorageLocationsAdmin(contractID string, args AcceptStorageLocationsAdmin) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "AcceptStorageLocationsAdmin", Arguments: argsToMap(args), @@ -806,7 +806,7 @@ func (t CommitteeVerifier) AcceptStorageLocationsAdmin(contractID string, args A // AcceptStorageLocationsAdminWithPackageID exercises the AcceptStorageLocationsAdmin choice using the provided package ID instead of package name func (t CommitteeVerifier) AcceptStorageLocationsAdminWithPackageID(contractID string, packageID string, args AcceptStorageLocationsAdmin) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "AcceptStorageLocationsAdmin", Arguments: argsToMap(args), @@ -817,7 +817,7 @@ func (t CommitteeVerifier) AcceptStorageLocationsAdminWithPackageID(contractID s // This method uses the package name in the template ID func (t CommitteeVerifier) CalculateFee(contractID string, args CalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "CalculateFee", Arguments: argsToMap(args), @@ -827,7 +827,7 @@ func (t CommitteeVerifier) CalculateFee(contractID string, args CalculateFee) *m // CalculateFeeWithPackageID exercises the CalculateFee choice using the provided package ID instead of package name func (t CommitteeVerifier) CalculateFeeWithPackageID(contractID string, packageID string, args CalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "CalculateFee", Arguments: argsToMap(args), @@ -838,7 +838,7 @@ func (t CommitteeVerifier) CalculateFeeWithPackageID(contractID string, packageI // This method uses the package name in the template ID func (t CommitteeVerifier) ForwardToVerifier(contractID string, args ForwardToVerifier) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "ForwardToVerifier", Arguments: argsToMap(args), @@ -848,7 +848,7 @@ func (t CommitteeVerifier) ForwardToVerifier(contractID string, args ForwardToVe // ForwardToVerifierWithPackageID exercises the ForwardToVerifier choice using the provided package ID instead of package name func (t CommitteeVerifier) ForwardToVerifierWithPackageID(contractID string, packageID string, args ForwardToVerifier) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "ForwardToVerifier", Arguments: argsToMap(args), @@ -859,7 +859,7 @@ func (t CommitteeVerifier) ForwardToVerifierWithPackageID(contractID string, pac // This method uses the package name in the template ID func (t CommitteeVerifier) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CrossChainVerifier"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -869,7 +869,7 @@ func (t CommitteeVerifier) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t CommitteeVerifier) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CrossChainVerifier"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -880,7 +880,7 @@ func (t CommitteeVerifier) ArchiveWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t CommitteeVerifier) GetFee(contractID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -890,7 +890,7 @@ func (t CommitteeVerifier) GetFee(contractID string, args GetFee) *model.Exercis // GetFeeWithPackageID exercises the GetFee choice using the provided package ID instead of package name func (t CommitteeVerifier) GetFeeWithPackageID(contractID string, packageID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -901,7 +901,7 @@ func (t CommitteeVerifier) GetFeeWithPackageID(contractID string, packageID stri // This method uses the package name in the template ID func (t CommitteeVerifier) SetDynamicConfig(contractID string, args SetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "SetDynamicConfig", Arguments: argsToMap(args), @@ -911,7 +911,7 @@ func (t CommitteeVerifier) SetDynamicConfig(contractID string, args SetDynamicCo // SetDynamicConfigWithPackageID exercises the SetDynamicConfig choice using the provided package ID instead of package name func (t CommitteeVerifier) SetDynamicConfigWithPackageID(contractID string, packageID string, args SetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "SetDynamicConfig", Arguments: argsToMap(args), @@ -922,7 +922,7 @@ func (t CommitteeVerifier) SetDynamicConfigWithPackageID(contractID string, pack // This method uses the package name in the template ID func (t CommitteeVerifier) SetDeps(contractID string, args SetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "SetDeps", Arguments: argsToMap(args), @@ -932,7 +932,7 @@ func (t CommitteeVerifier) SetDeps(contractID string, args SetDeps) *model.Exerc // SetDepsWithPackageID exercises the SetDeps choice using the provided package ID instead of package name func (t CommitteeVerifier) SetDepsWithPackageID(contractID string, packageID string, args SetDeps) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "SetDeps", Arguments: argsToMap(args), @@ -943,7 +943,7 @@ func (t CommitteeVerifier) SetDepsWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t CommitteeVerifier) TransferStorageLocationsAdmin(contractID string, args TransferStorageLocationsAdmin) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "TransferStorageLocationsAdmin", Arguments: argsToMap(args), @@ -953,7 +953,7 @@ func (t CommitteeVerifier) TransferStorageLocationsAdmin(contractID string, args // TransferStorageLocationsAdminWithPackageID exercises the TransferStorageLocationsAdmin choice using the provided package ID instead of package name func (t CommitteeVerifier) TransferStorageLocationsAdminWithPackageID(contractID string, packageID string, args TransferStorageLocationsAdmin) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "TransferStorageLocationsAdmin", Arguments: argsToMap(args), @@ -964,7 +964,7 @@ func (t CommitteeVerifier) TransferStorageLocationsAdminWithPackageID(contractID // This method uses the package name in the template ID func (t CommitteeVerifier) UpdateStorageLocations(contractID string, args UpdateStorageLocations) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "UpdateStorageLocations", Arguments: argsToMap(args), @@ -974,7 +974,7 @@ func (t CommitteeVerifier) UpdateStorageLocations(contractID string, args Update // UpdateStorageLocationsWithPackageID exercises the UpdateStorageLocations choice using the provided package ID instead of package name func (t CommitteeVerifier) UpdateStorageLocationsWithPackageID(contractID string, packageID string, args UpdateStorageLocations) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "CommitteeVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "CommitteeVerifier"), ContractID: contractID, Choice: "UpdateStorageLocations", Arguments: argsToMap(args), @@ -985,7 +985,7 @@ func (t CommitteeVerifier) UpdateStorageLocationsWithPackageID(contractID string // This method uses the package name in the template ID func (t CommitteeVerifier) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -995,7 +995,7 @@ func (t CommitteeVerifier) MCMSReceiverEntrypoint(contractID string, args api.MC // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t CommitteeVerifier) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -1006,7 +1006,7 @@ func (t CommitteeVerifier) MCMSReceiverEntrypointWithPackageID(contractID string // This method uses the package name in the template ID func (t CommitteeVerifier) CrossChainVerifierVerifyMessage(contractID string, args extensionapi.CrossChainVerifierVerifyMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "ICrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "ICrossChainVerifier"), ContractID: contractID, Choice: "CrossChainVerifier_VerifyMessage", Arguments: argsToMap(args), @@ -1016,7 +1016,7 @@ func (t CommitteeVerifier) CrossChainVerifierVerifyMessage(contractID string, ar // CrossChainVerifierVerifyMessageWithPackageID exercises the CrossChainVerifier_VerifyMessage choice using the provided package ID instead of package name func (t CommitteeVerifier) CrossChainVerifierVerifyMessageWithPackageID(contractID string, packageID string, args extensionapi.CrossChainVerifierVerifyMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "ICrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "ICrossChainVerifier"), ContractID: contractID, Choice: "CrossChainVerifier_VerifyMessage", Arguments: argsToMap(args), @@ -1027,7 +1027,7 @@ func (t CommitteeVerifier) CrossChainVerifierVerifyMessageWithPackageID(contract // This method uses the package name in the template ID func (t CommitteeVerifier) CrossChainVerifierCalculateFee(contractID string, args extensionapi.CrossChainVerifierCalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "ICrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "ICrossChainVerifier"), ContractID: contractID, Choice: "CrossChainVerifier_CalculateFee", Arguments: argsToMap(args), @@ -1037,7 +1037,7 @@ func (t CommitteeVerifier) CrossChainVerifierCalculateFee(contractID string, arg // CrossChainVerifierCalculateFeeWithPackageID exercises the CrossChainVerifier_CalculateFee choice using the provided package ID instead of package name func (t CommitteeVerifier) CrossChainVerifierCalculateFeeWithPackageID(contractID string, packageID string, args extensionapi.CrossChainVerifierCalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "ICrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "ICrossChainVerifier"), ContractID: contractID, Choice: "CrossChainVerifier_CalculateFee", Arguments: argsToMap(args), @@ -1048,7 +1048,7 @@ func (t CommitteeVerifier) CrossChainVerifierCalculateFeeWithPackageID(contractI // This method uses the package name in the template ID func (t CommitteeVerifier) CrossChainVerifierGetFee(contractID string, args extensionapi.CrossChainVerifierGetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "ICrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "ICrossChainVerifier"), ContractID: contractID, Choice: "CrossChainVerifier_GetFee", Arguments: argsToMap(args), @@ -1058,7 +1058,7 @@ func (t CommitteeVerifier) CrossChainVerifierGetFee(contractID string, args exte // CrossChainVerifierGetFeeWithPackageID exercises the CrossChainVerifier_GetFee choice using the provided package ID instead of package name func (t CommitteeVerifier) CrossChainVerifierGetFeeWithPackageID(contractID string, packageID string, args extensionapi.CrossChainVerifierGetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "ICrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "ICrossChainVerifier"), ContractID: contractID, Choice: "CrossChainVerifier_GetFee", Arguments: argsToMap(args), @@ -1069,7 +1069,7 @@ func (t CommitteeVerifier) CrossChainVerifierGetFeeWithPackageID(contractID stri // This method uses the package name in the template ID func (t CommitteeVerifier) CrossChainVerifierForwardToVerifier(contractID string, args extensionapi.CrossChainVerifierForwardToVerifier) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifier", "ICrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CommitteeVerifierV1", "ICrossChainVerifier"), ContractID: contractID, Choice: "CrossChainVerifier_ForwardToVerifier", Arguments: argsToMap(args), @@ -1079,7 +1079,7 @@ func (t CommitteeVerifier) CrossChainVerifierForwardToVerifier(contractID string // CrossChainVerifierForwardToVerifierWithPackageID exercises the CrossChainVerifier_ForwardToVerifier choice using the provided package ID instead of package name func (t CommitteeVerifier) CrossChainVerifierForwardToVerifierWithPackageID(contractID string, packageID string, args extensionapi.CrossChainVerifierForwardToVerifier) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifier", "ICrossChainVerifier"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CommitteeVerifierV1", "ICrossChainVerifier"), ContractID: contractID, Choice: "CrossChainVerifier_ForwardToVerifier", Arguments: argsToMap(args), @@ -1186,7 +1186,7 @@ func (t *DynamicConfig) UnmarshalHex(data string) error { // ForwardToVerifier is a Record type type ForwardToVerifier struct { RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` VerifierArgs types.TEXT `json:"verifierArgs"` Caller types.PARTY `json:"caller"` @@ -1198,7 +1198,7 @@ func (t ForwardToVerifier) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) @@ -1234,7 +1234,7 @@ func (t *ForwardToVerifier) UnmarshalHex(data string) error { // ForwardToVerifierMCMSParams is ForwardToVerifier without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type ForwardToVerifierMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` VerifierArgs types.TEXT `json:"verifierArgs"` } @@ -1252,8 +1252,9 @@ func (t *ForwardToVerifierMCMSParams) UnmarshalHex(data string) error { // GetFee is a Record type type GetFee struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - Caller types.PARTY `json:"caller"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetFee to a map for DAML arguments @@ -1262,6 +1263,8 @@ func (t GetFee) ToMap() map[string]any { m["destChainSelector"] = t.DestChainSelector + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1292,7 +1295,8 @@ func (t *GetFee) UnmarshalHex(data string) error { // GetFeeMCMSParams is GetFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetFeeMCMSParams struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetFeeMCMSParams to hex string for MCMS operationData. @@ -1770,7 +1774,7 @@ func (t *UpdateStorageLocationsParams) UnmarshalHex(data string) error { // VerifyMessage is a Record type type VerifyMessage struct { RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` VerifierResults types.TEXT `json:"verifierResults"` Caller types.PARTY `json:"caller"` @@ -1782,7 +1786,7 @@ func (t VerifyMessage) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) @@ -1818,7 +1822,7 @@ func (t *VerifyMessage) UnmarshalHex(data string) error { // VerifyMessageMCMSParams is VerifyMessage without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type VerifyMessageMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` VerifierResults types.TEXT `json:"verifierResults"` } diff --git a/bindings/generated/latest/ccip/core/core.go b/bindings/generated/latest/ccip/core/core.go index 25df4f60d..e8403b060 100644 --- a/bindings/generated/latest/ccip/core/core.go +++ b/bindings/generated/latest/ccip/core/core.go @@ -6,9 +6,13 @@ import ( "math/big" "strings" + ccipapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipapi" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" + events "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" api "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/mcms/api" splice_api_token_holding_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" + splice_api_token_metadata_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" "github.com/smartcontractkit/go-daml/pkg/bind" "github.com/smartcontractkit/go-daml/pkg/codec" "github.com/smartcontractkit/go-daml/pkg/model" @@ -26,7 +30,7 @@ var ( const ( PackageName = "ccip-core" - PackageID = "3c0d1879db1609b9905505a25500909a49f47918d7b4b121115f45a010e612f1" + PackageID = "081dbadff19668a3aa11943f97e460bc47cda717b4e63daaf6d061bfa5f2cb2d" SDKVersion = "3.4.11" ) @@ -36,28 +40,7 @@ type Template interface { } const ( - TokenConfigKey = types.TEXT("token-config") - TokenAdminRegistryKey = types.TEXT("token-admin-registry") - GlobalCurseSubject = types.TEXT("01000000000000000000000000000001") - UsdPerUsdCent = types.NUMERIC("100000000.") - PremiumIdentity = types.NUMERIC("10000000000.") - MinTokenDecimals = types.INT64(0) - MaxTokenDecimals = types.INT64(37) - E10PerPercent = types.NUMERIC("100000000.") - BaseNumeric = types.NUMERIC("100000000.") - BaseInt = types.INT64(100000000) - MaxUint256DecimalText = types.TEXT("115792089237316195423570985008687907853269984665640564039457584007913129639935") - MaxNumeric0DecimalText = types.TEXT("99999999999999999999999999999999999999") - RmnRemoteKey = types.TEXT("rmn-remote") - FeeQuoterKey = types.TEXT("fee-quoter") - WaitForFinalityFlag = types.TEXT("00000000") - MinBlockDepth = types.INT64(1) - MaxBlockDepth = types.INT64(65535) - FinalityConfigByteLength = types.INT64(4) - MaxNumeric0IntegerText = types.TEXT("99999999999999999999999999999999999999") - GlobalConfigKey = types.TEXT("global-config") - MaxCCVsPerMessage = types.INT64(255) - RateLimiterKey = types.TEXT("rate-limiter") + GlobalCurseSubject = types.TEXT("01000000000000000000000000000001") ) func argsToMap(args any) map[string]any { @@ -117,9 +100,10 @@ func (t *AcceptAdminParams) UnmarshalHex(data string) error { // AcceptAdminRole is a Record type type AcceptAdminRole struct { - TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - Caller types.PARTY `json:"caller"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts AcceptAdminRole to a map for DAML arguments @@ -130,6 +114,8 @@ func (t AcceptAdminRole) ToMap() map[string]any { m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -159,11 +145,12 @@ func (t *AcceptAdminRole) UnmarshalHex(data string) error { // AddCCVFee is a Record type type AddCCVFee struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` - DestGasLimit types.INT64 `json:"destGasLimit"` - DestBytesOverhead types.INT64 `json:"destBytesOverhead"` - Caller types.PARTY `json:"caller"` + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + DestGasLimit types.INT64 `json:"destGasLimit"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts AddCCVFee to a map for DAML arguments @@ -178,6 +165,8 @@ func (t AddCCVFee) ToMap() map[string]any { m["destBytesOverhead"] = int64(t.DestBytesOverhead) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -208,10 +197,11 @@ func (t *AddCCVFee) UnmarshalHex(data string) error { // AddCCVFeeMCMSParams is AddCCVFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type AddCCVFeeMCMSParams struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` - DestGasLimit types.INT64 `json:"destGasLimit"` - DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + DestGasLimit types.INT64 `json:"destGasLimit"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes AddCCVFeeMCMSParams to hex string for MCMS operationData. @@ -228,9 +218,10 @@ func (t *AddCCVFeeMCMSParams) UnmarshalHex(data string) error { // AddCCVVerification is a Record type type AddCCVVerification struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - VersionTag types.TEXT `json:"versionTag" hex:"bytes"` - Caller types.PARTY `json:"caller"` + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + VersionTag types.TEXT `json:"versionTag" hex:"bytes"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts AddCCVVerification to a map for DAML arguments @@ -241,6 +232,8 @@ func (t AddCCVVerification) ToMap() map[string]any { m["versionTag"] = string(t.VersionTag) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -271,8 +264,9 @@ func (t *AddCCVVerification) UnmarshalHex(data string) error { // AddCCVVerificationMCMSParams is AddCCVVerification without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type AddCCVVerificationMCMSParams struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - VersionTag types.TEXT `json:"versionTag" hex:"bytes"` + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + VersionTag types.TEXT `json:"versionTag" hex:"bytes"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes AddCCVVerificationMCMSParams to hex string for MCMS operationData. @@ -373,10 +367,11 @@ func (t *AddCustomObserversParams) UnmarshalHex(data string) error { // AddExecutorFee is a Record type type AddExecutorFee struct { - ExecutorInstanceId types.TEXT `json:"executorInstanceId"` - ExecutorArgs types.TEXT `json:"executorArgs"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` - Caller types.PARTY `json:"caller"` + ExecutorInstanceId types.TEXT `json:"executorInstanceId"` + ExecutorArgs types.TEXT `json:"executorArgs"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts AddExecutorFee to a map for DAML arguments @@ -389,6 +384,8 @@ func (t AddExecutorFee) ToMap() map[string]any { m["feeUSDCents"] = t.FeeUSDCents + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -419,9 +416,10 @@ func (t *AddExecutorFee) UnmarshalHex(data string) error { // AddExecutorFeeMCMSParams is AddExecutorFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type AddExecutorFeeMCMSParams struct { - ExecutorInstanceId types.TEXT `json:"executorInstanceId"` - ExecutorArgs types.TEXT `json:"executorArgs"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + ExecutorInstanceId types.TEXT `json:"executorInstanceId"` + ExecutorArgs types.TEXT `json:"executorArgs"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes AddExecutorFeeMCMSParams to hex string for MCMS operationData. @@ -480,21 +478,25 @@ func (t *AddPriceUpdaters) UnmarshalHex(data string) error { // AddTokenSend is a Record type type AddTokenSend struct { - PoolInstanceId types.TEXT `json:"poolInstanceId"` - PoolOwner types.PARTY `json:"poolOwner"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - Amount types.TEXT `json:"amount"` - DestTokenAddress types.TEXT `json:"destTokenAddress"` - ExtraData types.TEXT `json:"extraData"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Amount types.TEXT `json:"amount"` + DestTokenAddress types.TEXT `json:"destTokenAddress"` + ExtraData types.TEXT `json:"extraData"` + Caller types.PARTY `json:"caller"` } // ToMap converts AddTokenSend to a map for DAML arguments func (t AddTokenSend) ToMap() map[string]any { m := make(map[string]any) - m["poolInstanceId"] = string(t.PoolInstanceId) + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["poolOwner"] = t.PoolOwner.ToMap() + m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + + m["poolInstanceId"] = string(t.PoolInstanceId) m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) @@ -504,6 +506,8 @@ func (t AddTokenSend) ToMap() map[string]any { m["extraData"] = string(t.ExtraData) + m["caller"] = t.Caller.ToMap() + return m } @@ -529,22 +533,48 @@ func (t *AddTokenSend) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } +// AddTokenSendMCMSParams is AddTokenSend without the Caller field for MCMS operationData encoding. +// ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. +type AddTokenSendMCMSParams struct { + PoolInstanceId types.TEXT `json:"poolInstanceId"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Amount types.TEXT `json:"amount"` + DestTokenAddress types.TEXT `json:"destTokenAddress"` + ExtraData types.TEXT `json:"extraData"` +} + +// MarshalHex encodes AddTokenSendMCMSParams to hex string for MCMS operationData. +func (t AddTokenSendMCMSParams) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes AddTokenSendMCMSParams from hex string. +func (t *AddTokenSendMCMSParams) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + // AddTokenSendFee is a Record type type AddTokenSendFee struct { - PoolInstanceId types.TEXT `json:"poolInstanceId"` - PoolOwner types.PARTY `json:"poolOwner"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` - DestGasOverhead types.INT64 `json:"destGasOverhead"` - DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + DestGasOverhead types.INT64 `json:"destGasOverhead"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + Caller types.PARTY `json:"caller"` } // ToMap converts AddTokenSendFee to a map for DAML arguments func (t AddTokenSendFee) ToMap() map[string]any { m := make(map[string]any) - m["poolInstanceId"] = string(t.PoolInstanceId) + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["poolOwner"] = t.PoolOwner.ToMap() + m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + + m["poolInstanceId"] = string(t.PoolInstanceId) m["feeUSDCents"] = t.FeeUSDCents @@ -552,6 +582,8 @@ func (t AddTokenSendFee) ToMap() map[string]any { m["destBytesOverhead"] = int64(t.DestBytesOverhead) + m["caller"] = t.Caller.ToMap() + return m } @@ -577,13 +609,35 @@ func (t *AddTokenSendFee) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } +// AddTokenSendFeeMCMSParams is AddTokenSendFee without the Caller field for MCMS operationData encoding. +// ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. +type AddTokenSendFeeMCMSParams struct { + PoolInstanceId types.TEXT `json:"poolInstanceId"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + DestGasOverhead types.INT64 `json:"destGasOverhead"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` +} + +// MarshalHex encodes AddTokenSendFeeMCMSParams to hex string for MCMS operationData. +func (t AddTokenSendFeeMCMSParams) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes AddTokenSendFeeMCMSParams from hex string. +func (t *AddTokenSendFeeMCMSParams) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + // AddVerifierData is a Record type type AddVerifierData struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - VersionTag types.TEXT `json:"versionTag" hex:"bytes"` - VerifierBlob types.TEXT `json:"verifierBlob"` - MessageSentObservers []types.PARTY `json:"messageSentObservers"` - Caller types.PARTY `json:"caller"` + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + VersionTag types.TEXT `json:"versionTag" hex:"bytes"` + VerifierBlob types.TEXT `json:"verifierBlob"` + MessageSentObservers []types.PARTY `json:"messageSentObservers"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts AddVerifierData to a map for DAML arguments @@ -604,6 +658,8 @@ func (t AddVerifierData) ToMap() map[string]any { return res }() + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -634,10 +690,11 @@ func (t *AddVerifierData) UnmarshalHex(data string) error { // AddVerifierDataMCMSParams is AddVerifierData without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type AddVerifierDataMCMSParams struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - VersionTag types.TEXT `json:"versionTag" hex:"bytes"` - VerifierBlob types.TEXT `json:"verifierBlob"` - MessageSentObservers []types.PARTY `json:"messageSentObservers"` + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + VersionTag types.TEXT `json:"versionTag" hex:"bytes"` + VerifierBlob types.TEXT `json:"verifierBlob"` + MessageSentObservers []types.PARTY `json:"messageSentObservers"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes AddVerifierDataMCMSParams to hex string for MCMS operationData. @@ -1008,14 +1065,14 @@ func (t *ApplySourceChainConfigUpdatesParams) UnmarshalHex(data string) error { // BuildMessage is a Record type type BuildMessage struct { - Caller types.PARTY `json:"caller"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts BuildMessage to a map for DAML arguments func (t BuildMessage) ToMap() map[string]any { m := make(map[string]any) - m["caller"] = t.Caller.ToMap() + m["context"] = model.NestedToDAMLValue(t.Context) return m } @@ -1042,392 +1099,139 @@ func (t *BuildMessage) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// BuildMessageMCMSParams is BuildMessage without the Caller field for MCMS operationData encoding. -// ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. -type BuildMessageMCMSParams struct { -} - -// MarshalHex encodes BuildMessageMCMSParams to hex string for MCMS operationData. -func (t BuildMessageMCMSParams) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes BuildMessageMCMSParams from hex string. -func (t *BuildMessageMCMSParams) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// CCIPMessageSent is a Template type -type CCIPMessageSent struct { - CcipOwner types.PARTY `json:"ccipOwner"` - CcvOwners []types.PARTY `json:"ccvOwners"` - Sender types.PARTY `json:"sender"` - Observers []types.PARTY `json:"observers"` - Event CCIPMessageSentEvent `json:"event"` -} - -// GetTemplateID returns the template ID for this template using the package name -func (t CCIPMessageSent) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Events", "CCIPMessageSent") -} - -// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name -func (t CCIPMessageSent) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Events", "CCIPMessageSent") -} - -// CreateCommand returns a CreateCommand for this template using the package name -func (t CCIPMessageSent) CreateCommand() *model.CreateCommand { - args := make(map[string]any) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccipOwner"] = t.CcipOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccvOwners"] = func() []any { - res := make([]any, 0, len(t.CcvOwners)) - for _, e := range t.CcvOwners { - res = append(res, e.ToMap()) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["sender"] = t.Sender.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["observers"] = func() []any { - res := make([]any, 0, len(t.Observers)) - for _, e := range t.Observers { - res = append(res, e.ToMap()) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["event"] = model.NestedToDAMLValue(t.Event) - - return &model.CreateCommand{ - TemplateID: t.GetTemplateID(), - Arguments: args, - } +// CCVFee is a Record type +type CCVFee struct { + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + CcvOwner types.PARTY `json:"ccvOwner"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + DestGasLimit types.INT64 `json:"destGasLimit"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` } -// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name -func (t CCIPMessageSent) CreateCommandWithPackageID(packageID string) *model.CreateCommand { - args := make(map[string]any) +// ToMap converts CCVFee to a map for DAML arguments +func (t CCVFee) ToMap() map[string]any { + m := make(map[string]any) - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccipOwner"] = t.CcipOwner.ToMap() + m["ccvInstanceId"] = string(t.CcvInstanceId) - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccvOwners"] = func() []any { - res := make([]any, 0, len(t.CcvOwners)) - for _, e := range t.CcvOwners { - res = append(res, e.ToMap()) - } - return res - }() + m["ccvOwner"] = t.CcvOwner.ToMap() - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["sender"] = t.Sender.ToMap() + m["feeUSDCents"] = t.FeeUSDCents - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["observers"] = func() []any { - res := make([]any, 0, len(t.Observers)) - for _, e := range t.Observers { - res = append(res, e.ToMap()) - } - return res - }() + m["destGasLimit"] = int64(t.DestGasLimit) - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["event"] = model.NestedToDAMLValue(t.Event) + m["destBytesOverhead"] = int64(t.DestBytesOverhead) - return &model.CreateCommand{ - TemplateID: t.GetTemplateIDWithPackageID(packageID), - Arguments: args, - } + return m } -func (t CCIPMessageSent) MarshalJSON() ([]byte, error) { +func (t CCVFee) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *CCIPMessageSent) UnmarshalJSON(data []byte) error { +func (t *CCVFee) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes CCIPMessageSent to hex string (Canton MCMS format) -func (t CCIPMessageSent) MarshalHex() (string, error) { +// MarshalHex encodes CCVFee to hex string (Canton MCMS format) +func (t CCVFee) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes CCIPMessageSent from hex string (Canton MCMS format) -func (t *CCIPMessageSent) UnmarshalHex(data string) error { +// UnmarshalHex decodes CCVFee from hex string (Canton MCMS format) +func (t *CCVFee) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } -// Choice methods for CCIPMessageSent - -// Archive exercises the Archive choice on this CCIPMessageSent contract -// This method uses the package name in the template ID -func (t CCIPMessageSent) Archive(contractID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Events", "CCIPMessageSent"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name -func (t CCIPMessageSent) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Events", "CCIPMessageSent"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// CCIPMessageSentEvent is a Record type -type CCIPMessageSentEvent struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - SequenceNumber types.NUMERIC `json:"sequenceNumber"` - MessageId types.TEXT `json:"messageId"` - EncodedMessage types.TEXT `json:"encodedMessage"` - VerifierBlobs []types.TEXT `json:"verifierBlobs"` - Receipts []Receipt `json:"receipts"` +// CCVVerification is a Record type +type CCVVerification struct { + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + CcvOwner types.PARTY `json:"ccvOwner"` + VersionTag types.TEXT `json:"versionTag" hex:"bytes"` } -// ToMap converts CCIPMessageSentEvent to a map for DAML arguments -func (t CCIPMessageSentEvent) ToMap() map[string]any { +// ToMap converts CCVVerification to a map for DAML arguments +func (t CCVVerification) ToMap() map[string]any { m := make(map[string]any) - m["destChainSelector"] = t.DestChainSelector - - m["sequenceNumber"] = t.SequenceNumber - - m["messageId"] = string(t.MessageId) - - m["encodedMessage"] = string(t.EncodedMessage) + m["ccvInstanceId"] = string(t.CcvInstanceId) - m["verifierBlobs"] = func() []any { - res := make([]any, 0, len(t.VerifierBlobs)) - for _, e := range t.VerifierBlobs { - res = append(res, string(e)) - } - return res - }() + m["ccvOwner"] = t.CcvOwner.ToMap() - m["receipts"] = func() []any { - res := make([]any, 0, len(t.Receipts)) - for _, e := range t.Receipts { - res = append(res, model.NestedToDAMLValue(e)) - } - return res - }() + m["versionTag"] = string(t.VersionTag) return m } -func (t CCIPMessageSentEvent) MarshalJSON() ([]byte, error) { +func (t CCVVerification) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *CCIPMessageSentEvent) UnmarshalJSON(data []byte) error { +func (t *CCVVerification) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes CCIPMessageSentEvent to hex string (Canton MCMS format) -func (t CCIPMessageSentEvent) MarshalHex() (string, error) { +// MarshalHex encodes CCVVerification to hex string (Canton MCMS format) +func (t CCVVerification) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes CCIPMessageSentEvent from hex string (Canton MCMS format) -func (t *CCIPMessageSentEvent) UnmarshalHex(data string) error { +// UnmarshalHex decodes CCVVerification from hex string (Canton MCMS format) +func (t *CCVVerification) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } -// CCVExtraArg is a Record type -type CCVExtraArg struct { - CcvAddress chainlinkapi.RawInstanceAddress `json:"ccvAddress"` - CcvArgs types.TEXT `json:"ccvArgs"` +// CancelExecute is a Record type +type CancelExecute struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } -// ToMap converts CCVExtraArg to a map for DAML arguments -func (t CCVExtraArg) ToMap() map[string]any { +// ToMap converts CancelExecute to a map for DAML arguments +func (t CancelExecute) ToMap() map[string]any { m := make(map[string]any) - m["ccvAddress"] = model.NestedToDAMLValue(t.CcvAddress) + m["context"] = model.NestedToDAMLValue(t.Context) - m["ccvArgs"] = string(t.CcvArgs) + m["caller"] = t.Caller.ToMap() return m } -func (t CCVExtraArg) MarshalJSON() ([]byte, error) { +func (t CancelExecute) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *CCVExtraArg) UnmarshalJSON(data []byte) error { +func (t *CancelExecute) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes CCVExtraArg to hex string (Canton MCMS format) -func (t CCVExtraArg) MarshalHex() (string, error) { +// MarshalHex encodes CancelExecute to hex string (Canton MCMS format) +func (t CancelExecute) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes CCVExtraArg from hex string (Canton MCMS format) -func (t *CCVExtraArg) UnmarshalHex(data string) error { +// UnmarshalHex decodes CancelExecute from hex string (Canton MCMS format) +func (t *CancelExecute) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } -// CCVFee is a Record type -type CCVFee struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - CcvOwner types.PARTY `json:"ccvOwner"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` - DestGasLimit types.INT64 `json:"destGasLimit"` - DestBytesOverhead types.INT64 `json:"destBytesOverhead"` -} - -// ToMap converts CCVFee to a map for DAML arguments -func (t CCVFee) ToMap() map[string]any { - m := make(map[string]any) - - m["ccvInstanceId"] = string(t.CcvInstanceId) - - m["ccvOwner"] = t.CcvOwner.ToMap() - - m["feeUSDCents"] = t.FeeUSDCents - - m["destGasLimit"] = int64(t.DestGasLimit) - - m["destBytesOverhead"] = int64(t.DestBytesOverhead) - - return m -} - -func (t CCVFee) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *CCVFee) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes CCVFee to hex string (Canton MCMS format) -func (t CCVFee) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes CCVFee from hex string (Canton MCMS format) -func (t *CCVFee) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// CCVVerification is a Record type -type CCVVerification struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - CcvOwner types.PARTY `json:"ccvOwner"` - VersionTag types.TEXT `json:"versionTag" hex:"bytes"` -} - -// ToMap converts CCVVerification to a map for DAML arguments -func (t CCVVerification) ToMap() map[string]any { - m := make(map[string]any) - - m["ccvInstanceId"] = string(t.CcvInstanceId) - - m["ccvOwner"] = t.CcvOwner.ToMap() - - m["versionTag"] = string(t.VersionTag) - - return m -} - -func (t CCVVerification) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *CCVVerification) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes CCVVerification to hex string (Canton MCMS format) -func (t CCVVerification) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes CCVVerification from hex string (Canton MCMS format) -func (t *CCVVerification) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// CancelExecute is a Record type -type CancelExecute struct { - Caller types.PARTY `json:"caller"` -} - -// ToMap converts CancelExecute to a map for DAML arguments -func (t CancelExecute) ToMap() map[string]any { - m := make(map[string]any) - - m["caller"] = t.Caller.ToMap() - - return m -} - -func (t CancelExecute) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *CancelExecute) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes CancelExecute to hex string (Canton MCMS format) -func (t CancelExecute) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes CancelExecute from hex string (Canton MCMS format) -func (t *CancelExecute) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// CancelExecuteMCMSParams is CancelExecute without the Caller field for MCMS operationData encoding. -// ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. -type CancelExecuteMCMSParams struct { +// CancelExecuteMCMSParams is CancelExecute without the Caller field for MCMS operationData encoding. +// ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. +type CancelExecuteMCMSParams struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes CancelExecuteMCMSParams to hex string for MCMS operationData. @@ -1442,181 +1246,13 @@ func (t *CancelExecuteMCMSParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// Canton2AnyMessage is a Record type -type Canton2AnyMessage struct { - Receiver types.TEXT `json:"receiver"` - Payload types.TEXT `json:"payload"` - TokenTransfer *TokenTransfer `json:"tokenTransfer" hex:"optional"` - FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` - ExtraArgs ExtraArgs `json:"extraArgs"` -} - -// ToMap converts Canton2AnyMessage to a map for DAML arguments -func (t Canton2AnyMessage) ToMap() map[string]any { - m := make(map[string]any) - - m["receiver"] = string(t.Receiver) - - m["payload"] = string(t.Payload) - - if t.TokenTransfer != nil { - m["tokenTransfer"] = map[string]any{ - "_type": "optional", - "value": model.NestedToDAMLValue(*t.TokenTransfer), - } - } else { - m["tokenTransfer"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } - - m["feeToken"] = model.NestedToDAMLValue(t.FeeToken) - - m["extraArgs"] = model.NestedToDAMLValue(t.ExtraArgs) - - return m -} - -func (t Canton2AnyMessage) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *Canton2AnyMessage) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes Canton2AnyMessage to hex string (Canton MCMS format) -func (t Canton2AnyMessage) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes Canton2AnyMessage from hex string (Canton MCMS format) -func (t *Canton2AnyMessage) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// Consume is a Record type -type Consume struct { -} - -// ToMap converts Consume to a map for DAML arguments -func (t Consume) ToMap() map[string]any { - m := make(map[string]any) - return m -} - -func (t Consume) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *Consume) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes Consume to hex string (Canton MCMS format) -func (t Consume) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes Consume from hex string (Canton MCMS format) -func (t *Consume) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// ConsumeCapacity is a Record type -type ConsumeCapacity struct { - Requested types.NUMERIC `json:"requested"` -} - -// ToMap converts ConsumeCapacity to a map for DAML arguments -func (t ConsumeCapacity) ToMap() map[string]any { - m := make(map[string]any) - - m["requested"] = t.Requested - - return m -} - -func (t ConsumeCapacity) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *ConsumeCapacity) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes ConsumeCapacity to hex string (Canton MCMS format) -func (t ConsumeCapacity) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes ConsumeCapacity from hex string (Canton MCMS format) -func (t *ConsumeCapacity) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// ConsumeCapacityResult is a Record type -type ConsumeCapacityResult struct { - RateLimiterCid types.CONTRACT_ID `json:"rateLimiterCid"` - AvailableBeforeConsume types.NUMERIC `json:"availableBeforeConsume"` - Consumed types.NUMERIC `json:"consumed"` -} - -// ToMap converts ConsumeCapacityResult to a map for DAML arguments -func (t ConsumeCapacityResult) ToMap() map[string]any { - m := make(map[string]any) - - m["rateLimiterCid"] = model.NestedToDAMLValue(t.RateLimiterCid) - - m["availableBeforeConsume"] = t.AvailableBeforeConsume - - m["consumed"] = t.Consumed - - return m -} - -func (t ConsumeCapacityResult) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *ConsumeCapacityResult) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes ConsumeCapacityResult to hex string (Canton MCMS format) -func (t ConsumeCapacityResult) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes ConsumeCapacityResult from hex string (Canton MCMS format) -func (t *ConsumeCapacityResult) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - // ConsumeReceiveTicket is a Record type type ConsumeReceiveTicket struct { - TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - TicketCid types.CONTRACT_ID `json:"ticketCid"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - PoolInstanceId types.TEXT `json:"poolInstanceId"` - Caller types.PARTY `json:"caller"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + TokenReceiveTicketCid types.CONTRACT_ID `json:"tokenReceiveTicketCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + Caller types.PARTY `json:"caller"` } // ToMap converts ConsumeReceiveTicket to a map for DAML arguments @@ -1625,7 +1261,7 @@ func (t ConsumeReceiveTicket) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["ticketCid"] = model.NestedToDAMLValue(t.TicketCid) + m["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) @@ -1937,72 +1573,33 @@ func (t *CurseParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// DecodedFinality is a Record type -type DecodedFinality struct { - Raw types.TEXT `json:"raw"` - Requested FinalityConfig `json:"requested"` +// DestChainConfig2 is a Record type +type DestChainConfig2 struct { + IsEnabled types.BOOL `json:"isEnabled"` + AddressBytesLength types.INT64 `json:"addressBytesLength"` + TokenReceiverAllowed types.BOOL `json:"tokenReceiverAllowed"` + BaseExecutionGasCost types.INT64 `json:"baseExecutionGasCost"` + OffRampAddress types.TEXT `json:"offRampAddress" hex:"bytes"` + DefaultExecutor *chainlinkapi.RawInstanceAddress `json:"defaultExecutor" hex:"optional"` + LaneMandatedCCVs []chainlinkapi.RawInstanceAddress `json:"laneMandatedCCVs"` + DefaultCCVs []chainlinkapi.RawInstanceAddress `json:"defaultCCVs"` + MessageNetworkFeeUSDCents types.NUMERIC `json:"messageNetworkFeeUSDCents"` + TokenNetworkFeeUSDCents types.NUMERIC `json:"tokenNetworkFeeUSDCents"` } -// ToMap converts DecodedFinality to a map for DAML arguments -func (t DecodedFinality) ToMap() map[string]any { +// ToMap converts DestChainConfig2 to a map for DAML arguments +func (t DestChainConfig2) ToMap() map[string]any { m := make(map[string]any) - m["raw"] = string(t.Raw) + m["isEnabled"] = bool(t.IsEnabled) - m["requested"] = model.NestedToDAMLValue(t.Requested) + m["addressBytesLength"] = int64(t.AddressBytesLength) - return m -} + m["tokenReceiverAllowed"] = bool(t.TokenReceiverAllowed) -func (t DecodedFinality) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} + m["baseExecutionGasCost"] = int64(t.BaseExecutionGasCost) -func (t *DecodedFinality) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes DecodedFinality to hex string (Canton MCMS format) -func (t DecodedFinality) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes DecodedFinality from hex string (Canton MCMS format) -func (t *DecodedFinality) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// DestChainConfig is a Record type -type DestChainConfig struct { - IsEnabled types.BOOL `json:"isEnabled"` - AddressBytesLength types.INT64 `json:"addressBytesLength"` - TokenReceiverAllowed types.BOOL `json:"tokenReceiverAllowed"` - BaseExecutionGasCost types.INT64 `json:"baseExecutionGasCost"` - OffRampAddress types.TEXT `json:"offRampAddress" hex:"bytes"` - DefaultExecutor *chainlinkapi.RawInstanceAddress `json:"defaultExecutor" hex:"optional"` - LaneMandatedCCVs []chainlinkapi.RawInstanceAddress `json:"laneMandatedCCVs"` - DefaultCCVs []chainlinkapi.RawInstanceAddress `json:"defaultCCVs"` - MessageNetworkFeeUSDCents types.NUMERIC `json:"messageNetworkFeeUSDCents"` - TokenNetworkFeeUSDCents types.NUMERIC `json:"tokenNetworkFeeUSDCents"` -} - -// ToMap converts DestChainConfig to a map for DAML arguments -func (t DestChainConfig) ToMap() map[string]any { - m := make(map[string]any) - - m["isEnabled"] = bool(t.IsEnabled) - - m["addressBytesLength"] = int64(t.AddressBytesLength) - - m["tokenReceiverAllowed"] = bool(t.TokenReceiverAllowed) - - m["baseExecutionGasCost"] = int64(t.BaseExecutionGasCost) - - m["offRampAddress"] = string(t.OffRampAddress) + m["offRampAddress"] = string(t.OffRampAddress) if t.DefaultExecutor != nil { m["defaultExecutor"] = map[string]any{ @@ -2039,24 +1636,24 @@ func (t DestChainConfig) ToMap() map[string]any { return m } -func (t DestChainConfig) MarshalJSON() ([]byte, error) { +func (t DestChainConfig2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *DestChainConfig) UnmarshalJSON(data []byte) error { +func (t *DestChainConfig2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes DestChainConfig to hex string (Canton MCMS format) -func (t DestChainConfig) MarshalHex() (string, error) { +// MarshalHex encodes DestChainConfig2 to hex string (Canton MCMS format) +func (t DestChainConfig2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes DestChainConfig from hex string (Canton MCMS format) -func (t *DestChainConfig) UnmarshalHex(data string) error { +// UnmarshalHex decodes DestChainConfig2 from hex string (Canton MCMS format) +func (t *DestChainConfig2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -2149,99 +1746,10 @@ func (t *DestChainConfigArgs) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// ExecutingMessageDeps is a Record type -type ExecutingMessageDeps struct { - OffRamp chainlinkapi.RawInstanceAddress `json:"offRamp"` - GlobalConfig chainlinkapi.RawInstanceAddress `json:"globalConfig"` - RmnRemote chainlinkapi.RawInstanceAddress `json:"rmnRemote"` - TokenAdminRegistry chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry"` -} - -// ToMap converts ExecutingMessageDeps to a map for DAML arguments -func (t ExecutingMessageDeps) ToMap() map[string]any { - m := make(map[string]any) - - m["offRamp"] = model.NestedToDAMLValue(t.OffRamp) - - m["globalConfig"] = model.NestedToDAMLValue(t.GlobalConfig) - - m["rmnRemote"] = model.NestedToDAMLValue(t.RmnRemote) - - m["tokenAdminRegistry"] = model.NestedToDAMLValue(t.TokenAdminRegistry) - - return m -} - -func (t ExecutingMessageDeps) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *ExecutingMessageDeps) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes ExecutingMessageDeps to hex string (Canton MCMS format) -func (t ExecutingMessageDeps) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes ExecutingMessageDeps from hex string (Canton MCMS format) -func (t *ExecutingMessageDeps) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// ExecutingMessageState is an enum type -type ExecutingMessageState string - -const ( - ExecutingMessageStateExecutingMessageState_RequirePoolCCVs ExecutingMessageState = "ExecutingMessageState_RequirePoolCCVs" - - ExecutingMessageStateExecutingMessageState_Prepared ExecutingMessageState = "ExecutingMessageState_Prepared" -) - -func (e ExecutingMessageState) GetEnumConstructor() string { return string(e) } - -func (e ExecutingMessageState) GetEnumTypeID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutingMessageV1", "ExecutingMessageState") -} - -// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name -func (e ExecutingMessageState) GetEnumTypeIDWithPackageID(packageID string) string { - return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutingMessageV1", "ExecutingMessageState") -} - -func (e ExecutingMessageState) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(e) -} - -func (e *ExecutingMessageState) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, e) -} - -// MarshalHex encodes ExecutingMessageState to hex string (Canton MCMS format) -func (e ExecutingMessageState) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(e) -} - -// UnmarshalHex decodes ExecutingMessageState from hex string (Canton MCMS format) -func (e *ExecutingMessageState) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, e) -} - -var _ types.ENUM = ExecutingMessageState("") - -// ExecutingMessageV1 is a Template type -type ExecutingMessageV1 struct { +// ExecutingMessage is a Template type +type ExecutingMessage struct { CcipOwner types.PARTY `json:"ccipOwner"` - Message MessageV1 `json:"message"` + Message ccipcodec.MessageV1 `json:"message"` MessageId types.TEXT `json:"messageId"` Receiver types.PARTY `json:"receiver"` TokenReceiver *types.PARTY `json:"tokenReceiver" hex:"optional"` @@ -2252,7 +1760,7 @@ type ExecutingMessageV1 struct { RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` OptionalCCVs []chainlinkapi.RawInstanceAddress `json:"optionalCCVs"` OptionalCCVThreshold types.INT64 `json:"optionalCCVThreshold"` - ReceiverFinalityConfig FinalityConfig `json:"receiverFinalityConfig"` + ReceiverFinalityConfig ccipcodec.FinalityConfig `json:"receiverFinalityConfig"` SourceDefaultCCVs []chainlinkapi.RawInstanceAddress `json:"sourceDefaultCCVs"` InboundPoolVerification *InboundPoolVerification `json:"inboundPoolVerification" hex:"optional"` Deps ExecutingMessageDeps `json:"deps"` @@ -2260,17 +1768,17 @@ type ExecutingMessageV1 struct { } // GetTemplateID returns the template ID for this template using the package name -func (t ExecutingMessageV1) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutingMessageV1", "ExecutingMessageV1") +func (t ExecutingMessage) GetTemplateID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name -func (t ExecutingMessageV1) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.ExecutingMessageV1", "ExecutingMessageV1") +func (t ExecutingMessage) GetTemplateIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage") } // CreateCommand returns a CreateCommand for this template using the package name -func (t ExecutingMessageV1) CreateCommand() *model.CreateCommand { +func (t ExecutingMessage) CreateCommand() *model.CreateCommand { args := make(map[string]any) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty @@ -2386,7 +1894,7 @@ func (t ExecutingMessageV1) CreateCommand() *model.CreateCommand { } // CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name -func (t ExecutingMessageV1) CreateCommandWithPackageID(packageID string) *model.CreateCommand { +func (t ExecutingMessage) CreateCommandWithPackageID(packageID string) *model.CreateCommand { args := make(map[string]any) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty @@ -2501,35 +2009,35 @@ func (t ExecutingMessageV1) CreateCommandWithPackageID(packageID string) *model. } } -func (t ExecutingMessageV1) MarshalJSON() ([]byte, error) { +func (t ExecutingMessage) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *ExecutingMessageV1) UnmarshalJSON(data []byte) error { +func (t *ExecutingMessage) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes ExecutingMessageV1 to hex string (Canton MCMS format) -func (t ExecutingMessageV1) MarshalHex() (string, error) { +// MarshalHex encodes ExecutingMessage to hex string (Canton MCMS format) +func (t ExecutingMessage) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes ExecutingMessageV1 from hex string (Canton MCMS format) -func (t *ExecutingMessageV1) UnmarshalHex(data string) error { +// UnmarshalHex decodes ExecutingMessage from hex string (Canton MCMS format) +func (t *ExecutingMessage) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } -// Choice methods for ExecutingMessageV1 +// Choice methods for ExecutingMessage -// CancelExecute exercises the CancelExecute choice on this ExecutingMessageV1 contract +// CancelExecute exercises the CancelExecute choice on this ExecutingMessage contract // This method uses the package name in the template ID -func (t ExecutingMessageV1) CancelExecute(contractID string, args CancelExecute) *model.ExerciseCommand { +func (t ExecutingMessage) CancelExecute(contractID string, args CancelExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "CancelExecute", Arguments: argsToMap(args), @@ -2537,20 +2045,20 @@ func (t ExecutingMessageV1) CancelExecute(contractID string, args CancelExecute) } // CancelExecuteWithPackageID exercises the CancelExecute choice using the provided package ID instead of package name -func (t ExecutingMessageV1) CancelExecuteWithPackageID(contractID string, packageID string, args CancelExecute) *model.ExerciseCommand { +func (t ExecutingMessage) CancelExecuteWithPackageID(contractID string, packageID string, args CancelExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "CancelExecute", Arguments: argsToMap(args), } } -// AddCCVVerification exercises the AddCCVVerification choice on this ExecutingMessageV1 contract +// AddCCVVerification exercises the AddCCVVerification choice on this ExecutingMessage contract // This method uses the package name in the template ID -func (t ExecutingMessageV1) AddCCVVerification(contractID string, args AddCCVVerification) *model.ExerciseCommand { +func (t ExecutingMessage) AddCCVVerification(contractID string, args AddCCVVerification) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "AddCCVVerification", Arguments: argsToMap(args), @@ -2558,20 +2066,20 @@ func (t ExecutingMessageV1) AddCCVVerification(contractID string, args AddCCVVer } // AddCCVVerificationWithPackageID exercises the AddCCVVerification choice using the provided package ID instead of package name -func (t ExecutingMessageV1) AddCCVVerificationWithPackageID(contractID string, packageID string, args AddCCVVerification) *model.ExerciseCommand { +func (t ExecutingMessage) AddCCVVerificationWithPackageID(contractID string, packageID string, args AddCCVVerification) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "AddCCVVerification", Arguments: argsToMap(args), } } -// SetInboundPoolCCVs exercises the SetInboundPoolCCVs choice on this ExecutingMessageV1 contract +// SetInboundPoolCCVs exercises the SetInboundPoolCCVs choice on this ExecutingMessage contract // This method uses the package name in the template ID -func (t ExecutingMessageV1) SetInboundPoolCCVs(contractID string, args SetInboundPoolCCVs) *model.ExerciseCommand { +func (t ExecutingMessage) SetInboundPoolCCVs(contractID string, args SetInboundPoolCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "SetInboundPoolCCVs", Arguments: argsToMap(args), @@ -2579,20 +2087,20 @@ func (t ExecutingMessageV1) SetInboundPoolCCVs(contractID string, args SetInboun } // SetInboundPoolCCVsWithPackageID exercises the SetInboundPoolCCVs choice using the provided package ID instead of package name -func (t ExecutingMessageV1) SetInboundPoolCCVsWithPackageID(contractID string, packageID string, args SetInboundPoolCCVs) *model.ExerciseCommand { +func (t ExecutingMessage) SetInboundPoolCCVsWithPackageID(contractID string, packageID string, args SetInboundPoolCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "SetInboundPoolCCVs", Arguments: argsToMap(args), } } -// FinalizeExecute exercises the FinalizeExecute choice on this ExecutingMessageV1 contract +// FinalizeExecute exercises the FinalizeExecute choice on this ExecutingMessage contract // This method uses the package name in the template ID -func (t ExecutingMessageV1) FinalizeExecute(contractID string, args FinalizeExecute) *model.ExerciseCommand { +func (t ExecutingMessage) FinalizeExecute(contractID string, args FinalizeExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "FinalizeExecute", Arguments: argsToMap(args), @@ -2600,20 +2108,20 @@ func (t ExecutingMessageV1) FinalizeExecute(contractID string, args FinalizeExec } // FinalizeExecuteWithPackageID exercises the FinalizeExecute choice using the provided package ID instead of package name -func (t ExecutingMessageV1) FinalizeExecuteWithPackageID(contractID string, packageID string, args FinalizeExecute) *model.ExerciseCommand { +func (t ExecutingMessage) FinalizeExecuteWithPackageID(contractID string, packageID string, args FinalizeExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "FinalizeExecute", Arguments: argsToMap(args), } } -// Archive exercises the Archive choice on this ExecutingMessageV1 contract +// Archive exercises the Archive choice on this ExecutingMessage contract via the IIExecutingMessage interface // This method uses the package name in the template ID -func (t ExecutingMessageV1) Archive(contractID string) *model.ExerciseCommand { +func (t ExecutingMessage) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2621,15 +2129,150 @@ func (t ExecutingMessageV1) Archive(contractID string) *model.ExerciseCommand { } // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name -func (t ExecutingMessageV1) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { +func (t ExecutingMessage) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutingMessageV1", "ExecutingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessage"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, } } +// ExecutingMessageCancelExecute exercises the ExecutingMessage_CancelExecute choice on this ExecutingMessage contract via the IIExecutingMessage interface +// This method uses the package name in the template ID +func (t ExecutingMessage) ExecutingMessageCancelExecute(contractID string, args ccipapi.ExecutingMessageCancelExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "IExecutingMessage"), + ContractID: contractID, + Choice: "ExecutingMessage_CancelExecute", + Arguments: argsToMap(args), + } +} + +// ExecutingMessageCancelExecuteWithPackageID exercises the ExecutingMessage_CancelExecute choice using the provided package ID instead of package name +func (t ExecutingMessage) ExecutingMessageCancelExecuteWithPackageID(contractID string, packageID string, args ccipapi.ExecutingMessageCancelExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "IExecutingMessage"), + ContractID: contractID, + Choice: "ExecutingMessage_CancelExecute", + Arguments: argsToMap(args), + } +} + +// ExecutingMessageAddCCVVerification exercises the ExecutingMessage_AddCCVVerification choice on this ExecutingMessage contract via the IIExecutingMessage interface +// This method uses the package name in the template ID +func (t ExecutingMessage) ExecutingMessageAddCCVVerification(contractID string, args ccipapi.ExecutingMessageAddCCVVerification) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "IExecutingMessage"), + ContractID: contractID, + Choice: "ExecutingMessage_AddCCVVerification", + Arguments: argsToMap(args), + } +} + +// ExecutingMessageAddCCVVerificationWithPackageID exercises the ExecutingMessage_AddCCVVerification choice using the provided package ID instead of package name +func (t ExecutingMessage) ExecutingMessageAddCCVVerificationWithPackageID(contractID string, packageID string, args ccipapi.ExecutingMessageAddCCVVerification) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "IExecutingMessage"), + ContractID: contractID, + Choice: "ExecutingMessage_AddCCVVerification", + Arguments: argsToMap(args), + } +} + +// Verify interface implementations for ExecutingMessage + +var _ ccipapi.IIExecutingMessage = (*ExecutingMessage)(nil) + +// ExecutingMessageDeps is a Record type +type ExecutingMessageDeps struct { + OffRamp chainlinkapi.RawInstanceAddress `json:"offRamp"` + GlobalConfig chainlinkapi.RawInstanceAddress `json:"globalConfig"` + RmnRemote chainlinkapi.RawInstanceAddress `json:"rmnRemote"` + TokenAdminRegistry chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry"` +} + +// ToMap converts ExecutingMessageDeps to a map for DAML arguments +func (t ExecutingMessageDeps) ToMap() map[string]any { + m := make(map[string]any) + + m["offRamp"] = model.NestedToDAMLValue(t.OffRamp) + + m["globalConfig"] = model.NestedToDAMLValue(t.GlobalConfig) + + m["rmnRemote"] = model.NestedToDAMLValue(t.RmnRemote) + + m["tokenAdminRegistry"] = model.NestedToDAMLValue(t.TokenAdminRegistry) + + return m +} + +func (t ExecutingMessageDeps) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutingMessageDeps) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutingMessageDeps to hex string (Canton MCMS format) +func (t ExecutingMessageDeps) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutingMessageDeps from hex string (Canton MCMS format) +func (t *ExecutingMessageDeps) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecutingMessageState is an enum type +type ExecutingMessageState string + +const ( + ExecutingMessageStateExecutingMessageState_RequirePoolCCVs ExecutingMessageState = "ExecutingMessageState_RequirePoolCCVs" + + ExecutingMessageStateExecutingMessageState_Prepared ExecutingMessageState = "ExecutingMessageState_Prepared" +) + +func (e ExecutingMessageState) GetEnumConstructor() string { return string(e) } + +func (e ExecutingMessageState) GetEnumTypeID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessageState") +} + +// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name +func (e ExecutingMessageState) GetEnumTypeIDWithPackageID(packageID string) string { + return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.ExecutingMessage", "ExecutingMessageState") +} + +func (e ExecutingMessageState) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(e) +} + +func (e *ExecutingMessageState) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, e) +} + +// MarshalHex encodes ExecutingMessageState to hex string (Canton MCMS format) +func (e ExecutingMessageState) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(e) +} + +// UnmarshalHex decodes ExecutingMessageState from hex string (Canton MCMS format) +func (e *ExecutingMessageState) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, e) +} + +var _ types.ENUM = ExecutingMessageState("") + // ExecutionMode is an enum type type ExecutionMode string @@ -2642,12 +2285,12 @@ const ( func (e ExecutionMode) GetEnumConstructor() string { return string(e) } func (e ExecutionMode) GetEnumTypeID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "ExecutionMode") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "ExecutionMode") } // GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name func (e ExecutionMode) GetEnumTypeIDWithPackageID(packageID string) string { - return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "ExecutionMode") + return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "ExecutionMode") } func (e ExecutionMode) MarshalJSON() ([]byte, error) { @@ -2674,258 +2317,22 @@ func (e *ExecutionMode) UnmarshalHex(data string) error { var _ types.ENUM = ExecutionMode("") -// ExecutionStateChanged is a Template type -type ExecutionStateChanged struct { - CcipOwner types.PARTY `json:"ccipOwner"` - CcvOwners []types.PARTY `json:"ccvOwners"` - Receiver types.PARTY `json:"receiver"` - Event ExecutionStateChangedEvent `json:"event"` +// ExecutorFee is a Record type +type ExecutorFee struct { + ExecutorInstanceId types.TEXT `json:"executorInstanceId"` + ExecutorOwner types.PARTY `json:"executorOwner"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` } -// GetTemplateID returns the template ID for this template using the package name -func (t ExecutionStateChanged) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Events", "ExecutionStateChanged") -} +// ToMap converts ExecutorFee to a map for DAML arguments +func (t ExecutorFee) ToMap() map[string]any { + m := make(map[string]any) -// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name -func (t ExecutionStateChanged) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Events", "ExecutionStateChanged") -} + m["executorInstanceId"] = string(t.ExecutorInstanceId) -// CreateCommand returns a CreateCommand for this template using the package name -func (t ExecutionStateChanged) CreateCommand() *model.CreateCommand { - args := make(map[string]any) + m["executorOwner"] = t.ExecutorOwner.ToMap() - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccipOwner"] = t.CcipOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccvOwners"] = func() []any { - res := make([]any, 0, len(t.CcvOwners)) - for _, e := range t.CcvOwners { - res = append(res, e.ToMap()) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["receiver"] = t.Receiver.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["event"] = model.NestedToDAMLValue(t.Event) - - return &model.CreateCommand{ - TemplateID: t.GetTemplateID(), - Arguments: args, - } -} - -// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name -func (t ExecutionStateChanged) CreateCommandWithPackageID(packageID string) *model.CreateCommand { - args := make(map[string]any) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccipOwner"] = t.CcipOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccvOwners"] = func() []any { - res := make([]any, 0, len(t.CcvOwners)) - for _, e := range t.CcvOwners { - res = append(res, e.ToMap()) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["receiver"] = t.Receiver.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["event"] = model.NestedToDAMLValue(t.Event) - - return &model.CreateCommand{ - TemplateID: t.GetTemplateIDWithPackageID(packageID), - Arguments: args, - } -} - -func (t ExecutionStateChanged) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *ExecutionStateChanged) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes ExecutionStateChanged to hex string (Canton MCMS format) -func (t ExecutionStateChanged) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes ExecutionStateChanged from hex string (Canton MCMS format) -func (t *ExecutionStateChanged) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// Choice methods for ExecutionStateChanged - -// Archive exercises the Archive choice on this ExecutionStateChanged contract -// This method uses the package name in the template ID -func (t ExecutionStateChanged) Archive(contractID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Events", "ExecutionStateChanged"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name -func (t ExecutionStateChanged) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Events", "ExecutionStateChanged"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// ExecutionStateChangedEvent is a Record type -type ExecutionStateChangedEvent struct { - SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` - SequenceNumber types.NUMERIC `json:"sequenceNumber"` - MessageId types.TEXT `json:"messageId"` - State MessageExecutionState `json:"state"` - ReturnData types.TEXT `json:"returnData"` -} - -// ToMap converts ExecutionStateChangedEvent to a map for DAML arguments -func (t ExecutionStateChangedEvent) ToMap() map[string]any { - m := make(map[string]any) - - m["sourceChainSelector"] = t.SourceChainSelector - - m["sequenceNumber"] = t.SequenceNumber - - m["messageId"] = string(t.MessageId) - - m["state"] = model.NestedToDAMLValue(t.State) - - m["returnData"] = string(t.ReturnData) - - return m -} - -func (t ExecutionStateChangedEvent) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *ExecutionStateChangedEvent) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes ExecutionStateChangedEvent to hex string (Canton MCMS format) -func (t ExecutionStateChangedEvent) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes ExecutionStateChangedEvent from hex string (Canton MCMS format) -func (t *ExecutionStateChangedEvent) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// ExecutorExtraArg is a variant/union type -type ExecutorExtraArg struct { - ExecutorNoExecutor *types.UNIT `json:"Executor_NoExecutor,omitempty"` - ExecutorUseDefault *ExecutorUseDefault `json:"Executor_UseDefault,omitempty"` - ExecutorWithAddress *ExecutorWithAddress `json:"Executor_WithAddress,omitempty"` -} - -// MarshalJSON implements custom JSON marshaling for ExecutorExtraArg -func (v ExecutorExtraArg) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(v) -} - -// UnmarshalJSON implements custom JSON unmarshalling for ExecutorExtraArg -func (v *ExecutorExtraArg) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, v) -} - -// MarshalHex encodes ExecutorExtraArg to hex string (Canton MCMS format) -func (v ExecutorExtraArg) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(v) -} - -// UnmarshalHex decodes ExecutorExtraArg from hex string (Canton MCMS format) -func (v *ExecutorExtraArg) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, v) -} - -// GetVariantTag implements types.VARIANT interface -func (v ExecutorExtraArg) GetVariantTag() string { - - if v.ExecutorNoExecutor != nil { - return "Executor_NoExecutor" - } - - if v.ExecutorUseDefault != nil { - return "Executor_UseDefault" - } - - if v.ExecutorWithAddress != nil { - return "Executor_WithAddress" - } - - return "" -} - -// GetVariantValue implements types.VARIANT interface -func (v ExecutorExtraArg) GetVariantValue() any { - - if v.ExecutorNoExecutor != nil { - return v.ExecutorNoExecutor - } - - if v.ExecutorUseDefault != nil { - return v.ExecutorUseDefault - } - - if v.ExecutorWithAddress != nil { - return v.ExecutorWithAddress - } - - return nil -} - -var _ types.VARIANT = (*ExecutorExtraArg)(nil) - -// ExecutorFee is a Record type -type ExecutorFee struct { - ExecutorInstanceId types.TEXT `json:"executorInstanceId"` - ExecutorOwner types.PARTY `json:"executorOwner"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` -} - -// ToMap converts ExecutorFee to a map for DAML arguments -func (t ExecutorFee) ToMap() map[string]any { - m := make(map[string]any) - - m["executorInstanceId"] = string(t.ExecutorInstanceId) - - m["executorOwner"] = t.ExecutorOwner.ToMap() - - m["feeUSDCents"] = t.FeeUSDCents + m["feeUSDCents"] = t.FeeUSDCents return m } @@ -2952,140 +2359,14 @@ func (t *ExecutorFee) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// ExecutorUseDefault is a Record type -type ExecutorUseDefault struct { - ExecutorArgs types.TEXT `json:"executorArgs"` -} - -// ToMap converts ExecutorUseDefault to a map for DAML arguments -func (t ExecutorUseDefault) ToMap() map[string]any { - m := make(map[string]any) - - m["executorArgs"] = string(t.ExecutorArgs) - - return m -} - -func (t ExecutorUseDefault) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *ExecutorUseDefault) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes ExecutorUseDefault to hex string (Canton MCMS format) -func (t ExecutorUseDefault) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes ExecutorUseDefault from hex string (Canton MCMS format) -func (t *ExecutorUseDefault) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// ExecutorWithAddress is a Record type -type ExecutorWithAddress struct { - ExecutorAddress chainlinkapi.RawInstanceAddress `json:"executorAddress"` - ExecutorArgs types.TEXT `json:"executorArgs"` -} - -// ToMap converts ExecutorWithAddress to a map for DAML arguments -func (t ExecutorWithAddress) ToMap() map[string]any { - m := make(map[string]any) - - m["executorAddress"] = model.NestedToDAMLValue(t.ExecutorAddress) - - m["executorArgs"] = string(t.ExecutorArgs) - - return m -} - -func (t ExecutorWithAddress) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *ExecutorWithAddress) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes ExecutorWithAddress to hex string (Canton MCMS format) -func (t ExecutorWithAddress) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes ExecutorWithAddress from hex string (Canton MCMS format) -func (t *ExecutorWithAddress) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// ExtraArgs is a variant/union type -type ExtraArgs struct { - V3 *GenericExtraArgsV3 `json:"V3,omitempty"` -} - -// MarshalJSON implements custom JSON marshaling for ExtraArgs -func (v ExtraArgs) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(v) -} - -// UnmarshalJSON implements custom JSON unmarshalling for ExtraArgs -func (v *ExtraArgs) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, v) -} - -// MarshalHex encodes ExtraArgs to hex string (Canton MCMS format) -func (v ExtraArgs) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(v) -} - -// UnmarshalHex decodes ExtraArgs from hex string (Canton MCMS format) -func (v *ExtraArgs) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, v) -} - -// GetVariantTag implements types.VARIANT interface -func (v ExtraArgs) GetVariantTag() string { - - if v.V3 != nil { - return "V3" - } - - return "" -} - -// GetVariantValue implements types.VARIANT interface -func (v ExtraArgs) GetVariantValue() any { - - if v.V3 != nil { - return v.V3 - } - - return nil -} - -var _ types.VARIANT = (*ExtraArgs)(nil) - // FeeQuoter is a Template type type FeeQuoter struct { InstanceId types.TEXT `json:"instanceId"` - Owner types.PARTY `json:"owner"` + CcipOwner types.PARTY `json:"ccipOwner"` FeeTokens types.SET `json:"feeTokens"` DestChainConfigs map[types.NUMERIC]FeeQuoterDestChainConfig `json:"destChainConfigs"` TokenTransferFeeConfigs map[types.NUMERIC]types.GENMAP `json:"tokenTransferFeeConfigs"` - UsdPerUnitGasByDestChainSelector map[types.NUMERIC]TimestampedPrice `json:"usdPerUnitGasByDestChainSelector"` + UsdPerUnitGasByDestChainSelector map[types.NUMERIC]TimestampedPrice2 `json:"usdPerUnitGasByDestChainSelector"` UsdPerToken types.GENMAP `json:"usdPerToken"` LinkTokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"linkTokenInstrumentId"` PriceUpdaters []types.PARTY `json:"priceUpdaters"` @@ -3093,12 +2374,12 @@ type FeeQuoter struct { // GetTemplateID returns the template ID for this template using the package name func (t FeeQuoter) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t FeeQuoter) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter") } // CreateCommand returns a CreateCommand for this template using the package name @@ -3109,7 +2390,7 @@ func (t FeeQuoter) CreateCommand() *model.CreateCommand { args["instanceId"] = string(t.InstanceId) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["owner"] = t.Owner.ToMap() + args["ccipOwner"] = t.CcipOwner.ToMap() // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty args["feeTokens"] = model.NestedToDAMLValue(t.FeeTokens) @@ -3172,7 +2453,7 @@ func (t FeeQuoter) CreateCommandWithPackageID(packageID string) *model.CreateCom args["instanceId"] = string(t.InstanceId) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["owner"] = t.Owner.ToMap() + args["ccipOwner"] = t.CcipOwner.ToMap() // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty args["feeTokens"] = model.NestedToDAMLValue(t.FeeTokens) @@ -3255,7 +2536,7 @@ func (t *FeeQuoter) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t FeeQuoter) QuoteGasForExec(contractID string, args QuoteGasForExec) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "QuoteGasForExec", Arguments: argsToMap(args), @@ -3265,7 +2546,7 @@ func (t FeeQuoter) QuoteGasForExec(contractID string, args QuoteGasForExec) *mod // QuoteGasForExecWithPackageID exercises the QuoteGasForExec choice using the provided package ID instead of package name func (t FeeQuoter) QuoteGasForExecWithPackageID(contractID string, packageID string, args QuoteGasForExec) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "QuoteGasForExec", Arguments: argsToMap(args), @@ -3276,7 +2557,7 @@ func (t FeeQuoter) QuoteGasForExecWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t FeeQuoter) GetTokenPrice(contractID string, args GetTokenPrice) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetTokenPrice", Arguments: argsToMap(args), @@ -3286,7 +2567,7 @@ func (t FeeQuoter) GetTokenPrice(contractID string, args GetTokenPrice) *model.E // GetTokenPriceWithPackageID exercises the GetTokenPrice choice using the provided package ID instead of package name func (t FeeQuoter) GetTokenPriceWithPackageID(contractID string, packageID string, args GetTokenPrice) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetTokenPrice", Arguments: argsToMap(args), @@ -3297,7 +2578,7 @@ func (t FeeQuoter) GetTokenPriceWithPackageID(contractID string, packageID strin // This method uses the package name in the template ID func (t FeeQuoter) GetDestinationChainGasPrice(contractID string, args GetDestinationChainGasPrice) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetDestinationChainGasPrice", Arguments: argsToMap(args), @@ -3307,7 +2588,7 @@ func (t FeeQuoter) GetDestinationChainGasPrice(contractID string, args GetDestin // GetDestinationChainGasPriceWithPackageID exercises the GetDestinationChainGasPrice choice using the provided package ID instead of package name func (t FeeQuoter) GetDestinationChainGasPriceWithPackageID(contractID string, packageID string, args GetDestinationChainGasPrice) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetDestinationChainGasPrice", Arguments: argsToMap(args), @@ -3318,7 +2599,7 @@ func (t FeeQuoter) GetDestinationChainGasPriceWithPackageID(contractID string, p // This method uses the package name in the template ID func (t FeeQuoter) UpdatePrices(contractID string, args UpdatePrices) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "UpdatePrices", Arguments: argsToMap(args), @@ -3328,7 +2609,7 @@ func (t FeeQuoter) UpdatePrices(contractID string, args UpdatePrices) *model.Exe // UpdatePricesWithPackageID exercises the UpdatePrices choice using the provided package ID instead of package name func (t FeeQuoter) UpdatePricesWithPackageID(contractID string, packageID string, args UpdatePrices) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "UpdatePrices", Arguments: argsToMap(args), @@ -3339,7 +2620,7 @@ func (t FeeQuoter) UpdatePricesWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t FeeQuoter) GetTokenTransferFee(contractID string, args GetTokenTransferFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetTokenTransferFee", Arguments: argsToMap(args), @@ -3349,7 +2630,7 @@ func (t FeeQuoter) GetTokenTransferFee(contractID string, args GetTokenTransferF // GetTokenTransferFeeWithPackageID exercises the GetTokenTransferFee choice using the provided package ID instead of package name func (t FeeQuoter) GetTokenTransferFeeWithPackageID(contractID string, packageID string, args GetTokenTransferFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetTokenTransferFee", Arguments: argsToMap(args), @@ -3360,7 +2641,7 @@ func (t FeeQuoter) GetTokenTransferFeeWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t FeeQuoter) GetDestChainConfig(contractID string, args GetDestChainConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetDestChainConfig", Arguments: argsToMap(args), @@ -3370,7 +2651,7 @@ func (t FeeQuoter) GetDestChainConfig(contractID string, args GetDestChainConfig // GetDestChainConfigWithPackageID exercises the GetDestChainConfig choice using the provided package ID instead of package name func (t FeeQuoter) GetDestChainConfigWithPackageID(contractID string, packageID string, args GetDestChainConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetDestChainConfig", Arguments: argsToMap(args), @@ -3381,7 +2662,7 @@ func (t FeeQuoter) GetDestChainConfigWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t FeeQuoter) ApplyFeeQuoterDestChainConfigUpdates(contractID string, args ApplyFeeQuoterDestChainConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "ApplyFeeQuoterDestChainConfigUpdates", Arguments: argsToMap(args), @@ -3391,18 +2672,18 @@ func (t FeeQuoter) ApplyFeeQuoterDestChainConfigUpdates(contractID string, args // ApplyFeeQuoterDestChainConfigUpdatesWithPackageID exercises the ApplyFeeQuoterDestChainConfigUpdates choice using the provided package ID instead of package name func (t FeeQuoter) ApplyFeeQuoterDestChainConfigUpdatesWithPackageID(contractID string, packageID string, args ApplyFeeQuoterDestChainConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "ApplyFeeQuoterDestChainConfigUpdates", Arguments: argsToMap(args), } } -// Archive exercises the Archive choice on this FeeQuoter contract via the IMCMSReceiver interface +// Archive exercises the Archive choice on this FeeQuoter contract via the IIFeeQuoter interface // This method uses the package name in the template ID func (t FeeQuoter) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -3412,7 +2693,7 @@ func (t FeeQuoter) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t FeeQuoter) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -3423,7 +2704,7 @@ func (t FeeQuoter) ArchiveWithPackageID(contractID string, packageID string) *mo // This method uses the package name in the template ID func (t FeeQuoter) Get(contractID string, args Get) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "Get", Arguments: argsToMap(args), @@ -3433,7 +2714,7 @@ func (t FeeQuoter) Get(contractID string, args Get) *model.ExerciseCommand { // GetWithPackageID exercises the Get choice using the provided package ID instead of package name func (t FeeQuoter) GetWithPackageID(contractID string, packageID string, args Get) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "Get", Arguments: argsToMap(args), @@ -3444,7 +2725,7 @@ func (t FeeQuoter) GetWithPackageID(contractID string, packageID string, args Ge // This method uses the package name in the template ID func (t FeeQuoter) GetFeeTokens(contractID string, args GetFeeTokens) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetFeeTokens", Arguments: argsToMap(args), @@ -3454,7 +2735,7 @@ func (t FeeQuoter) GetFeeTokens(contractID string, args GetFeeTokens) *model.Exe // GetFeeTokensWithPackageID exercises the GetFeeTokens choice using the provided package ID instead of package name func (t FeeQuoter) GetFeeTokensWithPackageID(contractID string, packageID string, args GetFeeTokens) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "GetFeeTokens", Arguments: argsToMap(args), @@ -3465,7 +2746,7 @@ func (t FeeQuoter) GetFeeTokensWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t FeeQuoter) ApplyPriceUpdatersUpdate(contractID string, args ApplyPriceUpdatersUpdate) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "ApplyPriceUpdatersUpdate", Arguments: argsToMap(args), @@ -3475,7 +2756,7 @@ func (t FeeQuoter) ApplyPriceUpdatersUpdate(contractID string, args ApplyPriceUp // ApplyPriceUpdatersUpdateWithPackageID exercises the ApplyPriceUpdatersUpdate choice using the provided package ID instead of package name func (t FeeQuoter) ApplyPriceUpdatersUpdateWithPackageID(contractID string, packageID string, args ApplyPriceUpdatersUpdate) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "ApplyPriceUpdatersUpdate", Arguments: argsToMap(args), @@ -3486,7 +2767,7 @@ func (t FeeQuoter) ApplyPriceUpdatersUpdateWithPackageID(contractID string, pack // This method uses the package name in the template ID func (t FeeQuoter) AddPriceUpdaters(contractID string, args AddPriceUpdaters) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "AddPriceUpdaters", Arguments: argsToMap(args), @@ -3496,7 +2777,7 @@ func (t FeeQuoter) AddPriceUpdaters(contractID string, args AddPriceUpdaters) *m // AddPriceUpdatersWithPackageID exercises the AddPriceUpdaters choice using the provided package ID instead of package name func (t FeeQuoter) AddPriceUpdatersWithPackageID(contractID string, packageID string, args AddPriceUpdaters) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "AddPriceUpdaters", Arguments: argsToMap(args), @@ -3507,7 +2788,7 @@ func (t FeeQuoter) AddPriceUpdatersWithPackageID(contractID string, packageID st // This method uses the package name in the template ID func (t FeeQuoter) RemovePriceUpdaters(contractID string, args RemovePriceUpdaters) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "RemovePriceUpdaters", Arguments: argsToMap(args), @@ -3517,7 +2798,7 @@ func (t FeeQuoter) RemovePriceUpdaters(contractID string, args RemovePriceUpdate // RemovePriceUpdatersWithPackageID exercises the RemovePriceUpdaters choice using the provided package ID instead of package name func (t FeeQuoter) RemovePriceUpdatersWithPackageID(contractID string, packageID string, args RemovePriceUpdaters) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "RemovePriceUpdaters", Arguments: argsToMap(args), @@ -3528,7 +2809,7 @@ func (t FeeQuoter) RemovePriceUpdatersWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t FeeQuoter) RemoveFeeTokens(contractID string, args RemoveFeeTokens) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "RemoveFeeTokens", Arguments: argsToMap(args), @@ -3538,7 +2819,7 @@ func (t FeeQuoter) RemoveFeeTokens(contractID string, args RemoveFeeTokens) *mod // RemoveFeeTokensWithPackageID exercises the RemoveFeeTokens choice using the provided package ID instead of package name func (t FeeQuoter) RemoveFeeTokensWithPackageID(contractID string, packageID string, args RemoveFeeTokens) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "FeeQuoter"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "FeeQuoter"), ContractID: contractID, Choice: "RemoveFeeTokens", Arguments: argsToMap(args), @@ -3549,7 +2830,7 @@ func (t FeeQuoter) RemoveFeeTokensWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t FeeQuoter) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FeeQuoter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -3559,33 +2840,161 @@ func (t FeeQuoter) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiv // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t FeeQuoter) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FeeQuoter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), } } -// Verify interface implementations for FeeQuoter - -var _ api.IMCMSReceiver = (*FeeQuoter)(nil) - -// FeeQuoterDestChainConfig is a Record type -type FeeQuoterDestChainConfig struct { - IsEnabled types.BOOL `json:"isEnabled"` - MaxDataBytes types.INT64 `json:"maxDataBytes"` - MaxPerMsgGasLimit types.INT64 `json:"maxPerMsgGasLimit"` - DestGasOverhead types.INT64 `json:"destGasOverhead"` - DestGasPerPayloadByteBase types.INT64 `json:"destGasPerPayloadByteBase"` - DefaultTxGasLimit types.INT64 `json:"defaultTxGasLimit"` - LinkFeeMultiplierPercent types.NUMERIC `json:"linkFeeMultiplierPercent"` - DefaultTokenFeeUSD types.NUMERIC `json:"defaultTokenFeeUSD"` - DefaultTokenDestGasOverhead types.INT64 `json:"defaultTokenDestGasOverhead"` +// FeeQuoterPublicFetch exercises the FeeQuoter_PublicFetch choice on this FeeQuoter contract via the IIFeeQuoter interface +// This method uses the package name in the template ID +func (t FeeQuoter) FeeQuoterPublicFetch(contractID string, args ccipapi.FeeQuoterPublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_PublicFetch", + Arguments: argsToMap(args), + } } -// ToMap converts FeeQuoterDestChainConfig to a map for DAML arguments -func (t FeeQuoterDestChainConfig) ToMap() map[string]any { - m := make(map[string]any) +// FeeQuoterPublicFetchWithPackageID exercises the FeeQuoter_PublicFetch choice using the provided package ID instead of package name +func (t FeeQuoter) FeeQuoterPublicFetchWithPackageID(contractID string, packageID string, args ccipapi.FeeQuoterPublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_PublicFetch", + Arguments: argsToMap(args), + } +} + +// FeeQuoterGetTokenPrice exercises the FeeQuoter_GetTokenPrice choice on this FeeQuoter contract via the IIFeeQuoter interface +// This method uses the package name in the template ID +func (t FeeQuoter) FeeQuoterGetTokenPrice(contractID string, args ccipapi.FeeQuoterGetTokenPrice) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_GetTokenPrice", + Arguments: argsToMap(args), + } +} + +// FeeQuoterGetTokenPriceWithPackageID exercises the FeeQuoter_GetTokenPrice choice using the provided package ID instead of package name +func (t FeeQuoter) FeeQuoterGetTokenPriceWithPackageID(contractID string, packageID string, args ccipapi.FeeQuoterGetTokenPrice) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_GetTokenPrice", + Arguments: argsToMap(args), + } +} + +// FeeQuoterGetDestinationChainGasPrice exercises the FeeQuoter_GetDestinationChainGasPrice choice on this FeeQuoter contract via the IIFeeQuoter interface +// This method uses the package name in the template ID +func (t FeeQuoter) FeeQuoterGetDestinationChainGasPrice(contractID string, args ccipapi.FeeQuoterGetDestinationChainGasPrice) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_GetDestinationChainGasPrice", + Arguments: argsToMap(args), + } +} + +// FeeQuoterGetDestinationChainGasPriceWithPackageID exercises the FeeQuoter_GetDestinationChainGasPrice choice using the provided package ID instead of package name +func (t FeeQuoter) FeeQuoterGetDestinationChainGasPriceWithPackageID(contractID string, packageID string, args ccipapi.FeeQuoterGetDestinationChainGasPrice) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_GetDestinationChainGasPrice", + Arguments: argsToMap(args), + } +} + +// FeeQuoterGetTokenTransferFee exercises the FeeQuoter_GetTokenTransferFee choice on this FeeQuoter contract via the IIFeeQuoter interface +// This method uses the package name in the template ID +func (t FeeQuoter) FeeQuoterGetTokenTransferFee(contractID string, args ccipapi.FeeQuoterGetTokenTransferFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_GetTokenTransferFee", + Arguments: argsToMap(args), + } +} + +// FeeQuoterGetTokenTransferFeeWithPackageID exercises the FeeQuoter_GetTokenTransferFee choice using the provided package ID instead of package name +func (t FeeQuoter) FeeQuoterGetTokenTransferFeeWithPackageID(contractID string, packageID string, args ccipapi.FeeQuoterGetTokenTransferFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_GetTokenTransferFee", + Arguments: argsToMap(args), + } +} + +// FeeQuoterQuoteGasForExec exercises the FeeQuoter_QuoteGasForExec choice on this FeeQuoter contract via the IIFeeQuoter interface +// This method uses the package name in the template ID +func (t FeeQuoter) FeeQuoterQuoteGasForExec(contractID string, args ccipapi.FeeQuoterQuoteGasForExec) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_QuoteGasForExec", + Arguments: argsToMap(args), + } +} + +// FeeQuoterQuoteGasForExecWithPackageID exercises the FeeQuoter_QuoteGasForExec choice using the provided package ID instead of package name +func (t FeeQuoter) FeeQuoterQuoteGasForExecWithPackageID(contractID string, packageID string, args ccipapi.FeeQuoterQuoteGasForExec) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_QuoteGasForExec", + Arguments: argsToMap(args), + } +} + +// FeeQuoterGetFeeTokens exercises the FeeQuoter_GetFeeTokens choice on this FeeQuoter contract via the IIFeeQuoter interface +// This method uses the package name in the template ID +func (t FeeQuoter) FeeQuoterGetFeeTokens(contractID string, args ccipapi.FeeQuoterGetFeeTokens) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_GetFeeTokens", + Arguments: argsToMap(args), + } +} + +// FeeQuoterGetFeeTokensWithPackageID exercises the FeeQuoter_GetFeeTokens choice using the provided package ID instead of package name +func (t FeeQuoter) FeeQuoterGetFeeTokensWithPackageID(contractID string, packageID string, args ccipapi.FeeQuoterGetFeeTokens) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.FeeQuoter", "IFeeQuoter"), + ContractID: contractID, + Choice: "FeeQuoter_GetFeeTokens", + Arguments: argsToMap(args), + } +} + +// Verify interface implementations for FeeQuoter + +var _ api.IMCMSReceiver = (*FeeQuoter)(nil) + +var _ ccipapi.IIFeeQuoter = (*FeeQuoter)(nil) + +// FeeQuoterDestChainConfig is a Record type +type FeeQuoterDestChainConfig struct { + IsEnabled types.BOOL `json:"isEnabled"` + MaxDataBytes types.INT64 `json:"maxDataBytes"` + MaxPerMsgGasLimit types.INT64 `json:"maxPerMsgGasLimit"` + DestGasOverhead types.INT64 `json:"destGasOverhead"` + DestGasPerPayloadByteBase types.INT64 `json:"destGasPerPayloadByteBase"` + DefaultTxGasLimit types.INT64 `json:"defaultTxGasLimit"` + LinkFeeMultiplierPercent types.NUMERIC `json:"linkFeeMultiplierPercent"` + DefaultTokenFeeUSD types.NUMERIC `json:"defaultTokenFeeUSD"` + DefaultTokenDestGasOverhead types.INT64 `json:"defaultTokenDestGasOverhead"` +} + +// ToMap converts FeeQuoterDestChainConfig to a map for DAML arguments +func (t FeeQuoterDestChainConfig) ToMap() map[string]any { + m := make(map[string]any) m["isEnabled"] = bool(t.IsEnabled) @@ -3671,13 +3080,16 @@ func (t *FeeQuoterDestChainConfigArgs) UnmarshalHex(data string) error { // FeeTokenAmount is a Record type type FeeTokenAmount struct { - Caller types.PARTY `json:"caller"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts FeeTokenAmount to a map for DAML arguments func (t FeeTokenAmount) ToMap() map[string]any { m := make(map[string]any) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -3708,6 +3120,7 @@ func (t *FeeTokenAmount) UnmarshalHex(data string) error { // FeeTokenAmountMCMSParams is FeeTokenAmount without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type FeeTokenAmountMCMSParams struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes FeeTokenAmountMCMSParams to hex string for MCMS operationData. @@ -3722,171 +3135,23 @@ func (t *FeeTokenAmountMCMSParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// FinalityConfig is a variant/union type -type FinalityConfig struct { - WaitForFinality *types.UNIT `json:"WaitForFinality,omitempty"` - WaitForSafe *types.UNIT `json:"WaitForSafe,omitempty"` - BlockDepth *types.INT64 `json:"BlockDepth,omitempty"` -} - -// MarshalJSON implements custom JSON marshaling for FinalityConfig -func (v FinalityConfig) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(v) -} - -// UnmarshalJSON implements custom JSON unmarshalling for FinalityConfig -func (v *FinalityConfig) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, v) -} - -// MarshalHex encodes FinalityConfig to hex string (Canton MCMS format) -func (v FinalityConfig) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(v) -} - -// UnmarshalHex decodes FinalityConfig from hex string (Canton MCMS format) -func (v *FinalityConfig) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, v) -} - -// GetVariantTag implements types.VARIANT interface -func (v FinalityConfig) GetVariantTag() string { - - if v.WaitForFinality != nil { - return "WaitForFinality" - } - - if v.WaitForSafe != nil { - return "WaitForSafe" - } - - if v.BlockDepth != nil { - return "BlockDepth" - } - - return "" -} - -// GetVariantValue implements types.VARIANT interface -func (v FinalityConfig) GetVariantValue() any { - - if v.WaitForFinality != nil { - return v.WaitForFinality - } - - if v.WaitForSafe != nil { - return v.WaitForSafe - } - - if v.BlockDepth != nil { - return v.BlockDepth - } - - return nil -} - -var _ types.VARIANT = (*FinalityConfig)(nil) - -// GetVariantTagByte implements types.VariantWithTagByte interface for MCMS numeric tag encoding -func (v FinalityConfig) GetVariantTagByte() byte { - - if v.WaitForFinality != nil { - return 0 - } - - if v.WaitForSafe != nil { - return 1 - } - - if v.BlockDepth != nil { - return 2 - } - - return 0xFF // Invalid/unknown variant -} - -var _ types.VariantWithTagByte = (*FinalityConfig)(nil) - // FinalizeExecute is a Record type type FinalizeExecute struct { - TokenAdminRegistryInstanceId types.TEXT `json:"tokenAdminRegistryInstanceId"` - MaybePoolAddress *chainlinkapi.RawInstanceAddress `json:"maybePoolAddress" hex:"optional"` - MaybeTicketReceiver *types.PARTY `json:"maybeTicketReceiver" hex:"optional"` - MaybeTokenReceiver *types.PARTY `json:"maybeTokenReceiver" hex:"optional"` - MaybeInstrumentId *splice_api_token_holding_v1.InstrumentId `json:"maybeInstrumentId" hex:"optional"` - MaybeAmount *types.TEXT `json:"maybeAmount" hex:"optional"` - ReturnData types.TEXT `json:"returnData"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` + TicketReceiver types.PARTY `json:"ticketReceiver"` + ReturnData types.TEXT `json:"returnData"` } // ToMap converts FinalizeExecute to a map for DAML arguments func (t FinalizeExecute) ToMap() map[string]any { m := make(map[string]any) - m["tokenAdminRegistryInstanceId"] = string(t.TokenAdminRegistryInstanceId) - - if t.MaybePoolAddress != nil { - m["maybePoolAddress"] = map[string]any{ - "_type": "optional", - "value": model.NestedToDAMLValue(*t.MaybePoolAddress), - } - } else { - m["maybePoolAddress"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } - - if t.MaybeTicketReceiver != nil { - m["maybeTicketReceiver"] = map[string]any{ - "_type": "optional", - "value": (*t.MaybeTicketReceiver).ToMap(), - } - } else { - m["maybeTicketReceiver"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } - - if t.MaybeTokenReceiver != nil { - m["maybeTokenReceiver"] = map[string]any{ - "_type": "optional", - "value": (*t.MaybeTokenReceiver).ToMap(), - } - } else { - m["maybeTokenReceiver"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - if t.MaybeInstrumentId != nil { - m["maybeInstrumentId"] = map[string]any{ - "_type": "optional", - "value": model.NestedToDAMLValue(*t.MaybeInstrumentId), - } - } else { - m["maybeInstrumentId"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } + m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) - if t.MaybeAmount != nil { - m["maybeAmount"] = map[string]any{ - "_type": "optional", - "value": string(*t.MaybeAmount), - } - } else { - m["maybeAmount"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } + m["ticketReceiver"] = t.TicketReceiver.ToMap() m["returnData"] = string(t.ReturnData) @@ -4017,10 +3282,10 @@ func (t *FinalizeFee) UnmarshalHex(data string) error { // FinalizeSend is a Record type type FinalizeSend struct { - MessageSender types.PARTY `json:"messageSender"` - MessageSentObservers []types.PARTY `json:"messageSentObservers"` - VerifierBlobs []types.TEXT `json:"verifierBlobs"` - Receipts []Receipt `json:"receipts"` + MessageSender types.PARTY `json:"messageSender"` + MessageSentObservers []types.PARTY `json:"messageSentObservers"` + VerifierBlobs []types.TEXT `json:"verifierBlobs"` + Receipts []events.Receipt `json:"receipts"` } // ToMap converts FinalizeSend to a map for DAML arguments @@ -4153,60 +3418,6 @@ func (t *GasPriceUpdate) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// GenericExtraArgsV3 is a Record type -type GenericExtraArgsV3 struct { - GasLimit types.INT64 `json:"gasLimit"` - Ccvs []CCVExtraArg `json:"ccvs"` - Executor ExecutorExtraArg `json:"executor"` - TokenReceiver types.TEXT `json:"tokenReceiver"` - TokenArgs types.TEXT `json:"tokenArgs"` -} - -// ToMap converts GenericExtraArgsV3 to a map for DAML arguments -func (t GenericExtraArgsV3) ToMap() map[string]any { - m := make(map[string]any) - - m["gasLimit"] = int64(t.GasLimit) - - m["ccvs"] = func() []any { - res := make([]any, 0, len(t.Ccvs)) - for _, e := range t.Ccvs { - res = append(res, model.NestedToDAMLValue(e)) - } - return res - }() - - m["executor"] = model.NestedToDAMLValue(t.Executor) - - m["tokenReceiver"] = string(t.TokenReceiver) - - m["tokenArgs"] = string(t.TokenArgs) - - return m -} - -func (t GenericExtraArgsV3) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *GenericExtraArgsV3) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes GenericExtraArgsV3 to hex string (Canton MCMS format) -func (t GenericExtraArgsV3) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes GenericExtraArgsV3 from hex string (Canton MCMS format) -func (t *GenericExtraArgsV3) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - // Get is a Record type type Get struct { Caller types.PARTY `json:"caller"` @@ -4262,13 +3473,16 @@ func (t *GetMCMSParams) UnmarshalHex(data string) error { // GetCursedSubjects is a Record type type GetCursedSubjects struct { - Caller types.PARTY `json:"caller"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetCursedSubjects to a map for DAML arguments func (t GetCursedSubjects) ToMap() map[string]any { m := make(map[string]any) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -4299,6 +3513,7 @@ func (t *GetCursedSubjects) UnmarshalHex(data string) error { // GetCursedSubjectsMCMSParams is GetCursedSubjects without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetCursedSubjectsMCMSParams struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetCursedSubjectsMCMSParams to hex string for MCMS operationData. @@ -4372,8 +3587,9 @@ func (t *GetDestChainConfigMCMSParams) UnmarshalHex(data string) error { // GetDestinationChainGasPrice is a Record type type GetDestinationChainGasPrice struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - Caller types.PARTY `json:"caller"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetDestinationChainGasPrice to a map for DAML arguments @@ -4382,6 +3598,8 @@ func (t GetDestinationChainGasPrice) ToMap() map[string]any { m["destChainSelector"] = t.DestChainSelector + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -4412,7 +3630,8 @@ func (t *GetDestinationChainGasPrice) UnmarshalHex(data string) error { // GetDestinationChainGasPriceMCMSParams is GetDestinationChainGasPrice without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetDestinationChainGasPriceMCMSParams struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetDestinationChainGasPriceMCMSParams to hex string for MCMS operationData. @@ -4429,13 +3648,16 @@ func (t *GetDestinationChainGasPriceMCMSParams) UnmarshalHex(data string) error // GetFeeTokens is a Record type type GetFeeTokens struct { - Caller types.PARTY `json:"caller"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetFeeTokens to a map for DAML arguments func (t GetFeeTokens) ToMap() map[string]any { m := make(map[string]any) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -4466,6 +3688,7 @@ func (t *GetFeeTokens) UnmarshalHex(data string) error { // GetFeeTokensMCMSParams is GetFeeTokens without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetFeeTokensMCMSParams struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetFeeTokensMCMSParams to hex string for MCMS operationData. @@ -4539,9 +3762,10 @@ func (t *GetSourceChainConfigMCMSParams) UnmarshalHex(data string) error { // GetTokenConfigByCid is a Record type type GetTokenConfigByCid struct { - TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - Caller types.PARTY `json:"caller"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetTokenConfigByCid to a map for DAML arguments @@ -4552,6 +3776,8 @@ func (t GetTokenConfigByCid) ToMap() map[string]any { m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -4582,7 +3808,8 @@ func (t *GetTokenConfigByCid) UnmarshalHex(data string) error { // GetTokenConfigByCidMCMSParams is GetTokenConfigByCid without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetTokenConfigByCidMCMSParams struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetTokenConfigByCidMCMSParams to hex string for MCMS operationData. @@ -4599,15 +3826,18 @@ func (t *GetTokenConfigByCidMCMSParams) UnmarshalHex(data string) error { // GetTokenPrice is a Record type type GetTokenPrice struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - Caller types.PARTY `json:"caller"` + Token splice_api_token_holding_v1.InstrumentId `json:"token"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetTokenPrice to a map for DAML arguments func (t GetTokenPrice) ToMap() map[string]any { m := make(map[string]any) - m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + m["token"] = model.NestedToDAMLValue(t.Token) + + m["context"] = model.NestedToDAMLValue(t.Context) m["caller"] = t.Caller.ToMap() @@ -4639,7 +3869,8 @@ func (t *GetTokenPrice) UnmarshalHex(data string) error { // GetTokenPriceMCMSParams is GetTokenPrice without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetTokenPriceMCMSParams struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Token splice_api_token_holding_v1.InstrumentId `json:"token"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetTokenPriceMCMSParams to hex string for MCMS operationData. @@ -4656,9 +3887,10 @@ func (t *GetTokenPriceMCMSParams) UnmarshalHex(data string) error { // GetTokenTransferFee is a Record type type GetTokenTransferFee struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - Token splice_api_token_holding_v1.InstrumentId `json:"token"` - Caller types.PARTY `json:"caller"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Token splice_api_token_holding_v1.InstrumentId `json:"token"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetTokenTransferFee to a map for DAML arguments @@ -4669,6 +3901,8 @@ func (t GetTokenTransferFee) ToMap() map[string]any { m["token"] = model.NestedToDAMLValue(t.Token) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -4699,8 +3933,9 @@ func (t *GetTokenTransferFee) UnmarshalHex(data string) error { // GetTokenTransferFeeMCMSParams is GetTokenTransferFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetTokenTransferFeeMCMSParams struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - Token splice_api_token_holding_v1.InstrumentId `json:"token"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Token splice_api_token_holding_v1.InstrumentId `json:"token"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetTokenTransferFeeMCMSParams to hex string for MCMS operationData. @@ -4717,21 +3952,21 @@ func (t *GetTokenTransferFeeMCMSParams) UnmarshalHex(data string) error { // GlobalConfig is a Template type type GlobalConfig struct { - InstanceId types.TEXT `json:"instanceId"` - CcipOwner types.PARTY `json:"ccipOwner"` - ChainSelector types.NUMERIC `json:"chainSelector"` - DestChainConfigs map[types.NUMERIC]DestChainConfig `json:"destChainConfigs"` - SourceChainConfigs map[types.NUMERIC]SourceChainConfig `json:"sourceChainConfigs"` + InstanceId types.TEXT `json:"instanceId"` + CcipOwner types.PARTY `json:"ccipOwner"` + ChainSelector types.NUMERIC `json:"chainSelector"` + DestChainConfigs map[types.NUMERIC]DestChainConfig2 `json:"destChainConfigs"` + SourceChainConfigs map[types.NUMERIC]SourceChainConfig2 `json:"sourceChainConfigs"` } // GetTemplateID returns the template ID for this template using the package name func (t GlobalConfig) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.GlobalConfig", "GlobalConfig") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "GlobalConfig") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t GlobalConfig) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.GlobalConfig", "GlobalConfig") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "GlobalConfig") } // CreateCommand returns a CreateCommand for this template using the package name @@ -4834,7 +4069,7 @@ func (t *GlobalConfig) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t GlobalConfig) ApplyDestChainConfigUpdates(contractID string, args ApplyDestChainConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.GlobalConfig", "GlobalConfig"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "ApplyDestChainConfigUpdates", Arguments: argsToMap(args), @@ -4844,7 +4079,7 @@ func (t GlobalConfig) ApplyDestChainConfigUpdates(contractID string, args ApplyD // ApplyDestChainConfigUpdatesWithPackageID exercises the ApplyDestChainConfigUpdates choice using the provided package ID instead of package name func (t GlobalConfig) ApplyDestChainConfigUpdatesWithPackageID(contractID string, packageID string, args ApplyDestChainConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.GlobalConfig", "GlobalConfig"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "ApplyDestChainConfigUpdates", Arguments: argsToMap(args), @@ -4855,7 +4090,7 @@ func (t GlobalConfig) ApplyDestChainConfigUpdatesWithPackageID(contractID string // This method uses the package name in the template ID func (t GlobalConfig) ApplySourceChainConfigUpdates(contractID string, args ApplySourceChainConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.GlobalConfig", "GlobalConfig"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "ApplySourceChainConfigUpdates", Arguments: argsToMap(args), @@ -4865,18 +4100,18 @@ func (t GlobalConfig) ApplySourceChainConfigUpdates(contractID string, args Appl // ApplySourceChainConfigUpdatesWithPackageID exercises the ApplySourceChainConfigUpdates choice using the provided package ID instead of package name func (t GlobalConfig) ApplySourceChainConfigUpdatesWithPackageID(contractID string, packageID string, args ApplySourceChainConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.GlobalConfig", "GlobalConfig"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "ApplySourceChainConfigUpdates", Arguments: argsToMap(args), } } -// Archive exercises the Archive choice on this GlobalConfig contract via the IMCMSReceiver interface +// Archive exercises the Archive choice on this GlobalConfig contract via the IIGlobalConfig interface // This method uses the package name in the template ID func (t GlobalConfig) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.GlobalConfig", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -4886,7 +4121,7 @@ func (t GlobalConfig) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t GlobalConfig) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.GlobalConfig", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -4897,7 +4132,7 @@ func (t GlobalConfig) ArchiveWithPackageID(contractID string, packageID string) // This method uses the package name in the template ID func (t GlobalConfig) GetDestChainConfig(contractID string, args GetDestChainConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.GlobalConfig", "GlobalConfig"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "GetDestChainConfig", Arguments: argsToMap(args), @@ -4907,7 +4142,7 @@ func (t GlobalConfig) GetDestChainConfig(contractID string, args GetDestChainCon // GetDestChainConfigWithPackageID exercises the GetDestChainConfig choice using the provided package ID instead of package name func (t GlobalConfig) GetDestChainConfigWithPackageID(contractID string, packageID string, args GetDestChainConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.GlobalConfig", "GlobalConfig"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "GetDestChainConfig", Arguments: argsToMap(args), @@ -4918,7 +4153,7 @@ func (t GlobalConfig) GetDestChainConfigWithPackageID(contractID string, package // This method uses the package name in the template ID func (t GlobalConfig) GetSourceChainConfig(contractID string, args GetSourceChainConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.GlobalConfig", "GlobalConfig"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "GetSourceChainConfig", Arguments: argsToMap(args), @@ -4928,7 +4163,7 @@ func (t GlobalConfig) GetSourceChainConfig(contractID string, args GetSourceChai // GetSourceChainConfigWithPackageID exercises the GetSourceChainConfig choice using the provided package ID instead of package name func (t GlobalConfig) GetSourceChainConfigWithPackageID(contractID string, packageID string, args GetSourceChainConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.GlobalConfig", "GlobalConfig"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "GetSourceChainConfig", Arguments: argsToMap(args), @@ -4939,7 +4174,7 @@ func (t GlobalConfig) GetSourceChainConfigWithPackageID(contractID string, packa // This method uses the package name in the template ID func (t GlobalConfig) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.GlobalConfig", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -4949,29 +4184,94 @@ func (t GlobalConfig) MCMSReceiverEntrypoint(contractID string, args api.MCMSRec // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t GlobalConfig) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.GlobalConfig", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), } } -// Verify interface implementations for GlobalConfig - -var _ api.IMCMSReceiver = (*GlobalConfig)(nil) - -// InboundPoolVerification is a Record type -type InboundPoolVerification struct { - PoolInstanceId types.TEXT `json:"poolInstanceId"` - PoolOwner types.PARTY `json:"poolOwner"` - PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` +// GlobalConfigPublicFetch exercises the GlobalConfig_PublicFetch choice on this GlobalConfig contract via the IIGlobalConfig interface +// This method uses the package name in the template ID +func (t GlobalConfig) GlobalConfigPublicFetch(contractID string, args ccipapi.GlobalConfigPublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "IGlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_PublicFetch", + Arguments: argsToMap(args), + } } -// ToMap converts InboundPoolVerification to a map for DAML arguments -func (t InboundPoolVerification) ToMap() map[string]any { - m := make(map[string]any) +// GlobalConfigPublicFetchWithPackageID exercises the GlobalConfig_PublicFetch choice using the provided package ID instead of package name +func (t GlobalConfig) GlobalConfigPublicFetchWithPackageID(contractID string, packageID string, args ccipapi.GlobalConfigPublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "IGlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_PublicFetch", + Arguments: argsToMap(args), + } +} - m["poolInstanceId"] = string(t.PoolInstanceId) +// GlobalConfigGetDestChainConfig exercises the GlobalConfig_GetDestChainConfig choice on this GlobalConfig contract via the IIGlobalConfig interface +// This method uses the package name in the template ID +func (t GlobalConfig) GlobalConfigGetDestChainConfig(contractID string, args ccipapi.GlobalConfigGetDestChainConfig) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "IGlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_GetDestChainConfig", + Arguments: argsToMap(args), + } +} + +// GlobalConfigGetDestChainConfigWithPackageID exercises the GlobalConfig_GetDestChainConfig choice using the provided package ID instead of package name +func (t GlobalConfig) GlobalConfigGetDestChainConfigWithPackageID(contractID string, packageID string, args ccipapi.GlobalConfigGetDestChainConfig) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "IGlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_GetDestChainConfig", + Arguments: argsToMap(args), + } +} + +// GlobalConfigGetSourceChainConfig exercises the GlobalConfig_GetSourceChainConfig choice on this GlobalConfig contract via the IIGlobalConfig interface +// This method uses the package name in the template ID +func (t GlobalConfig) GlobalConfigGetSourceChainConfig(contractID string, args ccipapi.GlobalConfigGetSourceChainConfig) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.GlobalConfig", "IGlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_GetSourceChainConfig", + Arguments: argsToMap(args), + } +} + +// GlobalConfigGetSourceChainConfigWithPackageID exercises the GlobalConfig_GetSourceChainConfig choice using the provided package ID instead of package name +func (t GlobalConfig) GlobalConfigGetSourceChainConfigWithPackageID(contractID string, packageID string, args ccipapi.GlobalConfigGetSourceChainConfig) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.GlobalConfig", "IGlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_GetSourceChainConfig", + Arguments: argsToMap(args), + } +} + +// Verify interface implementations for GlobalConfig + +var _ api.IMCMSReceiver = (*GlobalConfig)(nil) + +var _ ccipapi.IIGlobalConfig = (*GlobalConfig)(nil) + +// InboundPoolVerification is a Record type +type InboundPoolVerification struct { + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolOwner types.PARTY `json:"poolOwner"` + PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` +} + +// ToMap converts InboundPoolVerification to a map for DAML arguments +func (t InboundPoolVerification) ToMap() map[string]any { + m := make(map[string]any) + + m["poolInstanceId"] = string(t.PoolInstanceId) m["poolOwner"] = t.PoolOwner.ToMap() @@ -5010,18 +4310,17 @@ func (t *InboundPoolVerification) UnmarshalHex(data string) error { // IsAdministrator is a Record type type IsAdministrator struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - TokenConfigCid *types.CONTRACT_ID `json:"tokenConfigCid" hex:"optional"` - Administrator types.PARTY `json:"administrator"` - Caller types.PARTY `json:"caller"` + TokenConfigCid *types.CONTRACT_ID `json:"tokenConfigCid" hex:"optional"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Administrator types.PARTY `json:"administrator"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts IsAdministrator to a map for DAML arguments func (t IsAdministrator) ToMap() map[string]any { m := make(map[string]any) - m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) - if t.TokenConfigCid != nil { m["tokenConfigCid"] = map[string]any{ "_type": "optional", @@ -5034,8 +4333,12 @@ func (t IsAdministrator) ToMap() map[string]any { } } + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + m["administrator"] = t.Administrator.ToMap() + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -5066,8 +4369,9 @@ func (t *IsAdministrator) UnmarshalHex(data string) error { // IsAdministratorMCMSParams is IsAdministrator without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type IsAdministratorMCMSParams struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - Administrator types.PARTY `json:"administrator"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Administrator types.PARTY `json:"administrator"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes IsAdministratorMCMSParams to hex string for MCMS operationData. @@ -5084,13 +4388,16 @@ func (t *IsAdministratorMCMSParams) UnmarshalHex(data string) error { // IsCursed is a Record type type IsCursed struct { - Caller types.PARTY `json:"caller"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts IsCursed to a map for DAML arguments func (t IsCursed) ToMap() map[string]any { m := make(map[string]any) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -5121,6 +4428,7 @@ func (t *IsCursed) UnmarshalHex(data string) error { // IsCursedMCMSParams is IsCursed without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type IsCursedMCMSParams struct { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes IsCursedMCMSParams to hex string for MCMS operationData. @@ -5137,18 +4445,21 @@ func (t *IsCursedMCMSParams) UnmarshalHex(data string) error { // IsCursedForChain is a Record type type IsCursedForChain struct { - Caller types.PARTY `json:"caller"` - ChainSelector types.NUMERIC `json:"chainSelector"` + ChainSelector types.NUMERIC `json:"chainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts IsCursedForChain to a map for DAML arguments func (t IsCursedForChain) ToMap() map[string]any { m := make(map[string]any) - m["caller"] = t.Caller.ToMap() - m["chainSelector"] = t.ChainSelector + m["context"] = model.NestedToDAMLValue(t.Context) + + m["caller"] = t.Caller.ToMap() + return m } @@ -5177,7 +4488,8 @@ func (t *IsCursedForChain) UnmarshalHex(data string) error { // IsCursedForChainMCMSParams is IsCursedForChain without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type IsCursedForChainMCMSParams struct { - ChainSelector types.NUMERIC `json:"chainSelector"` + ChainSelector types.NUMERIC `json:"chainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes IsCursedForChainMCMSParams to hex string for MCMS operationData. @@ -5192,237 +4504,14 @@ func (t *IsCursedForChainMCMSParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// IssuerType is an enum type -type IssuerType string - -const ( - IssuerTypeIssuerType_CCV IssuerType = "IssuerType_CCV" - - IssuerTypeIssuerType_Pool IssuerType = "IssuerType_Pool" - - IssuerTypeIssuerType_Executor IssuerType = "IssuerType_Executor" - - IssuerTypeIssuerType_Network IssuerType = "IssuerType_Network" -) - -func (e IssuerType) GetEnumConstructor() string { return string(e) } - -func (e IssuerType) GetEnumTypeID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Tickets", "IssuerType") -} - -// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name -func (e IssuerType) GetEnumTypeIDWithPackageID(packageID string) string { - return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Tickets", "IssuerType") -} - -func (e IssuerType) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(e) -} - -func (e *IssuerType) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, e) -} - -// MarshalHex encodes IssuerType to hex string (Canton MCMS format) -func (e IssuerType) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(e) -} - -// UnmarshalHex decodes IssuerType from hex string (Canton MCMS format) -func (e *IssuerType) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, e) -} - -var _ types.ENUM = IssuerType("") - -// LocalAmountConversionResult is a Record type -type LocalAmountConversionResult struct { - LocalAmount types.NUMERIC `json:"localAmount"` - TruncatedRemainder types.TEXT `json:"truncatedRemainder"` - WasTruncated types.BOOL `json:"wasTruncated"` -} - -// ToMap converts LocalAmountConversionResult to a map for DAML arguments -func (t LocalAmountConversionResult) ToMap() map[string]any { - m := make(map[string]any) - - m["localAmount"] = t.LocalAmount - - m["truncatedRemainder"] = string(t.TruncatedRemainder) - - m["wasTruncated"] = bool(t.WasTruncated) - - return m -} - -func (t LocalAmountConversionResult) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *LocalAmountConversionResult) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes LocalAmountConversionResult to hex string (Canton MCMS format) -func (t LocalAmountConversionResult) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes LocalAmountConversionResult from hex string (Canton MCMS format) -func (t *LocalAmountConversionResult) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// MessageExecutionState is an enum type -type MessageExecutionState string - -const ( - MessageExecutionStateUNTOUCHED MessageExecutionState = "UNTOUCHED" - - MessageExecutionStateIN_PROGRESS MessageExecutionState = "IN_PROGRESS" - - MessageExecutionStateSUCCESS MessageExecutionState = "SUCCESS" - - MessageExecutionStateFAILURE MessageExecutionState = "FAILURE" -) - -func (e MessageExecutionState) GetEnumConstructor() string { return string(e) } - -func (e MessageExecutionState) GetEnumTypeID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Internal", "MessageExecutionState") -} - -// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name -func (e MessageExecutionState) GetEnumTypeIDWithPackageID(packageID string) string { - return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Internal", "MessageExecutionState") -} - -func (e MessageExecutionState) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(e) -} - -func (e *MessageExecutionState) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, e) -} - -// MarshalHex encodes MessageExecutionState to hex string (Canton MCMS format) -func (e MessageExecutionState) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(e) -} - -// UnmarshalHex decodes MessageExecutionState from hex string (Canton MCMS format) -func (e *MessageExecutionState) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, e) -} - -var _ types.ENUM = MessageExecutionState("") - -// MessageV1 is a Record type -type MessageV1 struct { - SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` - DestChainSelector types.NUMERIC `json:"destChainSelector"` - SequenceNumber types.NUMERIC `json:"sequenceNumber"` - ExecutionGasLimit types.INT64 `json:"executionGasLimit"` - CcipReceiveGasLimit types.INT64 `json:"ccipReceiveGasLimit"` - Finality DecodedFinality `json:"finality"` - CcvAndExecutorHash types.TEXT `json:"ccvAndExecutorHash"` - OnRampAddress types.TEXT `json:"onRampAddress"` - OffRampAddress types.TEXT `json:"offRampAddress" hex:"bytes"` - Sender types.TEXT `json:"sender"` - Receiver types.TEXT `json:"receiver"` - DestBlob types.TEXT `json:"destBlob"` - TokenTransfer *TokenTransferV1 `json:"tokenTransfer" hex:"optional"` - MessageData types.TEXT `json:"messageData"` -} - -// ToMap converts MessageV1 to a map for DAML arguments -func (t MessageV1) ToMap() map[string]any { - m := make(map[string]any) - - m["sourceChainSelector"] = t.SourceChainSelector - - m["destChainSelector"] = t.DestChainSelector - - m["sequenceNumber"] = t.SequenceNumber - - m["executionGasLimit"] = int64(t.ExecutionGasLimit) - - m["ccipReceiveGasLimit"] = int64(t.CcipReceiveGasLimit) - - m["finality"] = model.NestedToDAMLValue(t.Finality) - - m["ccvAndExecutorHash"] = string(t.CcvAndExecutorHash) - - m["onRampAddress"] = string(t.OnRampAddress) - - m["offRampAddress"] = string(t.OffRampAddress) - - m["sender"] = string(t.Sender) - - m["receiver"] = string(t.Receiver) - - m["destBlob"] = string(t.DestBlob) - - if t.TokenTransfer != nil { - m["tokenTransfer"] = map[string]any{ - "_type": "optional", - "value": model.NestedToDAMLValue(*t.TokenTransfer), - } - } else { - m["tokenTransfer"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } - - m["messageData"] = string(t.MessageData) - - return m -} - -func (t MessageV1) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *MessageV1) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes MessageV1 to hex string (Canton MCMS format) -func (t MessageV1) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes MessageV1 from hex string (Canton MCMS format) -func (t *MessageV1) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// PoolRegistration is a Record type -type PoolRegistration struct { +// PoolRegistration2 is a Record type +type PoolRegistration2 struct { PoolOwner types.PARTY `json:"poolOwner"` PoolInstanceId types.TEXT `json:"poolInstanceId"` } -// ToMap converts PoolRegistration to a map for DAML arguments -func (t PoolRegistration) ToMap() map[string]any { +// ToMap converts PoolRegistration2 to a map for DAML arguments +func (t PoolRegistration2) ToMap() map[string]any { m := make(map[string]any) m["poolOwner"] = t.PoolOwner.ToMap() @@ -5432,24 +4521,24 @@ func (t PoolRegistration) ToMap() map[string]any { return m } -func (t PoolRegistration) MarshalJSON() ([]byte, error) { +func (t PoolRegistration2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *PoolRegistration) UnmarshalJSON(data []byte) error { +func (t *PoolRegistration2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes PoolRegistration to hex string (Canton MCMS format) -func (t PoolRegistration) MarshalHex() (string, error) { +// MarshalHex encodes PoolRegistration2 to hex string (Canton MCMS format) +func (t PoolRegistration2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes PoolRegistration from hex string (Canton MCMS format) -func (t *PoolRegistration) UnmarshalHex(data string) error { +// UnmarshalHex decodes PoolRegistration2 from hex string (Canton MCMS format) +func (t *PoolRegistration2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -5546,10 +4635,11 @@ func (t *ProposeAdminParams) UnmarshalHex(data string) error { // ProposeAdministrator is a Record type type ProposeAdministrator struct { - TokenConfigCid *types.CONTRACT_ID `json:"tokenConfigCid" hex:"optional"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - NewAdmin types.PARTY `json:"newAdmin"` - Caller types.PARTY `json:"caller"` + TokenConfigCid *types.CONTRACT_ID `json:"tokenConfigCid" hex:"optional"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + NewAdmin types.PARTY `json:"newAdmin"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts ProposeAdministrator to a map for DAML arguments @@ -5572,6 +4662,8 @@ func (t ProposeAdministrator) ToMap() map[string]any { m["newAdmin"] = t.NewAdmin.ToMap() + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -5599,16 +4691,16 @@ func (t *ProposeAdministrator) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// ProposeAdministratorResult is a Record type -type ProposeAdministratorResult struct { +// ProposeAdministratorResult2 is a Record type +type ProposeAdministratorResult2 struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` Created types.BOOL `json:"created"` Index types.INT64 `json:"index"` } -// ToMap converts ProposeAdministratorResult to a map for DAML arguments -func (t ProposeAdministratorResult) ToMap() map[string]any { +// ToMap converts ProposeAdministratorResult2 to a map for DAML arguments +func (t ProposeAdministratorResult2) ToMap() map[string]any { m := make(map[string]any) m["tokenAdminRegistryCid"] = model.NestedToDAMLValue(t.TokenAdminRegistryCid) @@ -5622,35 +4714,36 @@ func (t ProposeAdministratorResult) ToMap() map[string]any { return m } -func (t ProposeAdministratorResult) MarshalJSON() ([]byte, error) { +func (t ProposeAdministratorResult2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *ProposeAdministratorResult) UnmarshalJSON(data []byte) error { +func (t *ProposeAdministratorResult2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes ProposeAdministratorResult to hex string (Canton MCMS format) -func (t ProposeAdministratorResult) MarshalHex() (string, error) { +// MarshalHex encodes ProposeAdministratorResult2 to hex string (Canton MCMS format) +func (t ProposeAdministratorResult2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes ProposeAdministratorResult from hex string (Canton MCMS format) -func (t *ProposeAdministratorResult) UnmarshalHex(data string) error { +// UnmarshalHex decodes ProposeAdministratorResult2 from hex string (Canton MCMS format) +func (t *ProposeAdministratorResult2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } // QuoteGasForExec is a Record type type QuoteGasForExec struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - NonCalldataGas types.INT64 `json:"nonCalldataGas"` - CalldataSize types.INT64 `json:"calldataSize"` - FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` - Caller types.PARTY `json:"caller"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + NonCalldataGas types.INT64 `json:"nonCalldataGas"` + CalldataSize types.INT64 `json:"calldataSize"` + FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts QuoteGasForExec to a map for DAML arguments @@ -5665,6 +4758,8 @@ func (t QuoteGasForExec) ToMap() map[string]any { m["feeToken"] = model.NestedToDAMLValue(t.FeeToken) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -5695,10 +4790,11 @@ func (t *QuoteGasForExec) UnmarshalHex(data string) error { // QuoteGasForExecMCMSParams is QuoteGasForExec without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type QuoteGasForExecMCMSParams struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - NonCalldataGas types.INT64 `json:"nonCalldataGas"` - CalldataSize types.INT64 `json:"calldataSize"` - FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + NonCalldataGas types.INT64 `json:"nonCalldataGas"` + CalldataSize types.INT64 `json:"calldataSize"` + FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes QuoteGasForExecMCMSParams to hex string for MCMS operationData. @@ -5713,16 +4809,16 @@ func (t *QuoteGasForExecMCMSParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// QuoteGasForExecResult is a Record type -type QuoteGasForExecResult struct { +// QuoteGasForExecResult2 is a Record type +type QuoteGasForExecResult2 struct { TotalGas types.INT64 `json:"totalGas"` GasCostUSDCents types.NUMERIC `json:"gasCostUSDCents"` FeeTokenPrice types.NUMERIC `json:"feeTokenPrice"` PremiumMultiplier types.NUMERIC `json:"premiumMultiplier"` } -// ToMap converts QuoteGasForExecResult to a map for DAML arguments -func (t QuoteGasForExecResult) ToMap() map[string]any { +// ToMap converts QuoteGasForExecResult2 to a map for DAML arguments +func (t QuoteGasForExecResult2) ToMap() map[string]any { m := make(map[string]any) m["totalGas"] = int64(t.TotalGas) @@ -5736,24 +4832,24 @@ func (t QuoteGasForExecResult) ToMap() map[string]any { return m } -func (t QuoteGasForExecResult) MarshalJSON() ([]byte, error) { +func (t QuoteGasForExecResult2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *QuoteGasForExecResult) UnmarshalJSON(data []byte) error { +func (t *QuoteGasForExecResult2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes QuoteGasForExecResult to hex string (Canton MCMS format) -func (t QuoteGasForExecResult) MarshalHex() (string, error) { +// MarshalHex encodes QuoteGasForExecResult2 to hex string (Canton MCMS format) +func (t QuoteGasForExecResult2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes QuoteGasForExecResult from hex string (Canton MCMS format) -func (t *QuoteGasForExecResult) UnmarshalHex(data string) error { +// UnmarshalHex decodes QuoteGasForExecResult2 from hex string (Canton MCMS format) +func (t *QuoteGasForExecResult2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -5769,12 +4865,12 @@ type RMNRemote struct { // GetTemplateID returns the template ID for this template using the package name func (t RMNRemote) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t RMNRemote) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote") } // CreateCommand returns a CreateCommand for this template using the package name @@ -5879,7 +4975,7 @@ func (t *RMNRemote) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t RMNRemote) UncurseChain(contractID string, args UncurseChain) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "UncurseChain", Arguments: argsToMap(args), @@ -5889,7 +4985,7 @@ func (t RMNRemote) UncurseChain(contractID string, args UncurseChain) *model.Exe // UncurseChainWithPackageID exercises the UncurseChain choice using the provided package ID instead of package name func (t RMNRemote) UncurseChainWithPackageID(contractID string, packageID string, args UncurseChain) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "UncurseChain", Arguments: argsToMap(args), @@ -5900,7 +4996,7 @@ func (t RMNRemote) UncurseChainWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t RMNRemote) CurseChain(contractID string, args CurseChain) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "CurseChain", Arguments: argsToMap(args), @@ -5910,7 +5006,7 @@ func (t RMNRemote) CurseChain(contractID string, args CurseChain) *model.Exercis // CurseChainWithPackageID exercises the CurseChain choice using the provided package ID instead of package name func (t RMNRemote) CurseChainWithPackageID(contractID string, packageID string, args CurseChain) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "CurseChain", Arguments: argsToMap(args), @@ -5921,7 +5017,7 @@ func (t RMNRemote) CurseChainWithPackageID(contractID string, packageID string, // This method uses the package name in the template ID func (t RMNRemote) UncurseGlobal(contractID string, args UncurseGlobal) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "UncurseGlobal", Arguments: argsToMap(args), @@ -5931,7 +5027,7 @@ func (t RMNRemote) UncurseGlobal(contractID string, args UncurseGlobal) *model.E // UncurseGlobalWithPackageID exercises the UncurseGlobal choice using the provided package ID instead of package name func (t RMNRemote) UncurseGlobalWithPackageID(contractID string, packageID string, args UncurseGlobal) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "UncurseGlobal", Arguments: argsToMap(args), @@ -5942,7 +5038,7 @@ func (t RMNRemote) UncurseGlobalWithPackageID(contractID string, packageID strin // This method uses the package name in the template ID func (t RMNRemote) CurseGlobal(contractID string, args CurseGlobal) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "CurseGlobal", Arguments: argsToMap(args), @@ -5952,7 +5048,7 @@ func (t RMNRemote) CurseGlobal(contractID string, args CurseGlobal) *model.Exerc // CurseGlobalWithPackageID exercises the CurseGlobal choice using the provided package ID instead of package name func (t RMNRemote) CurseGlobalWithPackageID(contractID string, packageID string, args CurseGlobal) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "CurseGlobal", Arguments: argsToMap(args), @@ -5963,7 +5059,7 @@ func (t RMNRemote) CurseGlobalWithPackageID(contractID string, packageID string, // This method uses the package name in the template ID func (t RMNRemote) IsCursedForChain(contractID string, args IsCursedForChain) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "IsCursedForChain", Arguments: argsToMap(args), @@ -5973,7 +5069,7 @@ func (t RMNRemote) IsCursedForChain(contractID string, args IsCursedForChain) *m // IsCursedForChainWithPackageID exercises the IsCursedForChain choice using the provided package ID instead of package name func (t RMNRemote) IsCursedForChainWithPackageID(contractID string, packageID string, args IsCursedForChain) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "IsCursedForChain", Arguments: argsToMap(args), @@ -5984,7 +5080,7 @@ func (t RMNRemote) IsCursedForChainWithPackageID(contractID string, packageID st // This method uses the package name in the template ID func (t RMNRemote) Curse(contractID string, args Curse) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "Curse", Arguments: argsToMap(args), @@ -5994,7 +5090,7 @@ func (t RMNRemote) Curse(contractID string, args Curse) *model.ExerciseCommand { // CurseWithPackageID exercises the Curse choice using the provided package ID instead of package name func (t RMNRemote) CurseWithPackageID(contractID string, packageID string, args Curse) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "Curse", Arguments: argsToMap(args), @@ -6005,7 +5101,7 @@ func (t RMNRemote) CurseWithPackageID(contractID string, packageID string, args // This method uses the package name in the template ID func (t RMNRemote) Uncurse(contractID string, args Uncurse) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "Uncurse", Arguments: argsToMap(args), @@ -6015,7 +5111,7 @@ func (t RMNRemote) Uncurse(contractID string, args Uncurse) *model.ExerciseComma // UncurseWithPackageID exercises the Uncurse choice using the provided package ID instead of package name func (t RMNRemote) UncurseWithPackageID(contractID string, packageID string, args Uncurse) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "Uncurse", Arguments: argsToMap(args), @@ -6026,7 +5122,7 @@ func (t RMNRemote) UncurseWithPackageID(contractID string, packageID string, arg // This method uses the package name in the template ID func (t RMNRemote) CurseMultiple(contractID string, args CurseMultiple) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "CurseMultiple", Arguments: argsToMap(args), @@ -6036,7 +5132,7 @@ func (t RMNRemote) CurseMultiple(contractID string, args CurseMultiple) *model.E // CurseMultipleWithPackageID exercises the CurseMultiple choice using the provided package ID instead of package name func (t RMNRemote) CurseMultipleWithPackageID(contractID string, packageID string, args CurseMultiple) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "CurseMultiple", Arguments: argsToMap(args), @@ -6047,7 +5143,7 @@ func (t RMNRemote) CurseMultipleWithPackageID(contractID string, packageID strin // This method uses the package name in the template ID func (t RMNRemote) UncurseMultiple(contractID string, args UncurseMultiple) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "UncurseMultiple", Arguments: argsToMap(args), @@ -6057,7 +5153,7 @@ func (t RMNRemote) UncurseMultiple(contractID string, args UncurseMultiple) *mod // UncurseMultipleWithPackageID exercises the UncurseMultiple choice using the provided package ID instead of package name func (t RMNRemote) UncurseMultipleWithPackageID(contractID string, packageID string, args UncurseMultiple) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "UncurseMultiple", Arguments: argsToMap(args), @@ -6068,7 +5164,7 @@ func (t RMNRemote) UncurseMultipleWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t RMNRemote) IsCursed(contractID string, args IsCursed) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "IsCursed", Arguments: argsToMap(args), @@ -6078,18 +5174,18 @@ func (t RMNRemote) IsCursed(contractID string, args IsCursed) *model.ExerciseCom // IsCursedWithPackageID exercises the IsCursed choice using the provided package ID instead of package name func (t RMNRemote) IsCursedWithPackageID(contractID string, packageID string, args IsCursed) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "IsCursed", Arguments: argsToMap(args), } } -// Archive exercises the Archive choice on this RMNRemote contract via the IMCMSReceiver interface +// Archive exercises the Archive choice on this RMNRemote contract via the IIRMNRemote interface // This method uses the package name in the template ID func (t RMNRemote) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -6099,39 +5195,18 @@ func (t RMNRemote) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t RMNRemote) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, } } -// Get exercises the Get choice on this RMNRemote contract -// This method uses the package name in the template ID -func (t RMNRemote) Get(contractID string, args Get) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), - ContractID: contractID, - Choice: "Get", - Arguments: argsToMap(args), - } -} - -// GetWithPackageID exercises the Get choice using the provided package ID instead of package name -func (t RMNRemote) GetWithPackageID(contractID string, packageID string, args Get) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), - ContractID: contractID, - Choice: "Get", - Arguments: argsToMap(args), - } -} - // GetCursedSubjects exercises the GetCursedSubjects choice on this RMNRemote contract // This method uses the package name in the template ID func (t RMNRemote) GetCursedSubjects(contractID string, args GetCursedSubjects) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "GetCursedSubjects", Arguments: argsToMap(args), @@ -6141,7 +5216,7 @@ func (t RMNRemote) GetCursedSubjects(contractID string, args GetCursedSubjects) // GetCursedSubjectsWithPackageID exercises the GetCursedSubjects choice using the provided package ID instead of package name func (t RMNRemote) GetCursedSubjectsWithPackageID(contractID string, packageID string, args GetCursedSubjects) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "GetCursedSubjects", Arguments: argsToMap(args), @@ -6152,7 +5227,7 @@ func (t RMNRemote) GetCursedSubjectsWithPackageID(contractID string, packageID s // This method uses the package name in the template ID func (t RMNRemote) AddCustomObservers(contractID string, args AddCustomObservers) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "AddCustomObservers", Arguments: argsToMap(args), @@ -6162,7 +5237,7 @@ func (t RMNRemote) AddCustomObservers(contractID string, args AddCustomObservers // AddCustomObserversWithPackageID exercises the AddCustomObservers choice using the provided package ID instead of package name func (t RMNRemote) AddCustomObserversWithPackageID(contractID string, packageID string, args AddCustomObservers) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "AddCustomObservers", Arguments: argsToMap(args), @@ -6173,7 +5248,7 @@ func (t RMNRemote) AddCustomObserversWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t RMNRemote) RemoveCustomObservers(contractID string, args RemoveCustomObservers) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "RemoveCustomObservers", Arguments: argsToMap(args), @@ -6183,7 +5258,7 @@ func (t RMNRemote) RemoveCustomObservers(contractID string, args RemoveCustomObs // RemoveCustomObserversWithPackageID exercises the RemoveCustomObservers choice using the provided package ID instead of package name func (t RMNRemote) RemoveCustomObserversWithPackageID(contractID string, packageID string, args RemoveCustomObservers) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "RemoveCustomObservers", Arguments: argsToMap(args), @@ -6194,7 +5269,7 @@ func (t RMNRemote) RemoveCustomObserversWithPackageID(contractID string, package // This method uses the package name in the template ID func (t RMNRemote) UpdateCCIPOwner(contractID string, args UpdateCCIPOwner) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "UpdateCCIPOwner", Arguments: argsToMap(args), @@ -6204,7 +5279,7 @@ func (t RMNRemote) UpdateCCIPOwner(contractID string, args UpdateCCIPOwner) *mod // UpdateCCIPOwnerWithPackageID exercises the UpdateCCIPOwner choice using the provided package ID instead of package name func (t RMNRemote) UpdateCCIPOwnerWithPackageID(contractID string, packageID string, args UpdateCCIPOwner) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "RMNRemote"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "RMNRemote"), ContractID: contractID, Choice: "UpdateCCIPOwner", Arguments: argsToMap(args), @@ -6215,7 +5290,7 @@ func (t RMNRemote) UpdateCCIPOwnerWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t RMNRemote) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RMNRemote", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -6225,463 +5300,102 @@ func (t RMNRemote) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiv // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t RMNRemote) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RMNRemote", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), } } -// Verify interface implementations for RMNRemote - -var _ api.IMCMSReceiver = (*RMNRemote)(nil) - -// RateLimitDirection is an enum type -type RateLimitDirection string - -const ( - RateLimitDirectionRateLimitDirection_Outbound RateLimitDirection = "RateLimitDirection_Outbound" - - RateLimitDirectionRateLimitDirection_Inbound RateLimitDirection = "RateLimitDirection_Inbound" -) - -func (e RateLimitDirection) GetEnumConstructor() string { return string(e) } - -func (e RateLimitDirection) GetEnumTypeID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiter", "RateLimitDirection") +// RMNRemotePublicFetch exercises the RMNRemote_PublicFetch choice on this RMNRemote contract via the IIRMNRemote interface +// This method uses the package name in the template ID +func (t RMNRemote) RMNRemotePublicFetch(contractID string, args ccipapi.RMNRemotePublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "IRMNRemote"), + ContractID: contractID, + Choice: "RMNRemote_PublicFetch", + Arguments: argsToMap(args), + } } -// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name -func (e RateLimitDirection) GetEnumTypeIDWithPackageID(packageID string) string { - return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiter", "RateLimitDirection") +// RMNRemotePublicFetchWithPackageID exercises the RMNRemote_PublicFetch choice using the provided package ID instead of package name +func (t RMNRemote) RMNRemotePublicFetchWithPackageID(contractID string, packageID string, args ccipapi.RMNRemotePublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "IRMNRemote"), + ContractID: contractID, + Choice: "RMNRemote_PublicFetch", + Arguments: argsToMap(args), + } } -func (e RateLimitDirection) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(e) +// RMNRemoteIsCursed exercises the RMNRemote_IsCursed choice on this RMNRemote contract via the IIRMNRemote interface +// This method uses the package name in the template ID +func (t RMNRemote) RMNRemoteIsCursed(contractID string, args ccipapi.RMNRemoteIsCursed) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "IRMNRemote"), + ContractID: contractID, + Choice: "RMNRemote_IsCursed", + Arguments: argsToMap(args), + } } -func (e *RateLimitDirection) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, e) +// RMNRemoteIsCursedWithPackageID exercises the RMNRemote_IsCursed choice using the provided package ID instead of package name +func (t RMNRemote) RMNRemoteIsCursedWithPackageID(contractID string, packageID string, args ccipapi.RMNRemoteIsCursed) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "IRMNRemote"), + ContractID: contractID, + Choice: "RMNRemote_IsCursed", + Arguments: argsToMap(args), + } } -// MarshalHex encodes RateLimitDirection to hex string (Canton MCMS format) -func (e RateLimitDirection) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(e) +// RMNRemoteIsCursedForChain exercises the RMNRemote_IsCursedForChain choice on this RMNRemote contract via the IIRMNRemote interface +// This method uses the package name in the template ID +func (t RMNRemote) RMNRemoteIsCursedForChain(contractID string, args ccipapi.RMNRemoteIsCursedForChain) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "IRMNRemote"), + ContractID: contractID, + Choice: "RMNRemote_IsCursedForChain", + Arguments: argsToMap(args), + } } -// UnmarshalHex decodes RateLimitDirection from hex string (Canton MCMS format) -func (e *RateLimitDirection) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, e) +// RMNRemoteIsCursedForChainWithPackageID exercises the RMNRemote_IsCursedForChain choice using the provided package ID instead of package name +func (t RMNRemote) RMNRemoteIsCursedForChainWithPackageID(contractID string, packageID string, args ccipapi.RMNRemoteIsCursedForChain) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "IRMNRemote"), + ContractID: contractID, + Choice: "RMNRemote_IsCursedForChain", + Arguments: argsToMap(args), + } } -var _ types.ENUM = RateLimitDirection("") - -// GetEnumTagByte implements types.EnumWithTagByte interface for MCMS single-byte ordinal encoding. -func (e RateLimitDirection) GetEnumTagByte() byte { - - if string(e) == "RateLimitDirection_Outbound" { - return 0 +// RMNRemoteGetCursedSubjects exercises the RMNRemote_GetCursedSubjects choice on this RMNRemote contract via the IIRMNRemote interface +// This method uses the package name in the template ID +func (t RMNRemote) RMNRemoteGetCursedSubjects(contractID string, args ccipapi.RMNRemoteGetCursedSubjects) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.RMNRemote", "IRMNRemote"), + ContractID: contractID, + Choice: "RMNRemote_GetCursedSubjects", + Arguments: argsToMap(args), } +} - if string(e) == "RateLimitDirection_Inbound" { - return 1 - } - - return 0xFF // Invalid/unknown constructor -} - -// EnumConstructorForTagByte implements types.EnumWithTagByte: reverse maps a tag byte to constructor name. -func (e RateLimitDirection) EnumConstructorForTagByte(tag byte) (string, bool) { - - if tag == 0 { - return "RateLimitDirection_Outbound", true - } - - if tag == 1 { - return "RateLimitDirection_Inbound", true - } - - return "", false -} - -var _ types.EnumWithTagByte = RateLimitDirection("") - -// RateLimitMode is an enum type -type RateLimitMode string - -const ( - RateLimitModeRateLimitMode_DefaultFinality RateLimitMode = "RateLimitMode_DefaultFinality" - - RateLimitModeRateLimitMode_CustomFinality RateLimitMode = "RateLimitMode_CustomFinality" -) - -func (e RateLimitMode) GetEnumConstructor() string { return string(e) } - -func (e RateLimitMode) GetEnumTypeID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiter", "RateLimitMode") -} - -// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name -func (e RateLimitMode) GetEnumTypeIDWithPackageID(packageID string) string { - return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiter", "RateLimitMode") -} - -func (e RateLimitMode) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(e) -} - -func (e *RateLimitMode) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, e) -} - -// MarshalHex encodes RateLimitMode to hex string (Canton MCMS format) -func (e RateLimitMode) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(e) -} - -// UnmarshalHex decodes RateLimitMode from hex string (Canton MCMS format) -func (e *RateLimitMode) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, e) -} - -var _ types.ENUM = RateLimitMode("") - -// GetEnumTagByte implements types.EnumWithTagByte interface for MCMS single-byte ordinal encoding. -func (e RateLimitMode) GetEnumTagByte() byte { - - if string(e) == "RateLimitMode_DefaultFinality" { - return 0 - } - - if string(e) == "RateLimitMode_CustomFinality" { - return 1 - } - - return 0xFF // Invalid/unknown constructor -} - -// EnumConstructorForTagByte implements types.EnumWithTagByte: reverse maps a tag byte to constructor name. -func (e RateLimitMode) EnumConstructorForTagByte(tag byte) (string, bool) { - - if tag == 0 { - return "RateLimitMode_DefaultFinality", true - } - - if tag == 1 { - return "RateLimitMode_CustomFinality", true - } - - return "", false -} - -var _ types.EnumWithTagByte = RateLimitMode("") - -// RateLimiter is a Template type -type RateLimiter struct { - InstanceId types.TEXT `json:"instanceId"` - PoolInstanceId types.TEXT `json:"poolInstanceId"` - PoolOwner types.PARTY `json:"poolOwner"` - RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` - Direction RateLimitDirection `json:"direction"` - Mode RateLimitMode `json:"mode"` - IsEnabled types.BOOL `json:"isEnabled"` - Capacity types.NUMERIC `json:"capacity"` - Rate types.NUMERIC `json:"rate"` - Tokens types.NUMERIC `json:"tokens"` - LastUpdated types.TIMESTAMP `json:"lastUpdated"` -} - -// GetTemplateID returns the template ID for this template using the package name -func (t RateLimiter) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiter", "RateLimiter") -} - -// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name -func (t RateLimiter) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.RateLimiter", "RateLimiter") -} - -// CreateCommand returns a CreateCommand for this template using the package name -func (t RateLimiter) CreateCommand() *model.CreateCommand { - args := make(map[string]any) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["instanceId"] = string(t.InstanceId) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolInstanceId"] = string(t.PoolInstanceId) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolOwner"] = t.PoolOwner.ToMap() - - if t.RemoteChainSelector != "" { - args["remoteChainSelector"] = t.RemoteChainSelector - } - - if t.Direction != "" { - args["direction"] = model.NestedToDAMLValue(t.Direction) - } - - if t.Mode != "" { - args["mode"] = model.NestedToDAMLValue(t.Mode) - } - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["isEnabled"] = bool(t.IsEnabled) - - if t.Capacity != "" { - args["capacity"] = t.Capacity - } - - if t.Rate != "" { - args["rate"] = t.Rate - } - - if t.Tokens != "" { - args["tokens"] = t.Tokens - } - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["lastUpdated"] = t.LastUpdated - - return &model.CreateCommand{ - TemplateID: t.GetTemplateID(), - Arguments: args, - } -} - -// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name -func (t RateLimiter) CreateCommandWithPackageID(packageID string) *model.CreateCommand { - args := make(map[string]any) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["instanceId"] = string(t.InstanceId) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolInstanceId"] = string(t.PoolInstanceId) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolOwner"] = t.PoolOwner.ToMap() - - if t.RemoteChainSelector != "" { - args["remoteChainSelector"] = t.RemoteChainSelector - } - - if t.Direction != "" { - args["direction"] = model.NestedToDAMLValue(t.Direction) - } - - if t.Mode != "" { - args["mode"] = model.NestedToDAMLValue(t.Mode) - } - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["isEnabled"] = bool(t.IsEnabled) - - if t.Capacity != "" { - args["capacity"] = t.Capacity - } - - if t.Rate != "" { - args["rate"] = t.Rate - } - - if t.Tokens != "" { - args["tokens"] = t.Tokens - } - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["lastUpdated"] = t.LastUpdated - - return &model.CreateCommand{ - TemplateID: t.GetTemplateIDWithPackageID(packageID), - Arguments: args, - } -} - -func (t RateLimiter) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *RateLimiter) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes RateLimiter to hex string (Canton MCMS format) -func (t RateLimiter) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes RateLimiter from hex string (Canton MCMS format) -func (t *RateLimiter) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// Choice methods for RateLimiter - -// ConsumeCapacity exercises the ConsumeCapacity choice on this RateLimiter contract -// This method uses the package name in the template ID -func (t RateLimiter) ConsumeCapacity(contractID string, args ConsumeCapacity) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiter", "RateLimiter"), - ContractID: contractID, - Choice: "ConsumeCapacity", - Arguments: argsToMap(args), - } -} - -// ConsumeCapacityWithPackageID exercises the ConsumeCapacity choice using the provided package ID instead of package name -func (t RateLimiter) ConsumeCapacityWithPackageID(contractID string, packageID string, args ConsumeCapacity) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiter", "RateLimiter"), - ContractID: contractID, - Choice: "ConsumeCapacity", - Arguments: argsToMap(args), - } -} - -// SetConfig exercises the SetConfig choice on this RateLimiter contract -// This method uses the package name in the template ID -func (t RateLimiter) SetConfig(contractID string, args SetConfig) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiter", "RateLimiter"), - ContractID: contractID, - Choice: "SetConfig", - Arguments: argsToMap(args), - } -} - -// SetConfigWithPackageID exercises the SetConfig choice using the provided package ID instead of package name -func (t RateLimiter) SetConfigWithPackageID(contractID string, packageID string, args SetConfig) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiter", "RateLimiter"), - ContractID: contractID, - Choice: "SetConfig", - Arguments: argsToMap(args), - } -} - -// Archive exercises the Archive choice on this RateLimiter contract via the IMCMSReceiver interface -// This method uses the package name in the template ID -func (t RateLimiter) Archive(contractID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiter", "MCMSReceiver"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name -func (t RateLimiter) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiter", "MCMSReceiver"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// MCMSReceiverEntrypoint exercises the MCMSReceiver_Entrypoint choice on this RateLimiter contract via the IMCMSReceiver interface -// This method uses the package name in the template ID -func (t RateLimiter) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiter", "MCMSReceiver"), - ContractID: contractID, - Choice: "MCMSReceiver_Entrypoint", - Arguments: argsToMap(args), - } -} - -// MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name -func (t RateLimiter) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { +// RMNRemoteGetCursedSubjectsWithPackageID exercises the RMNRemote_GetCursedSubjects choice using the provided package ID instead of package name +func (t RMNRemote) RMNRemoteGetCursedSubjectsWithPackageID(contractID string, packageID string, args ccipapi.RMNRemoteGetCursedSubjects) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiter", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.RMNRemote", "IRMNRemote"), ContractID: contractID, - Choice: "MCMSReceiver_Entrypoint", + Choice: "RMNRemote_GetCursedSubjects", Arguments: argsToMap(args), } } -// Verify interface implementations for RateLimiter - -var _ api.IMCMSReceiver = (*RateLimiter)(nil) - -// Receipt is a Record type -type Receipt struct { - IssuerType IssuerType `json:"issuerType"` - IssuerAddress types.TEXT `json:"issuerAddress"` - VersionTag *types.TEXT `json:"versionTag" hex:"optional"` - DestGasLimit types.INT64 `json:"destGasLimit"` - DestBytesOverhead types.INT64 `json:"destBytesOverhead"` - FeeTokenAmount types.NUMERIC `json:"feeTokenAmount"` - ExtraArgs types.TEXT `json:"extraArgs"` -} - -// ToMap converts Receipt to a map for DAML arguments -func (t Receipt) ToMap() map[string]any { - m := make(map[string]any) - - m["issuerType"] = model.NestedToDAMLValue(t.IssuerType) - - m["issuerAddress"] = string(t.IssuerAddress) - - if t.VersionTag != nil { - m["versionTag"] = map[string]any{ - "_type": "optional", - "value": string(*t.VersionTag), - } - } else { - m["versionTag"] = map[string]any{ - "_type": "optional", - "value": nil, - } - } - - m["destGasLimit"] = int64(t.DestGasLimit) - - m["destBytesOverhead"] = int64(t.DestBytesOverhead) - - m["feeTokenAmount"] = t.FeeTokenAmount - - m["extraArgs"] = string(t.ExtraArgs) - - return m -} - -func (t Receipt) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *Receipt) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} +// Verify interface implementations for RMNRemote -// MarshalHex encodes Receipt to hex string (Canton MCMS format) -func (t Receipt) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} +var _ api.IMCMSReceiver = (*RMNRemote)(nil) -// UnmarshalHex decodes Receipt from hex string (Canton MCMS format) -func (t *Receipt) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} +var _ ccipapi.IIRMNRemote = (*RMNRemote)(nil) // RemoveCustomObservers is a Record type type RemoveCustomObservers struct { @@ -6893,168 +5607,68 @@ func (t *RemovePriceUpdaters) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// SendingMessageDeps is a Record type -type SendingMessageDeps struct { - Router chainlinkapi.RawInstanceAddress `json:"router"` - OnRamp chainlinkapi.RawInstanceAddress `json:"onRamp"` - GlobalConfig chainlinkapi.RawInstanceAddress `json:"globalConfig"` - RmnRemote chainlinkapi.RawInstanceAddress `json:"rmnRemote"` - TokenAdminRegistry chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry"` - FeeQuoter chainlinkapi.RawInstanceAddress `json:"feeQuoter"` +// SendingMessage is a Template type +type SendingMessage struct { + Deps SendingMessageDeps `json:"deps"` + CcipOwner types.PARTY `json:"ccipOwner"` + Sender types.PARTY `json:"sender"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + DestAddressBytesLength types.INT64 `json:"destAddressBytesLength"` + SequenceNumber types.NUMERIC `json:"sequenceNumber"` + DestDefaultCCVs []chainlinkapi.RawInstanceAddress `json:"destDefaultCCVs"` + RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` + RequiredExecutor *chainlinkapi.RawInstanceAddress `json:"requiredExecutor" hex:"optional"` + ExecutorAddress types.TEXT `json:"executorAddress"` + ExecutionMode *ExecutionMode `json:"executionMode" hex:"optional"` + SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` + SenderAddress types.TEXT `json:"senderAddress"` + Receiver types.TEXT `json:"receiver"` + Payload types.TEXT `json:"payload"` + ExecutionGasLimit types.INT64 `json:"executionGasLimit"` + CcipReceiveGasLimit types.INT64 `json:"ccipReceiveGasLimit"` + CcvAndExecutorHash types.TEXT `json:"ccvAndExecutorHash"` + OnRampAddress types.TEXT `json:"onRampAddress"` + OffRampAddress types.TEXT `json:"offRampAddress" hex:"bytes"` + TokenReceiver types.TEXT `json:"tokenReceiver"` + TokenArgs types.TEXT `json:"tokenArgs"` + FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` + NetworkFeeUSDCents types.NUMERIC `json:"networkFeeUSDCents"` + ExpectedTokenInstrumentId *splice_api_token_holding_v1.InstrumentId `json:"expectedTokenInstrumentId" hex:"optional"` + TokenAmountBeforeTokenPoolFees types.NUMERIC `json:"tokenAmountBeforeTokenPoolFees"` + OutboundPoolCCVs *[]chainlinkapi.RawInstanceAddress `json:"outboundPoolCCVs" hex:"optional"` + ExecutorArgs types.TEXT `json:"executorArgs"` + ExecutorFee *ExecutorFee `json:"executorFee" hex:"optional"` + ExecutorDestGasLimit types.INT64 `json:"executorDestGasLimit"` + ExecutorDestBytesOverhead types.INT64 `json:"executorDestBytesOverhead"` + ExecutorFeeTokenAmount types.NUMERIC `json:"executorFeeTokenAmount"` + ObservingParties []types.PARTY `json:"observingParties"` + CcvFees []CCVFee `json:"ccvFees"` + TokenSendFee *TokenSendFee `json:"tokenSendFee" hex:"optional"` + CcvFeeTokenAmounts []types.NUMERIC `json:"ccvFeeTokenAmounts"` + TokenSendFeeTokenAmount types.NUMERIC `json:"tokenSendFeeTokenAmount"` + NetworkFeeTokenAmount types.NUMERIC `json:"networkFeeTokenAmount"` + TokenSendData *TokenSendData `json:"tokenSendData" hex:"optional"` + VerifierData []VerifierData `json:"verifierData"` + CcvOwners []types.PARTY `json:"ccvOwners"` + Message *ccipcodec.MessageV1 `json:"message" hex:"optional"` + EncodedMessage types.TEXT `json:"encodedMessage"` + MessageId types.TEXT `json:"messageId"` + State SendingMessageState `json:"state"` } -// ToMap converts SendingMessageDeps to a map for DAML arguments -func (t SendingMessageDeps) ToMap() map[string]any { - m := make(map[string]any) +// GetTemplateID returns the template ID for this template using the package name +func (t SendingMessage) GetTemplateID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage") +} - m["router"] = model.NestedToDAMLValue(t.Router) +// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name +func (t SendingMessage) GetTemplateIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage") +} - m["onRamp"] = model.NestedToDAMLValue(t.OnRamp) - - m["globalConfig"] = model.NestedToDAMLValue(t.GlobalConfig) - - m["rmnRemote"] = model.NestedToDAMLValue(t.RmnRemote) - - m["tokenAdminRegistry"] = model.NestedToDAMLValue(t.TokenAdminRegistry) - - m["feeQuoter"] = model.NestedToDAMLValue(t.FeeQuoter) - - return m -} - -func (t SendingMessageDeps) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *SendingMessageDeps) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes SendingMessageDeps to hex string (Canton MCMS format) -func (t SendingMessageDeps) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes SendingMessageDeps from hex string (Canton MCMS format) -func (t *SendingMessageDeps) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// SendingMessageState is an enum type -type SendingMessageState string - -const ( - SendingMessageStateSendingMessageState_RequirePoolCCVs SendingMessageState = "SendingMessageState_RequirePoolCCVs" - - SendingMessageStateSendingMessageState_Prepared SendingMessageState = "SendingMessageState_Prepared" - - SendingMessageStateSendingMessageState_TokenLocked SendingMessageState = "SendingMessageState_TokenLocked" - - SendingMessageStateSendingMessageState_ExecutorFinalized SendingMessageState = "SendingMessageState_ExecutorFinalized" - - SendingMessageStateSendingMessageState_FeeFinalized SendingMessageState = "SendingMessageState_FeeFinalized" -) - -func (e SendingMessageState) GetEnumConstructor() string { return string(e) } - -func (e SendingMessageState) GetEnumTypeID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageState") -} - -// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name -func (e SendingMessageState) GetEnumTypeIDWithPackageID(packageID string) string { - return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageState") -} - -func (e SendingMessageState) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(e) -} - -func (e *SendingMessageState) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, e) -} - -// MarshalHex encodes SendingMessageState to hex string (Canton MCMS format) -func (e SendingMessageState) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(e) -} - -// UnmarshalHex decodes SendingMessageState from hex string (Canton MCMS format) -func (e *SendingMessageState) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, e) -} - -var _ types.ENUM = SendingMessageState("") - -// SendingMessageV1 is a Template type -type SendingMessageV1 struct { - Deps SendingMessageDeps `json:"deps"` - CcipOwner types.PARTY `json:"ccipOwner"` - Sender types.PARTY `json:"sender"` - DestChainSelector types.NUMERIC `json:"destChainSelector"` - DestAddressBytesLength types.INT64 `json:"destAddressBytesLength"` - SequenceNumber types.NUMERIC `json:"sequenceNumber"` - DestDefaultCCVs []chainlinkapi.RawInstanceAddress `json:"destDefaultCCVs"` - RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` - RequiredExecutor *chainlinkapi.RawInstanceAddress `json:"requiredExecutor" hex:"optional"` - ExecutorAddress types.TEXT `json:"executorAddress"` - ExecutionMode *ExecutionMode `json:"executionMode" hex:"optional"` - SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` - SenderAddress types.TEXT `json:"senderAddress"` - Receiver types.TEXT `json:"receiver"` - Payload types.TEXT `json:"payload"` - ExecutionGasLimit types.INT64 `json:"executionGasLimit"` - CcipReceiveGasLimit types.INT64 `json:"ccipReceiveGasLimit"` - CcvAndExecutorHash types.TEXT `json:"ccvAndExecutorHash"` - OnRampAddress types.TEXT `json:"onRampAddress"` - OffRampAddress types.TEXT `json:"offRampAddress" hex:"bytes"` - TokenReceiver types.TEXT `json:"tokenReceiver"` - TokenArgs types.TEXT `json:"tokenArgs"` - FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` - NetworkFeeUSDCents types.NUMERIC `json:"networkFeeUSDCents"` - ExpectedTokenInstrumentId *splice_api_token_holding_v1.InstrumentId `json:"expectedTokenInstrumentId" hex:"optional"` - OutboundPoolCCVs *[]chainlinkapi.RawInstanceAddress `json:"outboundPoolCCVs" hex:"optional"` - ExecutorArgs types.TEXT `json:"executorArgs"` - ExecutorFee *ExecutorFee `json:"executorFee" hex:"optional"` - ExecutorDestGasLimit types.INT64 `json:"executorDestGasLimit"` - ExecutorDestBytesOverhead types.INT64 `json:"executorDestBytesOverhead"` - ExecutorFeeTokenAmount types.NUMERIC `json:"executorFeeTokenAmount"` - ObservingParties []types.PARTY `json:"observingParties"` - CcvFees []CCVFee `json:"ccvFees"` - TokenSendFee *TokenSendFee `json:"tokenSendFee" hex:"optional"` - CcvFeeTokenAmounts []types.NUMERIC `json:"ccvFeeTokenAmounts"` - TokenSendFeeTokenAmount types.NUMERIC `json:"tokenSendFeeTokenAmount"` - NetworkFeeTokenAmount types.NUMERIC `json:"networkFeeTokenAmount"` - TokenSendData *TokenSendData `json:"tokenSendData" hex:"optional"` - VerifierData []VerifierData `json:"verifierData"` - CcvOwners []types.PARTY `json:"ccvOwners"` - Message *MessageV1 `json:"message" hex:"optional"` - EncodedMessage types.TEXT `json:"encodedMessage"` - MessageId types.TEXT `json:"messageId"` - State SendingMessageState `json:"state"` -} - -// GetTemplateID returns the template ID for this template using the package name -func (t SendingMessageV1) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1") -} - -// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name -func (t SendingMessageV1) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1") -} - -// CreateCommand returns a CreateCommand for this template using the package name -func (t SendingMessageV1) CreateCommand() *model.CreateCommand { - args := make(map[string]any) +// CreateCommand returns a CreateCommand for this template using the package name +func (t SendingMessage) CreateCommand() *model.CreateCommand { + args := make(map[string]any) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty args["deps"] = model.NestedToDAMLValue(t.Deps) @@ -7174,6 +5788,10 @@ func (t SendingMessageV1) CreateCommand() *model.CreateCommand { } } + if t.TokenAmountBeforeTokenPoolFees != "" { + args["tokenAmountBeforeTokenPoolFees"] = t.TokenAmountBeforeTokenPoolFees + } + if t.OutboundPoolCCVs != nil { args["outboundPoolCCVs"] = map[string]any{ "_type": "optional", @@ -7317,7 +5935,7 @@ func (t SendingMessageV1) CreateCommand() *model.CreateCommand { } // CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name -func (t SendingMessageV1) CreateCommandWithPackageID(packageID string) *model.CreateCommand { +func (t SendingMessage) CreateCommandWithPackageID(packageID string) *model.CreateCommand { args := make(map[string]any) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty @@ -7438,6 +6056,10 @@ func (t SendingMessageV1) CreateCommandWithPackageID(packageID string) *model.Cr } } + if t.TokenAmountBeforeTokenPoolFees != "" { + args["tokenAmountBeforeTokenPoolFees"] = t.TokenAmountBeforeTokenPoolFees + } + if t.OutboundPoolCCVs != nil { args["outboundPoolCCVs"] = map[string]any{ "_type": "optional", @@ -7580,35 +6202,35 @@ func (t SendingMessageV1) CreateCommandWithPackageID(packageID string) *model.Cr } } -func (t SendingMessageV1) MarshalJSON() ([]byte, error) { +func (t SendingMessage) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *SendingMessageV1) UnmarshalJSON(data []byte) error { +func (t *SendingMessage) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes SendingMessageV1 to hex string (Canton MCMS format) -func (t SendingMessageV1) MarshalHex() (string, error) { +// MarshalHex encodes SendingMessage to hex string (Canton MCMS format) +func (t SendingMessage) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes SendingMessageV1 from hex string (Canton MCMS format) -func (t *SendingMessageV1) UnmarshalHex(data string) error { +// UnmarshalHex decodes SendingMessage from hex string (Canton MCMS format) +func (t *SendingMessage) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } -// Choice methods for SendingMessageV1 +// Choice methods for SendingMessage -// AddTokenSend exercises the AddTokenSend choice on this SendingMessageV1 contract +// AddTokenSend exercises the AddTokenSend choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) AddTokenSend(contractID string, args AddTokenSend) *model.ExerciseCommand { +func (t SendingMessage) AddTokenSend(contractID string, args AddTokenSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddTokenSend", Arguments: argsToMap(args), @@ -7616,20 +6238,20 @@ func (t SendingMessageV1) AddTokenSend(contractID string, args AddTokenSend) *mo } // AddTokenSendWithPackageID exercises the AddTokenSend choice using the provided package ID instead of package name -func (t SendingMessageV1) AddTokenSendWithPackageID(contractID string, packageID string, args AddTokenSend) *model.ExerciseCommand { +func (t SendingMessage) AddTokenSendWithPackageID(contractID string, packageID string, args AddTokenSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddTokenSend", Arguments: argsToMap(args), } } -// AddVerifierData exercises the AddVerifierData choice on this SendingMessageV1 contract +// AddVerifierData exercises the AddVerifierData choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) AddVerifierData(contractID string, args AddVerifierData) *model.ExerciseCommand { +func (t SendingMessage) AddVerifierData(contractID string, args AddVerifierData) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddVerifierData", Arguments: argsToMap(args), @@ -7637,20 +6259,20 @@ func (t SendingMessageV1) AddVerifierData(contractID string, args AddVerifierDat } // AddVerifierDataWithPackageID exercises the AddVerifierData choice using the provided package ID instead of package name -func (t SendingMessageV1) AddVerifierDataWithPackageID(contractID string, packageID string, args AddVerifierData) *model.ExerciseCommand { +func (t SendingMessage) AddVerifierDataWithPackageID(contractID string, packageID string, args AddVerifierData) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddVerifierData", Arguments: argsToMap(args), } } -// AddCCVFee exercises the AddCCVFee choice on this SendingMessageV1 contract +// AddCCVFee exercises the AddCCVFee choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) AddCCVFee(contractID string, args AddCCVFee) *model.ExerciseCommand { +func (t SendingMessage) AddCCVFee(contractID string, args AddCCVFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddCCVFee", Arguments: argsToMap(args), @@ -7658,20 +6280,20 @@ func (t SendingMessageV1) AddCCVFee(contractID string, args AddCCVFee) *model.Ex } // AddCCVFeeWithPackageID exercises the AddCCVFee choice using the provided package ID instead of package name -func (t SendingMessageV1) AddCCVFeeWithPackageID(contractID string, packageID string, args AddCCVFee) *model.ExerciseCommand { +func (t SendingMessage) AddCCVFeeWithPackageID(contractID string, packageID string, args AddCCVFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddCCVFee", Arguments: argsToMap(args), } } -// BuildMessage exercises the BuildMessage choice on this SendingMessageV1 contract +// BuildMessage exercises the BuildMessage choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) BuildMessage(contractID string, args BuildMessage) *model.ExerciseCommand { +func (t SendingMessage) BuildMessage(contractID string, args BuildMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "BuildMessage", Arguments: argsToMap(args), @@ -7679,20 +6301,20 @@ func (t SendingMessageV1) BuildMessage(contractID string, args BuildMessage) *mo } // BuildMessageWithPackageID exercises the BuildMessage choice using the provided package ID instead of package name -func (t SendingMessageV1) BuildMessageWithPackageID(contractID string, packageID string, args BuildMessage) *model.ExerciseCommand { +func (t SendingMessage) BuildMessageWithPackageID(contractID string, packageID string, args BuildMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "BuildMessage", Arguments: argsToMap(args), } } -// AddTokenSendFee exercises the AddTokenSendFee choice on this SendingMessageV1 contract +// AddTokenSendFee exercises the AddTokenSendFee choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) AddTokenSendFee(contractID string, args AddTokenSendFee) *model.ExerciseCommand { +func (t SendingMessage) AddTokenSendFee(contractID string, args AddTokenSendFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddTokenSendFee", Arguments: argsToMap(args), @@ -7700,20 +6322,20 @@ func (t SendingMessageV1) AddTokenSendFee(contractID string, args AddTokenSendFe } // AddTokenSendFeeWithPackageID exercises the AddTokenSendFee choice using the provided package ID instead of package name -func (t SendingMessageV1) AddTokenSendFeeWithPackageID(contractID string, packageID string, args AddTokenSendFee) *model.ExerciseCommand { +func (t SendingMessage) AddTokenSendFeeWithPackageID(contractID string, packageID string, args AddTokenSendFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddTokenSendFee", Arguments: argsToMap(args), } } -// SetOutboundPoolCCVs exercises the SetOutboundPoolCCVs choice on this SendingMessageV1 contract +// SetOutboundPoolCCVs exercises the SetOutboundPoolCCVs choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) SetOutboundPoolCCVs(contractID string, args SetOutboundPoolCCVs) *model.ExerciseCommand { +func (t SendingMessage) SetOutboundPoolCCVs(contractID string, args SetOutboundPoolCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "SetOutboundPoolCCVs", Arguments: argsToMap(args), @@ -7721,20 +6343,20 @@ func (t SendingMessageV1) SetOutboundPoolCCVs(contractID string, args SetOutboun } // SetOutboundPoolCCVsWithPackageID exercises the SetOutboundPoolCCVs choice using the provided package ID instead of package name -func (t SendingMessageV1) SetOutboundPoolCCVsWithPackageID(contractID string, packageID string, args SetOutboundPoolCCVs) *model.ExerciseCommand { +func (t SendingMessage) SetOutboundPoolCCVsWithPackageID(contractID string, packageID string, args SetOutboundPoolCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "SetOutboundPoolCCVs", Arguments: argsToMap(args), } } -// AddExecutorFee exercises the AddExecutorFee choice on this SendingMessageV1 contract +// AddExecutorFee exercises the AddExecutorFee choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) AddExecutorFee(contractID string, args AddExecutorFee) *model.ExerciseCommand { +func (t SendingMessage) AddExecutorFee(contractID string, args AddExecutorFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddExecutorFee", Arguments: argsToMap(args), @@ -7742,20 +6364,20 @@ func (t SendingMessageV1) AddExecutorFee(contractID string, args AddExecutorFee) } // AddExecutorFeeWithPackageID exercises the AddExecutorFee choice using the provided package ID instead of package name -func (t SendingMessageV1) AddExecutorFeeWithPackageID(contractID string, packageID string, args AddExecutorFee) *model.ExerciseCommand { +func (t SendingMessage) AddExecutorFeeWithPackageID(contractID string, packageID string, args AddExecutorFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "AddExecutorFee", Arguments: argsToMap(args), } } -// FinalizeFee exercises the FinalizeFee choice on this SendingMessageV1 contract +// FinalizeFee exercises the FinalizeFee choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) FinalizeFee(contractID string, args FinalizeFee) *model.ExerciseCommand { +func (t SendingMessage) FinalizeFee(contractID string, args FinalizeFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "FinalizeFee", Arguments: argsToMap(args), @@ -7763,20 +6385,20 @@ func (t SendingMessageV1) FinalizeFee(contractID string, args FinalizeFee) *mode } // FinalizeFeeWithPackageID exercises the FinalizeFee choice using the provided package ID instead of package name -func (t SendingMessageV1) FinalizeFeeWithPackageID(contractID string, packageID string, args FinalizeFee) *model.ExerciseCommand { +func (t SendingMessage) FinalizeFeeWithPackageID(contractID string, packageID string, args FinalizeFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "FinalizeFee", Arguments: argsToMap(args), } } -// FinalizeSend exercises the FinalizeSend choice on this SendingMessageV1 contract +// FinalizeSend exercises the FinalizeSend choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) FinalizeSend(contractID string, args FinalizeSend) *model.ExerciseCommand { +func (t SendingMessage) FinalizeSend(contractID string, args FinalizeSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "FinalizeSend", Arguments: argsToMap(args), @@ -7784,20 +6406,20 @@ func (t SendingMessageV1) FinalizeSend(contractID string, args FinalizeSend) *mo } // FinalizeSendWithPackageID exercises the FinalizeSend choice using the provided package ID instead of package name -func (t SendingMessageV1) FinalizeSendWithPackageID(contractID string, packageID string, args FinalizeSend) *model.ExerciseCommand { +func (t SendingMessage) FinalizeSendWithPackageID(contractID string, packageID string, args FinalizeSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "FinalizeSend", Arguments: argsToMap(args), } } -// FeeTokenAmount exercises the FeeTokenAmount choice on this SendingMessageV1 contract +// FeeTokenAmount exercises the FeeTokenAmount choice on this SendingMessage contract // This method uses the package name in the template ID -func (t SendingMessageV1) FeeTokenAmount(contractID string, args FeeTokenAmount) *model.ExerciseCommand { +func (t SendingMessage) FeeTokenAmount(contractID string, args FeeTokenAmount) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "FeeTokenAmount", Arguments: argsToMap(args), @@ -7805,20 +6427,20 @@ func (t SendingMessageV1) FeeTokenAmount(contractID string, args FeeTokenAmount) } // FeeTokenAmountWithPackageID exercises the FeeTokenAmount choice using the provided package ID instead of package name -func (t SendingMessageV1) FeeTokenAmountWithPackageID(contractID string, packageID string, args FeeTokenAmount) *model.ExerciseCommand { +func (t SendingMessage) FeeTokenAmountWithPackageID(contractID string, packageID string, args FeeTokenAmount) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "FeeTokenAmount", Arguments: argsToMap(args), } } -// Archive exercises the Archive choice on this SendingMessageV1 contract +// Archive exercises the Archive choice on this SendingMessage contract via the IISendingMessage interface // This method uses the package name in the template ID -func (t SendingMessageV1) Archive(contractID string) *model.ExerciseCommand { +func (t SendingMessage) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -7826,21 +6448,211 @@ func (t SendingMessageV1) Archive(contractID string) *model.ExerciseCommand { } // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name -func (t SendingMessageV1) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { +func (t SendingMessage) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.SendingMessageV1", "SendingMessageV1"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessage"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, } } +// SendingMessageFeeTokenAmount exercises the SendingMessage_FeeTokenAmount choice on this SendingMessage contract via the IISendingMessage interface +// This method uses the package name in the template ID +func (t SendingMessage) SendingMessageFeeTokenAmount(contractID string, args ccipapi.SendingMessageFeeTokenAmount) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "ISendingMessage"), + ContractID: contractID, + Choice: "SendingMessage_FeeTokenAmount", + Arguments: argsToMap(args), + } +} + +// SendingMessageFeeTokenAmountWithPackageID exercises the SendingMessage_FeeTokenAmount choice using the provided package ID instead of package name +func (t SendingMessage) SendingMessageFeeTokenAmountWithPackageID(contractID string, packageID string, args ccipapi.SendingMessageFeeTokenAmount) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "ISendingMessage"), + ContractID: contractID, + Choice: "SendingMessage_FeeTokenAmount", + Arguments: argsToMap(args), + } +} + +// SendingMessageAddCCVFee exercises the SendingMessage_AddCCVFee choice on this SendingMessage contract via the IISendingMessage interface +// This method uses the package name in the template ID +func (t SendingMessage) SendingMessageAddCCVFee(contractID string, args ccipapi.SendingMessageAddCCVFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "ISendingMessage"), + ContractID: contractID, + Choice: "SendingMessage_AddCCVFee", + Arguments: argsToMap(args), + } +} + +// SendingMessageAddCCVFeeWithPackageID exercises the SendingMessage_AddCCVFee choice using the provided package ID instead of package name +func (t SendingMessage) SendingMessageAddCCVFeeWithPackageID(contractID string, packageID string, args ccipapi.SendingMessageAddCCVFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "ISendingMessage"), + ContractID: contractID, + Choice: "SendingMessage_AddCCVFee", + Arguments: argsToMap(args), + } +} + +// SendingMessageAddVerifierData exercises the SendingMessage_AddVerifierData choice on this SendingMessage contract via the IISendingMessage interface +// This method uses the package name in the template ID +func (t SendingMessage) SendingMessageAddVerifierData(contractID string, args ccipapi.SendingMessageAddVerifierData) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "ISendingMessage"), + ContractID: contractID, + Choice: "SendingMessage_AddVerifierData", + Arguments: argsToMap(args), + } +} + +// SendingMessageAddVerifierDataWithPackageID exercises the SendingMessage_AddVerifierData choice using the provided package ID instead of package name +func (t SendingMessage) SendingMessageAddVerifierDataWithPackageID(contractID string, packageID string, args ccipapi.SendingMessageAddVerifierData) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "ISendingMessage"), + ContractID: contractID, + Choice: "SendingMessage_AddVerifierData", + Arguments: argsToMap(args), + } +} + +// SendingMessageAddExecutorFee exercises the SendingMessage_AddExecutorFee choice on this SendingMessage contract via the IISendingMessage interface +// This method uses the package name in the template ID +func (t SendingMessage) SendingMessageAddExecutorFee(contractID string, args ccipapi.SendingMessageAddExecutorFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "ISendingMessage"), + ContractID: contractID, + Choice: "SendingMessage_AddExecutorFee", + Arguments: argsToMap(args), + } +} + +// SendingMessageAddExecutorFeeWithPackageID exercises the SendingMessage_AddExecutorFee choice using the provided package ID instead of package name +func (t SendingMessage) SendingMessageAddExecutorFeeWithPackageID(contractID string, packageID string, args ccipapi.SendingMessageAddExecutorFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "ISendingMessage"), + ContractID: contractID, + Choice: "SendingMessage_AddExecutorFee", + Arguments: argsToMap(args), + } +} + +// Verify interface implementations for SendingMessage + +var _ ccipapi.IISendingMessage = (*SendingMessage)(nil) + +// SendingMessageDeps is a Record type +type SendingMessageDeps struct { + Router chainlinkapi.RawInstanceAddress `json:"router"` + OnRamp chainlinkapi.RawInstanceAddress `json:"onRamp"` + GlobalConfig chainlinkapi.RawInstanceAddress `json:"globalConfig"` + RmnRemote chainlinkapi.RawInstanceAddress `json:"rmnRemote"` + TokenAdminRegistry chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry"` + FeeQuoter chainlinkapi.RawInstanceAddress `json:"feeQuoter"` +} + +// ToMap converts SendingMessageDeps to a map for DAML arguments +func (t SendingMessageDeps) ToMap() map[string]any { + m := make(map[string]any) + + m["router"] = model.NestedToDAMLValue(t.Router) + + m["onRamp"] = model.NestedToDAMLValue(t.OnRamp) + + m["globalConfig"] = model.NestedToDAMLValue(t.GlobalConfig) + + m["rmnRemote"] = model.NestedToDAMLValue(t.RmnRemote) + + m["tokenAdminRegistry"] = model.NestedToDAMLValue(t.TokenAdminRegistry) + + m["feeQuoter"] = model.NestedToDAMLValue(t.FeeQuoter) + + return m +} + +func (t SendingMessageDeps) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *SendingMessageDeps) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes SendingMessageDeps to hex string (Canton MCMS format) +func (t SendingMessageDeps) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SendingMessageDeps from hex string (Canton MCMS format) +func (t *SendingMessageDeps) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// SendingMessageState is an enum type +type SendingMessageState string + +const ( + SendingMessageStateSendingMessageState_RequirePoolCCVs SendingMessageState = "SendingMessageState_RequirePoolCCVs" + + SendingMessageStateSendingMessageState_Prepared SendingMessageState = "SendingMessageState_Prepared" + + SendingMessageStateSendingMessageState_TokenLocked SendingMessageState = "SendingMessageState_TokenLocked" + + SendingMessageStateSendingMessageState_ExecutorFinalized SendingMessageState = "SendingMessageState_ExecutorFinalized" + + SendingMessageStateSendingMessageState_FeeFinalized SendingMessageState = "SendingMessageState_FeeFinalized" +) + +func (e SendingMessageState) GetEnumConstructor() string { return string(e) } + +func (e SendingMessageState) GetEnumTypeID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.SendingMessage", "SendingMessageState") +} + +// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name +func (e SendingMessageState) GetEnumTypeIDWithPackageID(packageID string) string { + return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.SendingMessage", "SendingMessageState") +} + +func (e SendingMessageState) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(e) +} + +func (e *SendingMessageState) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, e) +} + +// MarshalHex encodes SendingMessageState to hex string (Canton MCMS format) +func (e SendingMessageState) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(e) +} + +// UnmarshalHex decodes SendingMessageState from hex string (Canton MCMS format) +func (e *SendingMessageState) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, e) +} + +var _ types.ENUM = SendingMessageState("") + // SetBurnMintFactory is a Record type type SetBurnMintFactory struct { - TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - BurnMintFactory *types.CONTRACT_ID `json:"burnMintFactory" hex:"optional"` - Caller types.PARTY `json:"caller"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + BurnMintFactory *types.CONTRACT_ID `json:"burnMintFactory" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts SetBurnMintFactory to a map for DAML arguments @@ -7863,6 +6675,8 @@ func (t SetBurnMintFactory) ToMap() map[string]any { } } + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -7893,8 +6707,9 @@ func (t *SetBurnMintFactory) UnmarshalHex(data string) error { // SetBurnMintFactoryMCMSParams is SetBurnMintFactory without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type SetBurnMintFactoryMCMSParams struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - BurnMintFactory *types.CONTRACT_ID `json:"burnMintFactory" hex:"optional"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + BurnMintFactory *types.CONTRACT_ID `json:"burnMintFactory" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes SetBurnMintFactoryMCMSParams to hex string for MCMS operationData. @@ -7958,62 +6773,24 @@ func (t *SetBurnMintFactoryParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// SetConfig is a Record type -type SetConfig struct { - NewIsEnabled types.BOOL `json:"newIsEnabled"` - NewCapacity types.NUMERIC `json:"newCapacity"` - NewRate types.NUMERIC `json:"newRate"` +// SetInboundPoolCCVs is a Record type +type SetInboundPoolCCVs struct { + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` + Caller types.PARTY `json:"caller"` } -// ToMap converts SetConfig to a map for DAML arguments -func (t SetConfig) ToMap() map[string]any { +// ToMap converts SetInboundPoolCCVs to a map for DAML arguments +func (t SetInboundPoolCCVs) ToMap() map[string]any { m := make(map[string]any) - m["newIsEnabled"] = bool(t.NewIsEnabled) + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["newCapacity"] = t.NewCapacity + m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) - m["newRate"] = t.NewRate - - return m -} - -func (t SetConfig) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *SetConfig) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes SetConfig to hex string (Canton MCMS format) -func (t SetConfig) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes SetConfig from hex string (Canton MCMS format) -func (t *SetConfig) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// SetInboundPoolCCVs is a Record type -type SetInboundPoolCCVs struct { - PoolInstanceId types.TEXT `json:"poolInstanceId"` - PoolOwner types.PARTY `json:"poolOwner"` - PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` -} - -// ToMap converts SetInboundPoolCCVs to a map for DAML arguments -func (t SetInboundPoolCCVs) ToMap() map[string]any { - m := make(map[string]any) - - m["poolInstanceId"] = string(t.PoolInstanceId) - - m["poolOwner"] = t.PoolOwner.ToMap() + m["poolInstanceId"] = string(t.PoolInstanceId) m["poolCCVs"] = func() []any { res := make([]any, 0, len(t.PoolCCVs)) @@ -8023,6 +6800,8 @@ func (t SetInboundPoolCCVs) ToMap() map[string]any { return res }() + m["caller"] = t.Caller.ToMap() + return m } @@ -8048,15 +6827,44 @@ func (t *SetInboundPoolCCVs) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } +// SetInboundPoolCCVsMCMSParams is SetInboundPoolCCVs without the Caller field for MCMS operationData encoding. +// ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. +type SetInboundPoolCCVsMCMSParams struct { + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` +} + +// MarshalHex encodes SetInboundPoolCCVsMCMSParams to hex string for MCMS operationData. +func (t SetInboundPoolCCVsMCMSParams) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SetInboundPoolCCVsMCMSParams from hex string. +func (t *SetInboundPoolCCVsMCMSParams) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + // SetOutboundPoolCCVs is a Record type type SetOutboundPoolCCVs struct { - PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` + Caller types.PARTY `json:"caller"` } // ToMap converts SetOutboundPoolCCVs to a map for DAML arguments func (t SetOutboundPoolCCVs) ToMap() map[string]any { m := make(map[string]any) + m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) + + m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + + m["poolInstanceId"] = string(t.PoolInstanceId) + m["poolCCVs"] = func() []any { res := make([]any, 0, len(t.PoolCCVs)) for _, e := range t.PoolCCVs { @@ -8065,6 +6873,8 @@ func (t SetOutboundPoolCCVs) ToMap() map[string]any { return res }() + m["caller"] = t.Caller.ToMap() + return m } @@ -8090,12 +6900,32 @@ func (t *SetOutboundPoolCCVs) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } +// SetOutboundPoolCCVsMCMSParams is SetOutboundPoolCCVs without the Caller field for MCMS operationData encoding. +// ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. +type SetOutboundPoolCCVsMCMSParams struct { + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolCCVs []chainlinkapi.RawInstanceAddress `json:"poolCCVs"` +} + +// MarshalHex encodes SetOutboundPoolCCVsMCMSParams to hex string for MCMS operationData. +func (t SetOutboundPoolCCVsMCMSParams) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SetOutboundPoolCCVsMCMSParams from hex string. +func (t *SetOutboundPoolCCVsMCMSParams) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + // SetPool is a Record type type SetPool struct { - TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - TokenPool *PoolRegistration `json:"tokenPool" hex:"optional"` - Caller types.PARTY `json:"caller"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + TokenPool *PoolRegistration2 `json:"tokenPool" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts SetPool to a map for DAML arguments @@ -8118,6 +6948,8 @@ func (t SetPool) ToMap() map[string]any { } } + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -8148,8 +6980,9 @@ func (t *SetPool) UnmarshalHex(data string) error { // SetPoolMCMSParams is SetPool without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type SetPoolMCMSParams struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - TokenPool *PoolRegistration `json:"tokenPool" hex:"optional"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + TokenPool *PoolRegistration2 `json:"tokenPool" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes SetPoolMCMSParams to hex string for MCMS operationData. @@ -8167,7 +7000,7 @@ func (t *SetPoolMCMSParams) UnmarshalHex(data string) error { // SetPoolParams is a Record type type SetPoolParams struct { InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - TokenPool *PoolRegistration `json:"tokenPool" hex:"optional"` + TokenPool *PoolRegistration2 `json:"tokenPool" hex:"optional"` } // ToMap converts SetPoolParams to a map for DAML arguments @@ -8215,10 +7048,11 @@ func (t *SetPoolParams) UnmarshalHex(data string) error { // SetTransferFactory is a Record type type SetTransferFactory struct { - TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - TransferFactory *types.CONTRACT_ID `json:"transferFactory" hex:"optional"` - Caller types.PARTY `json:"caller"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + TransferFactory *types.CONTRACT_ID `json:"transferFactory" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts SetTransferFactory to a map for DAML arguments @@ -8241,6 +7075,8 @@ func (t SetTransferFactory) ToMap() map[string]any { } } + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -8271,8 +7107,9 @@ func (t *SetTransferFactory) UnmarshalHex(data string) error { // SetTransferFactoryMCMSParams is SetTransferFactory without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type SetTransferFactoryMCMSParams struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - TransferFactory *types.CONTRACT_ID `json:"transferFactory" hex:"optional"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + TransferFactory *types.CONTRACT_ID `json:"transferFactory" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes SetTransferFactoryMCMSParams to hex string for MCMS operationData. @@ -8336,16 +7173,16 @@ func (t *SetTransferFactoryParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// SourceChainConfig is a Record type -type SourceChainConfig struct { +// SourceChainConfig2 is a Record type +type SourceChainConfig2 struct { IsEnabled types.BOOL `json:"isEnabled"` OnRampAddresses []types.TEXT `json:"onRampAddresses" hex:"[]bytes"` DefaultCCVs []chainlinkapi.RawInstanceAddress `json:"defaultCCVs"` LaneMandatedCCVs []chainlinkapi.RawInstanceAddress `json:"laneMandatedCCVs"` } -// ToMap converts SourceChainConfig to a map for DAML arguments -func (t SourceChainConfig) ToMap() map[string]any { +// ToMap converts SourceChainConfig2 to a map for DAML arguments +func (t SourceChainConfig2) ToMap() map[string]any { m := make(map[string]any) m["isEnabled"] = bool(t.IsEnabled) @@ -8377,24 +7214,24 @@ func (t SourceChainConfig) ToMap() map[string]any { return m } -func (t SourceChainConfig) MarshalJSON() ([]byte, error) { +func (t SourceChainConfig2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *SourceChainConfig) UnmarshalJSON(data []byte) error { +func (t *SourceChainConfig2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes SourceChainConfig to hex string (Canton MCMS format) -func (t SourceChainConfig) MarshalHex() (string, error) { +// MarshalHex encodes SourceChainConfig2 to hex string (Canton MCMS format) +func (t SourceChainConfig2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes SourceChainConfig from hex string (Canton MCMS format) -func (t *SourceChainConfig) UnmarshalHex(data string) error { +// UnmarshalHex decodes SourceChainConfig2 from hex string (Canton MCMS format) +func (t *SourceChainConfig2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -8465,14 +7302,14 @@ func (t *SourceChainConfigArgs) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// TimestampedPrice is a Record type -type TimestampedPrice struct { +// TimestampedPrice2 is a Record type +type TimestampedPrice2 struct { Price types.NUMERIC `json:"price"` Timestamp types.TIMESTAMP `json:"timestamp"` } -// ToMap converts TimestampedPrice to a map for DAML arguments -func (t TimestampedPrice) ToMap() map[string]any { +// ToMap converts TimestampedPrice2 to a map for DAML arguments +func (t TimestampedPrice2) ToMap() map[string]any { m := make(map[string]any) m["price"] = t.Price @@ -8482,24 +7319,24 @@ func (t TimestampedPrice) ToMap() map[string]any { return m } -func (t TimestampedPrice) MarshalJSON() ([]byte, error) { +func (t TimestampedPrice2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *TimestampedPrice) UnmarshalJSON(data []byte) error { +func (t *TimestampedPrice2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes TimestampedPrice to hex string (Canton MCMS format) -func (t TimestampedPrice) MarshalHex() (string, error) { +// MarshalHex encodes TimestampedPrice2 to hex string (Canton MCMS format) +func (t TimestampedPrice2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes TimestampedPrice from hex string (Canton MCMS format) -func (t *TimestampedPrice) UnmarshalHex(data string) error { +// UnmarshalHex decodes TimestampedPrice2 from hex string (Canton MCMS format) +func (t *TimestampedPrice2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -8507,18 +7344,18 @@ func (t *TimestampedPrice) UnmarshalHex(data string) error { // TokenAdminRegistry is a Template type type TokenAdminRegistry struct { InstanceId types.TEXT `json:"instanceId"` - Owner types.PARTY `json:"owner"` + CcipOwner types.PARTY `json:"ccipOwner"` EntryCount types.INT64 `json:"entryCount"` } // GetTemplateID returns the template ID for this template using the package name func (t TokenAdminRegistry) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t TokenAdminRegistry) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry") } // CreateCommand returns a CreateCommand for this template using the package name @@ -8529,7 +7366,7 @@ func (t TokenAdminRegistry) CreateCommand() *model.CreateCommand { args["instanceId"] = string(t.InstanceId) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["owner"] = t.Owner.ToMap() + args["ccipOwner"] = t.CcipOwner.ToMap() // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty args["entryCount"] = int64(t.EntryCount) @@ -8548,7 +7385,7 @@ func (t TokenAdminRegistry) CreateCommandWithPackageID(packageID string) *model. args["instanceId"] = string(t.InstanceId) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["owner"] = t.Owner.ToMap() + args["ccipOwner"] = t.CcipOwner.ToMap() // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty args["entryCount"] = int64(t.EntryCount) @@ -8587,7 +7424,7 @@ func (t *TokenAdminRegistry) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t TokenAdminRegistry) ProposeAdministrator(contractID string, args ProposeAdministrator) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "ProposeAdministrator", Arguments: argsToMap(args), @@ -8597,7 +7434,7 @@ func (t TokenAdminRegistry) ProposeAdministrator(contractID string, args Propose // ProposeAdministratorWithPackageID exercises the ProposeAdministrator choice using the provided package ID instead of package name func (t TokenAdminRegistry) ProposeAdministratorWithPackageID(contractID string, packageID string, args ProposeAdministrator) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "ProposeAdministrator", Arguments: argsToMap(args), @@ -8608,7 +7445,7 @@ func (t TokenAdminRegistry) ProposeAdministratorWithPackageID(contractID string, // This method uses the package name in the template ID func (t TokenAdminRegistry) FinalizeExecute(contractID string, args FinalizeExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "FinalizeExecute", Arguments: argsToMap(args), @@ -8618,39 +7455,18 @@ func (t TokenAdminRegistry) FinalizeExecute(contractID string, args FinalizeExec // FinalizeExecuteWithPackageID exercises the FinalizeExecute choice using the provided package ID instead of package name func (t TokenAdminRegistry) FinalizeExecuteWithPackageID(contractID string, packageID string, args FinalizeExecute) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "FinalizeExecute", Arguments: argsToMap(args), } } -// SetInboundPoolCCVs exercises the SetInboundPoolCCVs choice on this TokenAdminRegistry contract -// This method uses the package name in the template ID -func (t TokenAdminRegistry) SetInboundPoolCCVs(contractID string, args SetInboundPoolCCVs) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), - ContractID: contractID, - Choice: "SetInboundPoolCCVs", - Arguments: argsToMap(args), - } -} - -// SetInboundPoolCCVsWithPackageID exercises the SetInboundPoolCCVs choice using the provided package ID instead of package name -func (t TokenAdminRegistry) SetInboundPoolCCVsWithPackageID(contractID string, packageID string, args SetInboundPoolCCVs) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), - ContractID: contractID, - Choice: "SetInboundPoolCCVs", - Arguments: argsToMap(args), - } -} - // AddTokenSend exercises the AddTokenSend choice on this TokenAdminRegistry contract // This method uses the package name in the template ID func (t TokenAdminRegistry) AddTokenSend(contractID string, args AddTokenSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "AddTokenSend", Arguments: argsToMap(args), @@ -8660,7 +7476,7 @@ func (t TokenAdminRegistry) AddTokenSend(contractID string, args AddTokenSend) * // AddTokenSendWithPackageID exercises the AddTokenSend choice using the provided package ID instead of package name func (t TokenAdminRegistry) AddTokenSendWithPackageID(contractID string, packageID string, args AddTokenSend) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "AddTokenSend", Arguments: argsToMap(args), @@ -8671,7 +7487,7 @@ func (t TokenAdminRegistry) AddTokenSendWithPackageID(contractID string, package // This method uses the package name in the template ID func (t TokenAdminRegistry) AddTokenSendFee(contractID string, args AddTokenSendFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "AddTokenSendFee", Arguments: argsToMap(args), @@ -8681,7 +7497,7 @@ func (t TokenAdminRegistry) AddTokenSendFee(contractID string, args AddTokenSend // AddTokenSendFeeWithPackageID exercises the AddTokenSendFee choice using the provided package ID instead of package name func (t TokenAdminRegistry) AddTokenSendFeeWithPackageID(contractID string, packageID string, args AddTokenSendFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "AddTokenSendFee", Arguments: argsToMap(args), @@ -8692,7 +7508,7 @@ func (t TokenAdminRegistry) AddTokenSendFeeWithPackageID(contractID string, pack // This method uses the package name in the template ID func (t TokenAdminRegistry) SetOutboundPoolCCVs(contractID string, args SetOutboundPoolCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "SetOutboundPoolCCVs", Arguments: argsToMap(args), @@ -8702,39 +7518,18 @@ func (t TokenAdminRegistry) SetOutboundPoolCCVs(contractID string, args SetOutbo // SetOutboundPoolCCVsWithPackageID exercises the SetOutboundPoolCCVs choice using the provided package ID instead of package name func (t TokenAdminRegistry) SetOutboundPoolCCVsWithPackageID(contractID string, packageID string, args SetOutboundPoolCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "SetOutboundPoolCCVs", Arguments: argsToMap(args), } } -// ConsumeReceiveTicket exercises the ConsumeReceiveTicket choice on this TokenAdminRegistry contract -// This method uses the package name in the template ID -func (t TokenAdminRegistry) ConsumeReceiveTicket(contractID string, args ConsumeReceiveTicket) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), - ContractID: contractID, - Choice: "ConsumeReceiveTicket", - Arguments: argsToMap(args), - } -} - -// ConsumeReceiveTicketWithPackageID exercises the ConsumeReceiveTicket choice using the provided package ID instead of package name -func (t TokenAdminRegistry) ConsumeReceiveTicketWithPackageID(contractID string, packageID string, args ConsumeReceiveTicket) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), - ContractID: contractID, - Choice: "ConsumeReceiveTicket", - Arguments: argsToMap(args), - } -} - // IsAdministrator exercises the IsAdministrator choice on this TokenAdminRegistry contract // This method uses the package name in the template ID func (t TokenAdminRegistry) IsAdministrator(contractID string, args IsAdministrator) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "IsAdministrator", Arguments: argsToMap(args), @@ -8744,7 +7539,7 @@ func (t TokenAdminRegistry) IsAdministrator(contractID string, args IsAdministra // IsAdministratorWithPackageID exercises the IsAdministrator choice using the provided package ID instead of package name func (t TokenAdminRegistry) IsAdministratorWithPackageID(contractID string, packageID string, args IsAdministrator) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "IsAdministrator", Arguments: argsToMap(args), @@ -8755,7 +7550,7 @@ func (t TokenAdminRegistry) IsAdministratorWithPackageID(contractID string, pack // This method uses the package name in the template ID func (t TokenAdminRegistry) TransferAdminRole(contractID string, args TransferAdminRole) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "TransferAdminRole", Arguments: argsToMap(args), @@ -8765,7 +7560,7 @@ func (t TokenAdminRegistry) TransferAdminRole(contractID string, args TransferAd // TransferAdminRoleWithPackageID exercises the TransferAdminRole choice using the provided package ID instead of package name func (t TokenAdminRegistry) TransferAdminRoleWithPackageID(contractID string, packageID string, args TransferAdminRole) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "TransferAdminRole", Arguments: argsToMap(args), @@ -8776,7 +7571,7 @@ func (t TokenAdminRegistry) TransferAdminRoleWithPackageID(contractID string, pa // This method uses the package name in the template ID func (t TokenAdminRegistry) AcceptAdminRole(contractID string, args AcceptAdminRole) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "AcceptAdminRole", Arguments: argsToMap(args), @@ -8786,7 +7581,7 @@ func (t TokenAdminRegistry) AcceptAdminRole(contractID string, args AcceptAdminR // AcceptAdminRoleWithPackageID exercises the AcceptAdminRole choice using the provided package ID instead of package name func (t TokenAdminRegistry) AcceptAdminRoleWithPackageID(contractID string, packageID string, args AcceptAdminRole) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "AcceptAdminRole", Arguments: argsToMap(args), @@ -8797,7 +7592,7 @@ func (t TokenAdminRegistry) AcceptAdminRoleWithPackageID(contractID string, pack // This method uses the package name in the template ID func (t TokenAdminRegistry) SetBurnMintFactory(contractID string, args SetBurnMintFactory) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "SetBurnMintFactory", Arguments: argsToMap(args), @@ -8807,7 +7602,7 @@ func (t TokenAdminRegistry) SetBurnMintFactory(contractID string, args SetBurnMi // SetBurnMintFactoryWithPackageID exercises the SetBurnMintFactory choice using the provided package ID instead of package name func (t TokenAdminRegistry) SetBurnMintFactoryWithPackageID(contractID string, packageID string, args SetBurnMintFactory) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "SetBurnMintFactory", Arguments: argsToMap(args), @@ -8818,7 +7613,7 @@ func (t TokenAdminRegistry) SetBurnMintFactoryWithPackageID(contractID string, p // This method uses the package name in the template ID func (t TokenAdminRegistry) SetTransferFactory(contractID string, args SetTransferFactory) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "SetTransferFactory", Arguments: argsToMap(args), @@ -8828,7 +7623,7 @@ func (t TokenAdminRegistry) SetTransferFactory(contractID string, args SetTransf // SetTransferFactoryWithPackageID exercises the SetTransferFactory choice using the provided package ID instead of package name func (t TokenAdminRegistry) SetTransferFactoryWithPackageID(contractID string, packageID string, args SetTransferFactory) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "SetTransferFactory", Arguments: argsToMap(args), @@ -8839,7 +7634,7 @@ func (t TokenAdminRegistry) SetTransferFactoryWithPackageID(contractID string, p // This method uses the package name in the template ID func (t TokenAdminRegistry) SetPool(contractID string, args SetPool) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "SetPool", Arguments: argsToMap(args), @@ -8849,7 +7644,7 @@ func (t TokenAdminRegistry) SetPool(contractID string, args SetPool) *model.Exer // SetPoolWithPackageID exercises the SetPool choice using the provided package ID instead of package name func (t TokenAdminRegistry) SetPoolWithPackageID(contractID string, packageID string, args SetPool) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "SetPool", Arguments: argsToMap(args), @@ -8860,7 +7655,7 @@ func (t TokenAdminRegistry) SetPoolWithPackageID(contractID string, packageID st // This method uses the package name in the template ID func (t TokenAdminRegistry) GetTokenConfigByCid(contractID string, args GetTokenConfigByCid) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "GetTokenConfigByCid", Arguments: argsToMap(args), @@ -8870,18 +7665,60 @@ func (t TokenAdminRegistry) GetTokenConfigByCid(contractID string, args GetToken // GetTokenConfigByCidWithPackageID exercises the GetTokenConfigByCid choice using the provided package ID instead of package name func (t TokenAdminRegistry) GetTokenConfigByCidWithPackageID(contractID string, packageID string, args GetTokenConfigByCid) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "GetTokenConfigByCid", Arguments: argsToMap(args), } } -// Archive exercises the Archive choice on this TokenAdminRegistry contract via the IMCMSReceiver interface +// SetInboundPoolCCVs exercises the SetInboundPoolCCVs choice on this TokenAdminRegistry contract +// This method uses the package name in the template ID +func (t TokenAdminRegistry) SetInboundPoolCCVs(contractID string, args SetInboundPoolCCVs) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), + ContractID: contractID, + Choice: "SetInboundPoolCCVs", + Arguments: argsToMap(args), + } +} + +// SetInboundPoolCCVsWithPackageID exercises the SetInboundPoolCCVs choice using the provided package ID instead of package name +func (t TokenAdminRegistry) SetInboundPoolCCVsWithPackageID(contractID string, packageID string, args SetInboundPoolCCVs) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), + ContractID: contractID, + Choice: "SetInboundPoolCCVs", + Arguments: argsToMap(args), + } +} + +// ConsumeReceiveTicket exercises the ConsumeReceiveTicket choice on this TokenAdminRegistry contract +// This method uses the package name in the template ID +func (t TokenAdminRegistry) ConsumeReceiveTicket(contractID string, args ConsumeReceiveTicket) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), + ContractID: contractID, + Choice: "ConsumeReceiveTicket", + Arguments: argsToMap(args), + } +} + +// ConsumeReceiveTicketWithPackageID exercises the ConsumeReceiveTicket choice using the provided package ID instead of package name +func (t TokenAdminRegistry) ConsumeReceiveTicketWithPackageID(contractID string, packageID string, args ConsumeReceiveTicket) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), + ContractID: contractID, + Choice: "ConsumeReceiveTicket", + Arguments: argsToMap(args), + } +} + +// Archive exercises the Archive choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface // This method uses the package name in the template ID func (t TokenAdminRegistry) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -8891,7 +7728,7 @@ func (t TokenAdminRegistry) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t TokenAdminRegistry) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -8902,7 +7739,7 @@ func (t TokenAdminRegistry) ArchiveWithPackageID(contractID string, packageID st // This method uses the package name in the template ID func (t TokenAdminRegistry) Get(contractID string, args Get) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "Get", Arguments: argsToMap(args), @@ -8912,7 +7749,7 @@ func (t TokenAdminRegistry) Get(contractID string, args Get) *model.ExerciseComm // GetWithPackageID exercises the Get choice using the provided package ID instead of package name func (t TokenAdminRegistry) GetWithPackageID(contractID string, packageID string, args Get) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenAdminRegistry"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenAdminRegistry"), ContractID: contractID, Choice: "Get", Arguments: argsToMap(args), @@ -8923,7 +7760,7 @@ func (t TokenAdminRegistry) GetWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t TokenAdminRegistry) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -8933,132 +7770,340 @@ func (t TokenAdminRegistry) MCMSReceiverEntrypoint(contractID string, args api.M // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t TokenAdminRegistry) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), } } -// Verify interface implementations for TokenAdminRegistry - -var _ api.IMCMSReceiver = (*TokenAdminRegistry)(nil) - -// TokenConfig is a Template type -type TokenConfig struct { - InstanceId types.TEXT `json:"instanceId"` - RegistryInstanceId types.TEXT `json:"registryInstanceId"` - RegistryOwner types.PARTY `json:"registryOwner"` - Index types.INT64 `json:"index"` - IsCCIPManaged types.BOOL `json:"isCCIPManaged"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - Admin *types.PARTY `json:"admin" hex:"optional"` - PendingAdmin *types.PARTY `json:"pendingAdmin" hex:"optional"` - TokenPool *PoolRegistration `json:"tokenPool" hex:"optional"` - TransferFactory *types.CONTRACT_ID `json:"transferFactory" hex:"optional"` - BurnMintFactory *types.CONTRACT_ID `json:"burnMintFactory" hex:"optional"` +// TokenAdminRegistryPublicFetch exercises the TokenAdminRegistry_PublicFetch choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryPublicFetch(contractID string, args ccipapi.TokenAdminRegistryPublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_PublicFetch", + Arguments: argsToMap(args), + } } -// GetTemplateID returns the template ID for this template using the package name -func (t TokenConfig) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenConfig") +// TokenAdminRegistryPublicFetchWithPackageID exercises the TokenAdminRegistry_PublicFetch choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryPublicFetchWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryPublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_PublicFetch", + Arguments: argsToMap(args), + } } -// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name -func (t TokenConfig) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenConfig") +// TokenAdminRegistryFetchTokenConfig exercises the TokenAdminRegistry_FetchTokenConfig choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryFetchTokenConfig(contractID string, args ccipapi.TokenAdminRegistryFetchTokenConfig) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_FetchTokenConfig", + Arguments: argsToMap(args), + } } -// CreateCommand returns a CreateCommand for this template using the package name -func (t TokenConfig) CreateCommand() *model.CreateCommand { - args := make(map[string]any) +// TokenAdminRegistryFetchTokenConfigWithPackageID exercises the TokenAdminRegistry_FetchTokenConfig choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryFetchTokenConfigWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryFetchTokenConfig) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_FetchTokenConfig", + Arguments: argsToMap(args), + } +} - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["instanceId"] = string(t.InstanceId) +// TokenAdminRegistrySetPool exercises the TokenAdminRegistry_SetPool choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistrySetPool(contractID string, args ccipapi.TokenAdminRegistrySetPool) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetPool", + Arguments: argsToMap(args), + } +} - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["registryInstanceId"] = string(t.RegistryInstanceId) +// TokenAdminRegistrySetPoolWithPackageID exercises the TokenAdminRegistry_SetPool choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistrySetPoolWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistrySetPool) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetPool", + Arguments: argsToMap(args), + } +} - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["registryOwner"] = t.RegistryOwner.ToMap() +// TokenAdminRegistrySetTransferFactory exercises the TokenAdminRegistry_SetTransferFactory choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistrySetTransferFactory(contractID string, args ccipapi.TokenAdminRegistrySetTransferFactory) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetTransferFactory", + Arguments: argsToMap(args), + } +} - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["index"] = int64(t.Index) +// TokenAdminRegistrySetTransferFactoryWithPackageID exercises the TokenAdminRegistry_SetTransferFactory choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistrySetTransferFactoryWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistrySetTransferFactory) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetTransferFactory", + Arguments: argsToMap(args), + } +} - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["isCCIPManaged"] = bool(t.IsCCIPManaged) +// TokenAdminRegistrySetBurnMintFactory exercises the TokenAdminRegistry_SetBurnMintFactory choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistrySetBurnMintFactory(contractID string, args ccipapi.TokenAdminRegistrySetBurnMintFactory) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetBurnMintFactory", + Arguments: argsToMap(args), + } +} - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) +// TokenAdminRegistrySetBurnMintFactoryWithPackageID exercises the TokenAdminRegistry_SetBurnMintFactory choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistrySetBurnMintFactoryWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistrySetBurnMintFactory) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetBurnMintFactory", + Arguments: argsToMap(args), + } +} - if t.Admin != nil { - args["admin"] = map[string]any{ - "_type": "optional", - "value": (*t.Admin).ToMap(), - } - } else { - args["admin"] = map[string]any{ - "_type": "optional", - "value": nil, - } +// TokenAdminRegistryProposeAdministrator exercises the TokenAdminRegistry_ProposeAdministrator choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryProposeAdministrator(contractID string, args ccipapi.TokenAdminRegistryProposeAdministrator) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_ProposeAdministrator", + Arguments: argsToMap(args), } +} - if t.PendingAdmin != nil { - args["pendingAdmin"] = map[string]any{ - "_type": "optional", - "value": (*t.PendingAdmin).ToMap(), - } - } else { - args["pendingAdmin"] = map[string]any{ - "_type": "optional", - "value": nil, - } +// TokenAdminRegistryProposeAdministratorWithPackageID exercises the TokenAdminRegistry_ProposeAdministrator choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryProposeAdministratorWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryProposeAdministrator) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_ProposeAdministrator", + Arguments: argsToMap(args), } +} - if t.TokenPool != nil { - args["tokenPool"] = map[string]any{ - "_type": "optional", - "value": model.NestedToDAMLValue(*t.TokenPool), - } - } else { - args["tokenPool"] = map[string]any{ - "_type": "optional", - "value": nil, - } +// TokenAdminRegistryAcceptAdminRole exercises the TokenAdminRegistry_AcceptAdminRole choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryAcceptAdminRole(contractID string, args ccipapi.TokenAdminRegistryAcceptAdminRole) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_AcceptAdminRole", + Arguments: argsToMap(args), } +} - if t.TransferFactory != nil { - args["transferFactory"] = map[string]any{ - "_type": "optional", - "value": model.NestedToDAMLValue(*t.TransferFactory), - } - } else { - args["transferFactory"] = map[string]any{ - "_type": "optional", - "value": nil, - } +// TokenAdminRegistryAcceptAdminRoleWithPackageID exercises the TokenAdminRegistry_AcceptAdminRole choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryAcceptAdminRoleWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryAcceptAdminRole) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_AcceptAdminRole", + Arguments: argsToMap(args), } +} - if t.BurnMintFactory != nil { - args["burnMintFactory"] = map[string]any{ - "_type": "optional", - "value": model.NestedToDAMLValue(*t.BurnMintFactory), - } - } else { - args["burnMintFactory"] = map[string]any{ - "_type": "optional", - "value": nil, - } +// TokenAdminRegistryTransferAdminRole exercises the TokenAdminRegistry_TransferAdminRole choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryTransferAdminRole(contractID string, args ccipapi.TokenAdminRegistryTransferAdminRole) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_TransferAdminRole", + Arguments: argsToMap(args), } +} - return &model.CreateCommand{ - TemplateID: t.GetTemplateID(), - Arguments: args, +// TokenAdminRegistryTransferAdminRoleWithPackageID exercises the TokenAdminRegistry_TransferAdminRole choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryTransferAdminRoleWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryTransferAdminRole) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_TransferAdminRole", + Arguments: argsToMap(args), } } -// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name -func (t TokenConfig) CreateCommandWithPackageID(packageID string) *model.CreateCommand { +// TokenAdminRegistryIsAdministrator exercises the TokenAdminRegistry_IsAdministrator choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryIsAdministrator(contractID string, args ccipapi.TokenAdminRegistryIsAdministrator) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_IsAdministrator", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistryIsAdministratorWithPackageID exercises the TokenAdminRegistry_IsAdministrator choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryIsAdministratorWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryIsAdministrator) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_IsAdministrator", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistrySetInboundPoolCCVs exercises the TokenAdminRegistry_SetInboundPoolCCVs choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistrySetInboundPoolCCVs(contractID string, args ccipapi.TokenAdminRegistrySetInboundPoolCCVs) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetInboundPoolCCVs", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistrySetInboundPoolCCVsWithPackageID exercises the TokenAdminRegistry_SetInboundPoolCCVs choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistrySetInboundPoolCCVsWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistrySetInboundPoolCCVs) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetInboundPoolCCVs", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistrySetOutboundPoolCCVs exercises the TokenAdminRegistry_SetOutboundPoolCCVs choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistrySetOutboundPoolCCVs(contractID string, args ccipapi.TokenAdminRegistrySetOutboundPoolCCVs) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetOutboundPoolCCVs", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistrySetOutboundPoolCCVsWithPackageID exercises the TokenAdminRegistry_SetOutboundPoolCCVs choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistrySetOutboundPoolCCVsWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistrySetOutboundPoolCCVs) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_SetOutboundPoolCCVs", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistryAddTokenSend exercises the TokenAdminRegistry_AddTokenSend choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryAddTokenSend(contractID string, args ccipapi.TokenAdminRegistryAddTokenSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_AddTokenSend", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistryAddTokenSendWithPackageID exercises the TokenAdminRegistry_AddTokenSend choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryAddTokenSendWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryAddTokenSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_AddTokenSend", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistryAddTokenSendFee exercises the TokenAdminRegistry_AddTokenSendFee choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryAddTokenSendFee(contractID string, args ccipapi.TokenAdminRegistryAddTokenSendFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_AddTokenSendFee", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistryAddTokenSendFeeWithPackageID exercises the TokenAdminRegistry_AddTokenSendFee choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryAddTokenSendFeeWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryAddTokenSendFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_AddTokenSendFee", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistryConsumeReceiveTicket exercises the TokenAdminRegistry_ConsumeReceiveTicket choice on this TokenAdminRegistry contract via the IITokenAdminRegistry interface +// This method uses the package name in the template ID +func (t TokenAdminRegistry) TokenAdminRegistryConsumeReceiveTicket(contractID string, args ccipapi.TokenAdminRegistryConsumeReceiveTicket) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_ConsumeReceiveTicket", + Arguments: argsToMap(args), + } +} + +// TokenAdminRegistryConsumeReceiveTicketWithPackageID exercises the TokenAdminRegistry_ConsumeReceiveTicket choice using the provided package ID instead of package name +func (t TokenAdminRegistry) TokenAdminRegistryConsumeReceiveTicketWithPackageID(contractID string, packageID string, args ccipapi.TokenAdminRegistryConsumeReceiveTicket) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenAdminRegistry"), + ContractID: contractID, + Choice: "TokenAdminRegistry_ConsumeReceiveTicket", + Arguments: argsToMap(args), + } +} + +// Verify interface implementations for TokenAdminRegistry + +var _ api.IMCMSReceiver = (*TokenAdminRegistry)(nil) + +var _ ccipapi.IITokenAdminRegistry = (*TokenAdminRegistry)(nil) + +// TokenConfig is a Template type +type TokenConfig struct { + InstanceId types.TEXT `json:"instanceId"` + RegistryInstanceId types.TEXT `json:"registryInstanceId"` + RegistryOwner types.PARTY `json:"registryOwner"` + Index types.INT64 `json:"index"` + IsCCIPManaged types.BOOL `json:"isCCIPManaged"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Admin *types.PARTY `json:"admin" hex:"optional"` + PendingAdmin *types.PARTY `json:"pendingAdmin" hex:"optional"` + TokenPool *PoolRegistration2 `json:"tokenPool" hex:"optional"` + TransferFactory *types.CONTRACT_ID `json:"transferFactory" hex:"optional"` + BurnMintFactory *types.CONTRACT_ID `json:"burnMintFactory" hex:"optional"` +} + +// GetTemplateID returns the template ID for this template using the package name +func (t TokenConfig) GetTemplateID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenConfig") +} + +// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name +func (t TokenConfig) GetTemplateIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenConfig") +} + +// CreateCommand returns a CreateCommand for this template using the package name +func (t TokenConfig) CreateCommand() *model.CreateCommand { args := make(map[string]any) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty @@ -9139,193 +8184,6 @@ func (t TokenConfig) CreateCommandWithPackageID(packageID string) *model.CreateC } } - return &model.CreateCommand{ - TemplateID: t.GetTemplateIDWithPackageID(packageID), - Arguments: args, - } -} - -func (t TokenConfig) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *TokenConfig) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes TokenConfig to hex string (Canton MCMS format) -func (t TokenConfig) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes TokenConfig from hex string (Canton MCMS format) -func (t *TokenConfig) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// Choice methods for TokenConfig - -// Archive exercises the Archive choice on this TokenConfig contract -// This method uses the package name in the template ID -func (t TokenConfig) Archive(contractID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TokenAdminRegistry", "TokenConfig"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name -func (t TokenConfig) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TokenAdminRegistry", "TokenConfig"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// TokenPriceUpdate is a Record type -type TokenPriceUpdate struct { - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - UsdPerToken types.NUMERIC `json:"usdPerToken" hex:"decimal"` -} - -// ToMap converts TokenPriceUpdate to a map for DAML arguments -func (t TokenPriceUpdate) ToMap() map[string]any { - m := make(map[string]any) - - m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) - - m["usdPerToken"] = t.UsdPerToken - - return m -} - -func (t TokenPriceUpdate) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *TokenPriceUpdate) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes TokenPriceUpdate to hex string (Canton MCMS format) -func (t TokenPriceUpdate) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes TokenPriceUpdate from hex string (Canton MCMS format) -func (t *TokenPriceUpdate) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// TokenReceiveTicket is a Template type -type TokenReceiveTicket struct { - CcipOwner types.PARTY `json:"ccipOwner"` - CcvOwners []types.PARTY `json:"ccvOwners"` - VerifiedCCVs []chainlinkapi.RawInstanceAddress `json:"verifiedCCVs"` - RequiredInboundPoolCCVs []chainlinkapi.RawInstanceAddress `json:"requiredInboundPoolCCVs"` - TokenAdminRegistryInstanceId types.TEXT `json:"tokenAdminRegistryInstanceId"` - PoolAddress chainlinkapi.RawInstanceAddress `json:"poolAddress"` - PoolOwner types.PARTY `json:"poolOwner"` - Receiver types.PARTY `json:"receiver"` - TokenReceiver types.PARTY `json:"tokenReceiver"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - Amount types.TEXT `json:"amount"` - SourcePoolData types.TEXT `json:"sourcePoolData"` - MessageId types.TEXT `json:"messageId"` - SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` - Finality FinalityConfig `json:"finality"` -} - -// GetTemplateID returns the template ID for this template using the package name -func (t TokenReceiveTicket) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Tickets", "TokenReceiveTicket") -} - -// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name -func (t TokenReceiveTicket) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Tickets", "TokenReceiveTicket") -} - -// CreateCommand returns a CreateCommand for this template using the package name -func (t TokenReceiveTicket) CreateCommand() *model.CreateCommand { - args := make(map[string]any) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccipOwner"] = t.CcipOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccvOwners"] = func() []any { - res := make([]any, 0, len(t.CcvOwners)) - for _, e := range t.CcvOwners { - res = append(res, e.ToMap()) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["verifiedCCVs"] = func() []any { - res := make([]any, 0, len(t.VerifiedCCVs)) - for _, e := range t.VerifiedCCVs { - res = append(res, model.NestedToDAMLValue(e)) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["requiredInboundPoolCCVs"] = func() []any { - res := make([]any, 0, len(t.RequiredInboundPoolCCVs)) - for _, e := range t.RequiredInboundPoolCCVs { - res = append(res, model.NestedToDAMLValue(e)) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["tokenAdminRegistryInstanceId"] = string(t.TokenAdminRegistryInstanceId) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolAddress"] = model.NestedToDAMLValue(t.PoolAddress) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolOwner"] = t.PoolOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["receiver"] = t.Receiver.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["tokenReceiver"] = t.TokenReceiver.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["amount"] = string(t.Amount) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["sourcePoolData"] = string(t.SourcePoolData) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["messageId"] = string(t.MessageId) - - if t.SourceChainSelector != "" { - args["sourceChainSelector"] = t.SourceChainSelector - } - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["finality"] = model.NestedToDAMLValue(t.Finality) - return &model.CreateCommand{ TemplateID: t.GetTemplateID(), Arguments: args, @@ -9333,233 +8191,86 @@ func (t TokenReceiveTicket) CreateCommand() *model.CreateCommand { } // CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name -func (t TokenReceiveTicket) CreateCommandWithPackageID(packageID string) *model.CreateCommand { +func (t TokenConfig) CreateCommandWithPackageID(packageID string) *model.CreateCommand { args := make(map[string]any) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccipOwner"] = t.CcipOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccvOwners"] = func() []any { - res := make([]any, 0, len(t.CcvOwners)) - for _, e := range t.CcvOwners { - res = append(res, e.ToMap()) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["verifiedCCVs"] = func() []any { - res := make([]any, 0, len(t.VerifiedCCVs)) - for _, e := range t.VerifiedCCVs { - res = append(res, model.NestedToDAMLValue(e)) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["requiredInboundPoolCCVs"] = func() []any { - res := make([]any, 0, len(t.RequiredInboundPoolCCVs)) - for _, e := range t.RequiredInboundPoolCCVs { - res = append(res, model.NestedToDAMLValue(e)) - } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["tokenAdminRegistryInstanceId"] = string(t.TokenAdminRegistryInstanceId) + args["instanceId"] = string(t.InstanceId) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolAddress"] = model.NestedToDAMLValue(t.PoolAddress) + args["registryInstanceId"] = string(t.RegistryInstanceId) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolOwner"] = t.PoolOwner.ToMap() + args["registryOwner"] = t.RegistryOwner.ToMap() // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["receiver"] = t.Receiver.ToMap() + args["index"] = int64(t.Index) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["tokenReceiver"] = t.TokenReceiver.ToMap() + args["isCCIPManaged"] = bool(t.IsCCIPManaged) // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty args["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["amount"] = string(t.Amount) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["sourcePoolData"] = string(t.SourcePoolData) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["messageId"] = string(t.MessageId) - - if t.SourceChainSelector != "" { - args["sourceChainSelector"] = t.SourceChainSelector - } - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["finality"] = model.NestedToDAMLValue(t.Finality) - - return &model.CreateCommand{ - TemplateID: t.GetTemplateIDWithPackageID(packageID), - Arguments: args, - } -} - -func (t TokenReceiveTicket) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *TokenReceiveTicket) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes TokenReceiveTicket to hex string (Canton MCMS format) -func (t TokenReceiveTicket) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes TokenReceiveTicket from hex string (Canton MCMS format) -func (t *TokenReceiveTicket) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// Choice methods for TokenReceiveTicket - -// Consume exercises the Consume choice on this TokenReceiveTicket contract -// This method uses the package name in the template ID -func (t TokenReceiveTicket) Consume(contractID string, args Consume) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Tickets", "TokenReceiveTicket"), - ContractID: contractID, - Choice: "Consume", - Arguments: argsToMap(args), - } -} - -// ConsumeWithPackageID exercises the Consume choice using the provided package ID instead of package name -func (t TokenReceiveTicket) ConsumeWithPackageID(contractID string, packageID string, args Consume) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Tickets", "TokenReceiveTicket"), - ContractID: contractID, - Choice: "Consume", - Arguments: argsToMap(args), - } -} - -// Archive exercises the Archive choice on this TokenReceiveTicket contract -// This method uses the package name in the template ID -func (t TokenReceiveTicket) Archive(contractID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Tickets", "TokenReceiveTicket"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name -func (t TokenReceiveTicket) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { - return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Tickets", "TokenReceiveTicket"), - ContractID: contractID, - Choice: "Archive", - Arguments: map[string]any{}, - } -} - -// TokenReceiveTicketClaimed is a Template type -type TokenReceiveTicketClaimed struct { - CcipOwner types.PARTY `json:"ccipOwner"` - CcvOwners []types.PARTY `json:"ccvOwners"` - PoolOwner types.PARTY `json:"poolOwner"` - Receiver types.PARTY `json:"receiver"` - TokenReceiver types.PARTY `json:"tokenReceiver"` - TokenReceiveTicketCid types.CONTRACT_ID `json:"tokenReceiveTicketCid"` - Event TokenReceiveTicketClaimedEvent `json:"event"` -} - -// GetTemplateID returns the template ID for this template using the package name -func (t TokenReceiveTicketClaimed) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Events", "TokenReceiveTicketClaimed") -} - -// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name -func (t TokenReceiveTicketClaimed) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Events", "TokenReceiveTicketClaimed") -} - -// CreateCommand returns a CreateCommand for this template using the package name -func (t TokenReceiveTicketClaimed) CreateCommand() *model.CreateCommand { - args := make(map[string]any) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccipOwner"] = t.CcipOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccvOwners"] = func() []any { - res := make([]any, 0, len(t.CcvOwners)) - for _, e := range t.CcvOwners { - res = append(res, e.ToMap()) + if t.Admin != nil { + args["admin"] = map[string]any{ + "_type": "optional", + "value": (*t.Admin).ToMap(), } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolOwner"] = t.PoolOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["receiver"] = t.Receiver.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["tokenReceiver"] = t.TokenReceiver.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["event"] = model.NestedToDAMLValue(t.Event) - - return &model.CreateCommand{ - TemplateID: t.GetTemplateID(), - Arguments: args, - } -} - -// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name -func (t TokenReceiveTicketClaimed) CreateCommandWithPackageID(packageID string) *model.CreateCommand { - args := make(map[string]any) - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccipOwner"] = t.CcipOwner.ToMap() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["ccvOwners"] = func() []any { - res := make([]any, 0, len(t.CcvOwners)) - for _, e := range t.CcvOwners { - res = append(res, e.ToMap()) + } else { + args["admin"] = map[string]any{ + "_type": "optional", + "value": nil, } - return res - }() - - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["poolOwner"] = t.PoolOwner.ToMap() + } - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["receiver"] = t.Receiver.ToMap() + if t.PendingAdmin != nil { + args["pendingAdmin"] = map[string]any{ + "_type": "optional", + "value": (*t.PendingAdmin).ToMap(), + } + } else { + args["pendingAdmin"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["tokenReceiver"] = t.TokenReceiver.ToMap() + if t.TokenPool != nil { + args["tokenPool"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TokenPool), + } + } else { + args["tokenPool"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) + if t.TransferFactory != nil { + args["transferFactory"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.TransferFactory), + } + } else { + args["transferFactory"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } - // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty - args["event"] = model.NestedToDAMLValue(t.Event) + if t.BurnMintFactory != nil { + args["burnMintFactory"] = map[string]any{ + "_type": "optional", + "value": model.NestedToDAMLValue(*t.BurnMintFactory), + } + } else { + args["burnMintFactory"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } return &model.CreateCommand{ TemplateID: t.GetTemplateIDWithPackageID(packageID), @@ -9567,35 +8278,35 @@ func (t TokenReceiveTicketClaimed) CreateCommandWithPackageID(packageID string) } } -func (t TokenReceiveTicketClaimed) MarshalJSON() ([]byte, error) { +func (t TokenConfig) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *TokenReceiveTicketClaimed) UnmarshalJSON(data []byte) error { +func (t *TokenConfig) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes TokenReceiveTicketClaimed to hex string (Canton MCMS format) -func (t TokenReceiveTicketClaimed) MarshalHex() (string, error) { +// MarshalHex encodes TokenConfig to hex string (Canton MCMS format) +func (t TokenConfig) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes TokenReceiveTicketClaimed from hex string (Canton MCMS format) -func (t *TokenReceiveTicketClaimed) UnmarshalHex(data string) error { +// UnmarshalHex decodes TokenConfig from hex string (Canton MCMS format) +func (t *TokenConfig) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } -// Choice methods for TokenReceiveTicketClaimed +// Choice methods for TokenConfig -// Archive exercises the Archive choice on this TokenReceiveTicketClaimed contract +// Archive exercises the Archive choice on this TokenConfig contract via the IITokenConfig interface // This method uses the package name in the template ID -func (t TokenReceiveTicketClaimed) Archive(contractID string) *model.ExerciseCommand { +func (t TokenConfig) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Events", "TokenReceiveTicketClaimed"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "TokenConfig"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -9603,221 +8314,117 @@ func (t TokenReceiveTicketClaimed) Archive(contractID string) *model.ExerciseCom } // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name -func (t TokenReceiveTicketClaimed) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { +func (t TokenConfig) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Events", "TokenReceiveTicketClaimed"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "TokenConfig"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, } } -// TokenReceiveTicketClaimedEvent is a Record type -type TokenReceiveTicketClaimedEvent struct { - VerifiedCCVs []chainlinkapi.RawInstanceAddress `json:"verifiedCCVs"` - TokenAdminRegistryInstanceId types.TEXT `json:"tokenAdminRegistryInstanceId"` - PoolAddress chainlinkapi.RawInstanceAddress `json:"poolAddress"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - SourceAmount types.TEXT `json:"sourceAmount"` - LocalAmount types.NUMERIC `json:"localAmount"` - SourcePoolData types.TEXT `json:"sourcePoolData"` - MessageId types.TEXT `json:"messageId"` - SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` - Finality FinalityConfig `json:"finality"` - Output TokenReceiveTicketClaimedOutput `json:"output"` -} - -// ToMap converts TokenReceiveTicketClaimedEvent to a map for DAML arguments -func (t TokenReceiveTicketClaimedEvent) ToMap() map[string]any { - m := make(map[string]any) - - m["verifiedCCVs"] = func() []any { - res := make([]any, 0, len(t.VerifiedCCVs)) - for _, e := range t.VerifiedCCVs { - res = append(res, model.NestedToDAMLValue(e)) - } - return res - }() - - m["tokenAdminRegistryInstanceId"] = string(t.TokenAdminRegistryInstanceId) - - m["poolAddress"] = model.NestedToDAMLValue(t.PoolAddress) - - m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) - - m["sourceAmount"] = string(t.SourceAmount) - - m["localAmount"] = t.LocalAmount - - m["sourcePoolData"] = string(t.SourcePoolData) - - m["messageId"] = string(t.MessageId) - - m["sourceChainSelector"] = t.SourceChainSelector - - m["finality"] = model.NestedToDAMLValue(t.Finality) - - m["output"] = model.NestedToDAMLValue(t.Output) - - return m -} - -func (t TokenReceiveTicketClaimedEvent) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *TokenReceiveTicketClaimedEvent) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes TokenReceiveTicketClaimedEvent to hex string (Canton MCMS format) -func (t TokenReceiveTicketClaimedEvent) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes TokenReceiveTicketClaimedEvent from hex string (Canton MCMS format) -func (t *TokenReceiveTicketClaimedEvent) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// TokenReceiveTicketClaimedCompleted is a Record type -type TokenReceiveTicketClaimedCompleted struct { - ReceiverHoldingCids []types.CONTRACT_ID `json:"receiverHoldingCids"` -} - -// ToMap converts TokenReceiveTicketClaimedCompleted to a map for DAML arguments -func (t TokenReceiveTicketClaimedCompleted) ToMap() map[string]any { - m := make(map[string]any) - - m["receiverHoldingCids"] = func() []any { - res := make([]any, 0, len(t.ReceiverHoldingCids)) - for _, e := range t.ReceiverHoldingCids { - res = append(res, e) - } - return res - }() - - return m -} - -func (t TokenReceiveTicketClaimedCompleted) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *TokenReceiveTicketClaimedCompleted) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes TokenReceiveTicketClaimedCompleted to hex string (Canton MCMS format) -func (t TokenReceiveTicketClaimedCompleted) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes TokenReceiveTicketClaimedCompleted from hex string (Canton MCMS format) -func (t *TokenReceiveTicketClaimedCompleted) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - -// TokenReceiveTicketClaimedOutput is a variant/union type -type TokenReceiveTicketClaimedOutput struct { - TokenReceiveTicketClaimedPending *TokenReceiveTicketClaimedPending `json:"TokenReceiveTicketClaimed_Pending,omitempty"` - TokenReceiveTicketClaimedCompleted *TokenReceiveTicketClaimedCompleted `json:"TokenReceiveTicketClaimed_Completed,omitempty"` -} - -// MarshalJSON implements custom JSON marshaling for TokenReceiveTicketClaimedOutput -func (v TokenReceiveTicketClaimedOutput) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(v) -} - -// UnmarshalJSON implements custom JSON unmarshalling for TokenReceiveTicketClaimedOutput -func (v *TokenReceiveTicketClaimedOutput) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, v) -} - -// MarshalHex encodes TokenReceiveTicketClaimedOutput to hex string (Canton MCMS format) -func (v TokenReceiveTicketClaimedOutput) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(v) +// TokenConfigPublicFetch exercises the TokenConfig_PublicFetch choice on this TokenConfig contract via the IITokenConfig interface +// This method uses the package name in the template ID +func (t TokenConfig) TokenConfigPublicFetch(contractID string, args ccipapi.TokenConfigPublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenConfig"), + ContractID: contractID, + Choice: "TokenConfig_PublicFetch", + Arguments: argsToMap(args), + } } -// UnmarshalHex decodes TokenReceiveTicketClaimedOutput from hex string (Canton MCMS format) -func (v *TokenReceiveTicketClaimedOutput) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, v) +// TokenConfigPublicFetchWithPackageID exercises the TokenConfig_PublicFetch choice using the provided package ID instead of package name +func (t TokenConfig) TokenConfigPublicFetchWithPackageID(contractID string, packageID string, args ccipapi.TokenConfigPublicFetch) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenConfig"), + ContractID: contractID, + Choice: "TokenConfig_PublicFetch", + Arguments: argsToMap(args), + } } -// GetVariantTag implements types.VARIANT interface -func (v TokenReceiveTicketClaimedOutput) GetVariantTag() string { - - if v.TokenReceiveTicketClaimedPending != nil { - return "TokenReceiveTicketClaimed_Pending" +// TokenConfigAssertConfiguredTransferFactory exercises the TokenConfig_AssertConfiguredTransferFactory choice on this TokenConfig contract via the IITokenConfig interface +// This method uses the package name in the template ID +func (t TokenConfig) TokenConfigAssertConfiguredTransferFactory(contractID string, args ccipapi.TokenConfigAssertConfiguredTransferFactory) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenConfig"), + ContractID: contractID, + Choice: "TokenConfig_AssertConfiguredTransferFactory", + Arguments: argsToMap(args), } +} - if v.TokenReceiveTicketClaimedCompleted != nil { - return "TokenReceiveTicketClaimed_Completed" +// TokenConfigAssertConfiguredTransferFactoryWithPackageID exercises the TokenConfig_AssertConfiguredTransferFactory choice using the provided package ID instead of package name +func (t TokenConfig) TokenConfigAssertConfiguredTransferFactoryWithPackageID(contractID string, packageID string, args ccipapi.TokenConfigAssertConfiguredTransferFactory) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenConfig"), + ContractID: contractID, + Choice: "TokenConfig_AssertConfiguredTransferFactory", + Arguments: argsToMap(args), } - - return "" } -// GetVariantValue implements types.VARIANT interface -func (v TokenReceiveTicketClaimedOutput) GetVariantValue() any { - - if v.TokenReceiveTicketClaimedPending != nil { - return v.TokenReceiveTicketClaimedPending +// TokenConfigAssertConfiguredBurnMintFactory exercises the TokenConfig_AssertConfiguredBurnMintFactory choice on this TokenConfig contract via the IITokenConfig interface +// This method uses the package name in the template ID +func (t TokenConfig) TokenConfigAssertConfiguredBurnMintFactory(contractID string, args ccipapi.TokenConfigAssertConfiguredBurnMintFactory) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CoreV1.TokenAdminRegistry", "ITokenConfig"), + ContractID: contractID, + Choice: "TokenConfig_AssertConfiguredBurnMintFactory", + Arguments: argsToMap(args), } +} - if v.TokenReceiveTicketClaimedCompleted != nil { - return v.TokenReceiveTicketClaimedCompleted +// TokenConfigAssertConfiguredBurnMintFactoryWithPackageID exercises the TokenConfig_AssertConfiguredBurnMintFactory choice using the provided package ID instead of package name +func (t TokenConfig) TokenConfigAssertConfiguredBurnMintFactoryWithPackageID(contractID string, packageID string, args ccipapi.TokenConfigAssertConfiguredBurnMintFactory) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CoreV1.TokenAdminRegistry", "ITokenConfig"), + ContractID: contractID, + Choice: "TokenConfig_AssertConfiguredBurnMintFactory", + Arguments: argsToMap(args), } - - return nil } -var _ types.VARIANT = (*TokenReceiveTicketClaimedOutput)(nil) +// Verify interface implementations for TokenConfig + +var _ ccipapi.IITokenConfig = (*TokenConfig)(nil) -// TokenReceiveTicketClaimedPending is a Record type -type TokenReceiveTicketClaimedPending struct { - TransferInstructionCid types.CONTRACT_ID `json:"transferInstructionCid"` +// TokenPriceUpdate is a Record type +type TokenPriceUpdate struct { + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + UsdPerToken types.NUMERIC `json:"usdPerToken" hex:"decimal"` } -// ToMap converts TokenReceiveTicketClaimedPending to a map for DAML arguments -func (t TokenReceiveTicketClaimedPending) ToMap() map[string]any { +// ToMap converts TokenPriceUpdate to a map for DAML arguments +func (t TokenPriceUpdate) ToMap() map[string]any { m := make(map[string]any) - m["transferInstructionCid"] = model.NestedToDAMLValue(t.TransferInstructionCid) + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + m["usdPerToken"] = t.UsdPerToken return m } -func (t TokenReceiveTicketClaimedPending) MarshalJSON() ([]byte, error) { +func (t TokenPriceUpdate) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *TokenReceiveTicketClaimedPending) UnmarshalJSON(data []byte) error { +func (t *TokenPriceUpdate) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes TokenReceiveTicketClaimedPending to hex string (Canton MCMS format) -func (t TokenReceiveTicketClaimedPending) MarshalHex() (string, error) { +// MarshalHex encodes TokenPriceUpdate to hex string (Canton MCMS format) +func (t TokenPriceUpdate) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes TokenReceiveTicketClaimedPending from hex string (Canton MCMS format) -func (t *TokenReceiveTicketClaimedPending) UnmarshalHex(data string) error { +// UnmarshalHex decodes TokenPriceUpdate from hex string (Canton MCMS format) +func (t *TokenPriceUpdate) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -9921,45 +8528,6 @@ func (t *TokenSendFee) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// TokenTransfer is a Record type -type TokenTransfer struct { - Token splice_api_token_holding_v1.InstrumentId `json:"token"` - Amount types.NUMERIC `json:"amount"` -} - -// ToMap converts TokenTransfer to a map for DAML arguments -func (t TokenTransfer) ToMap() map[string]any { - m := make(map[string]any) - - m["token"] = model.NestedToDAMLValue(t.Token) - - m["amount"] = t.Amount - - return m -} - -func (t TokenTransfer) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *TokenTransfer) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes TokenTransfer to hex string (Canton MCMS format) -func (t TokenTransfer) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes TokenTransfer from hex string (Canton MCMS format) -func (t *TokenTransfer) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - // TokenTransferFeeConfig is a Record type type TokenTransferFeeConfig struct { IsEnabled types.BOOL `json:"isEnabled"` @@ -10005,57 +8573,6 @@ func (t *TokenTransferFeeConfig) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// TokenTransferV1 is a Record type -type TokenTransferV1 struct { - Amount types.TEXT `json:"amount"` - SourcePoolAddress types.TEXT `json:"sourcePoolAddress"` - SourceTokenAddress types.TEXT `json:"sourceTokenAddress"` - DestTokenAddress types.TEXT `json:"destTokenAddress"` - TokenReceiver types.TEXT `json:"tokenReceiver"` - ExtraData types.TEXT `json:"extraData"` -} - -// ToMap converts TokenTransferV1 to a map for DAML arguments -func (t TokenTransferV1) ToMap() map[string]any { - m := make(map[string]any) - - m["amount"] = string(t.Amount) - - m["sourcePoolAddress"] = string(t.SourcePoolAddress) - - m["sourceTokenAddress"] = string(t.SourceTokenAddress) - - m["destTokenAddress"] = string(t.DestTokenAddress) - - m["tokenReceiver"] = string(t.TokenReceiver) - - m["extraData"] = string(t.ExtraData) - - return m -} - -func (t TokenTransferV1) MarshalJSON() ([]byte, error) { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Marshal(t) -} - -func (t *TokenTransferV1) UnmarshalJSON(data []byte) error { - jsonCodec := codec.NewJsonCodec() - return jsonCodec.Unmarshal(data, t) -} - -// MarshalHex encodes TokenTransferV1 to hex string (Canton MCMS format) -func (t TokenTransferV1) MarshalHex() (string, error) { - hexCodec := codec.NewHexCodec() - return hexCodec.Marshal(t) -} - -// UnmarshalHex decodes TokenTransferV1 from hex string (Canton MCMS format) -func (t *TokenTransferV1) UnmarshalHex(data string) error { - hexCodec := codec.NewHexCodec() - return hexCodec.Unmarshal(data, t) -} - // TransferAdminParams is a Record type type TransferAdminParams struct { InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` @@ -10097,10 +8614,11 @@ func (t *TransferAdminParams) UnmarshalHex(data string) error { // TransferAdminRole is a Record type type TransferAdminRole struct { - TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` - NewAdmin types.PARTY `json:"newAdmin"` - Caller types.PARTY `json:"caller"` + TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + NewAdmin types.PARTY `json:"newAdmin"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts TransferAdminRole to a map for DAML arguments @@ -10113,6 +8631,8 @@ func (t TransferAdminRole) ToMap() map[string]any { m["newAdmin"] = t.NewAdmin.ToMap() + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -10600,7 +9120,9 @@ type MCMSEncoder interface { AddExecutorFeeMCMSParams(args AddExecutorFeeMCMSParams) (*bind.EncodedChoice, error) AddPriceUpdaters(args AddPriceUpdaters) (*bind.EncodedChoice, error) AddTokenSend(args AddTokenSend) (*bind.EncodedChoice, error) + AddTokenSendMCMSParams(args AddTokenSendMCMSParams) (*bind.EncodedChoice, error) AddTokenSendFee(args AddTokenSendFee) (*bind.EncodedChoice, error) + AddTokenSendFeeMCMSParams(args AddTokenSendFeeMCMSParams) (*bind.EncodedChoice, error) AddVerifierData(args AddVerifierData) (*bind.EncodedChoice, error) AddVerifierDataMCMSParams(args AddVerifierDataMCMSParams) (*bind.EncodedChoice, error) ApplyDestChainConfigUpdates(args ApplyDestChainConfigUpdates) (*bind.EncodedChoice, error) @@ -10612,11 +9134,8 @@ type MCMSEncoder interface { ApplySourceChainConfigUpdates(args ApplySourceChainConfigUpdates) (*bind.EncodedChoice, error) ApplySourceChainConfigUpdatesParams(args ApplySourceChainConfigUpdatesParams) (*bind.EncodedChoice, error) BuildMessage(args BuildMessage) (*bind.EncodedChoice, error) - BuildMessageMCMSParams(args BuildMessageMCMSParams) (*bind.EncodedChoice, error) CancelExecute(args CancelExecute) (*bind.EncodedChoice, error) CancelExecuteMCMSParams(args CancelExecuteMCMSParams) (*bind.EncodedChoice, error) - Consume(args Consume) (*bind.EncodedChoice, error) - ConsumeCapacity(args ConsumeCapacity) (*bind.EncodedChoice, error) ConsumeReceiveTicket(args ConsumeReceiveTicket) (*bind.EncodedChoice, error) ConsumeReceiveTicketMCMSParams(args ConsumeReceiveTicketMCMSParams) (*bind.EncodedChoice, error) Curse(args Curse) (*bind.EncodedChoice, error) @@ -10666,9 +9185,10 @@ type MCMSEncoder interface { SetBurnMintFactory(args SetBurnMintFactory) (*bind.EncodedChoice, error) SetBurnMintFactoryMCMSParams(args SetBurnMintFactoryMCMSParams) (*bind.EncodedChoice, error) SetBurnMintFactoryParams(args SetBurnMintFactoryParams) (*bind.EncodedChoice, error) - SetConfig(args SetConfig) (*bind.EncodedChoice, error) SetInboundPoolCCVs(args SetInboundPoolCCVs) (*bind.EncodedChoice, error) + SetInboundPoolCCVsMCMSParams(args SetInboundPoolCCVsMCMSParams) (*bind.EncodedChoice, error) SetOutboundPoolCCVs(args SetOutboundPoolCCVs) (*bind.EncodedChoice, error) + SetOutboundPoolCCVsMCMSParams(args SetOutboundPoolCCVsMCMSParams) (*bind.EncodedChoice, error) SetPool(args SetPool) (*bind.EncodedChoice, error) SetPoolMCMSParams(args SetPoolMCMSParams) (*bind.EncodedChoice, error) SetPoolParams(args SetPoolParams) (*bind.EncodedChoice, error) @@ -10771,11 +9291,21 @@ func (e *encoder) AddTokenSend(args AddTokenSend) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("AddTokenSend", args) } +// AddTokenSendMCMSParams encodes MCMS parameters (without Caller) for the AddTokenSend choice. +func (e *encoder) AddTokenSendMCMSParams(args AddTokenSendMCMSParams) (*bind.EncodedChoice, error) { + return e.EncodeChoiceArgs("AddTokenSend", args) +} + // AddTokenSendFee encodes parameters for the AddTokenSendFee choice. func (e *encoder) AddTokenSendFee(args AddTokenSendFee) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("AddTokenSendFee", args) } +// AddTokenSendFeeMCMSParams encodes MCMS parameters (without Caller) for the AddTokenSendFee choice. +func (e *encoder) AddTokenSendFeeMCMSParams(args AddTokenSendFeeMCMSParams) (*bind.EncodedChoice, error) { + return e.EncodeChoiceArgs("AddTokenSendFee", args) +} + // AddVerifierData encodes parameters for the AddVerifierData choice. func (e *encoder) AddVerifierData(args AddVerifierData) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("AddVerifierData", args) @@ -10831,11 +9361,6 @@ func (e *encoder) BuildMessage(args BuildMessage) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("BuildMessage", args) } -// BuildMessageMCMSParams encodes MCMS parameters (without Caller) for the BuildMessage choice. -func (e *encoder) BuildMessageMCMSParams(args BuildMessageMCMSParams) (*bind.EncodedChoice, error) { - return e.EncodeChoiceArgs("BuildMessage", args) -} - // CancelExecute encodes parameters for the CancelExecute choice. func (e *encoder) CancelExecute(args CancelExecute) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("CancelExecute", args) @@ -10846,16 +9371,6 @@ func (e *encoder) CancelExecuteMCMSParams(args CancelExecuteMCMSParams) (*bind.E return e.EncodeChoiceArgs("CancelExecute", args) } -// Consume encodes parameters for the Consume choice. -func (e *encoder) Consume(args Consume) (*bind.EncodedChoice, error) { - return e.EncodeChoiceArgs("Consume", args) -} - -// ConsumeCapacity encodes parameters for the ConsumeCapacity choice. -func (e *encoder) ConsumeCapacity(args ConsumeCapacity) (*bind.EncodedChoice, error) { - return e.EncodeChoiceArgs("ConsumeCapacity", args) -} - // ConsumeReceiveTicket encodes parameters for the ConsumeReceiveTicket choice. func (e *encoder) ConsumeReceiveTicket(args ConsumeReceiveTicket) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("ConsumeReceiveTicket", args) @@ -11101,21 +9616,26 @@ func (e *encoder) SetBurnMintFactoryParams(args SetBurnMintFactoryParams) (*bind return e.EncodeChoiceArgs("SetBurnMintFactory", args) } -// SetConfig encodes parameters for the SetConfig choice. -func (e *encoder) SetConfig(args SetConfig) (*bind.EncodedChoice, error) { - return e.EncodeChoiceArgs("SetConfig", args) -} - // SetInboundPoolCCVs encodes parameters for the SetInboundPoolCCVs choice. func (e *encoder) SetInboundPoolCCVs(args SetInboundPoolCCVs) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("SetInboundPoolCCVs", args) } +// SetInboundPoolCCVsMCMSParams encodes MCMS parameters (without Caller) for the SetInboundPoolCCVs choice. +func (e *encoder) SetInboundPoolCCVsMCMSParams(args SetInboundPoolCCVsMCMSParams) (*bind.EncodedChoice, error) { + return e.EncodeChoiceArgs("SetInboundPoolCCVs", args) +} + // SetOutboundPoolCCVs encodes parameters for the SetOutboundPoolCCVs choice. func (e *encoder) SetOutboundPoolCCVs(args SetOutboundPoolCCVs) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("SetOutboundPoolCCVs", args) } +// SetOutboundPoolCCVsMCMSParams encodes MCMS parameters (without Caller) for the SetOutboundPoolCCVs choice. +func (e *encoder) SetOutboundPoolCCVsMCMSParams(args SetOutboundPoolCCVsMCMSParams) (*bind.EncodedChoice, error) { + return e.EncodeChoiceArgs("SetOutboundPoolCCVs", args) +} + // SetPool encodes parameters for the SetPool choice. func (e *encoder) SetPool(args SetPool) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("SetPool", args) diff --git a/bindings/generated/latest/ccip/events/events.go b/bindings/generated/latest/ccip/events/events.go new file mode 100644 index 000000000..eafc74fc2 --- /dev/null +++ b/bindings/generated/latest/ccip/events/events.go @@ -0,0 +1,936 @@ +package events + +import ( + "errors" + "fmt" + "math/big" + "strings" + + ccipapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipapi" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" + clientapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/clientapi" + chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" + splice_api_token_holding_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" + "github.com/smartcontractkit/go-daml/pkg/bind" + "github.com/smartcontractkit/go-daml/pkg/codec" + "github.com/smartcontractkit/go-daml/pkg/model" + "github.com/smartcontractkit/go-daml/pkg/types" +) + +var ( + _ = fmt.Sprintf + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = model.Command{} + _ bind.BoundTemplate +) + +const ( + PackageName = "ccip-events" + PackageID = "8cf1b15f40b7021beca31fca9deefe2944d5c18d7e1f9c00d0a7b38a513e1f5d" + SDKVersion = "3.4.11" +) + +type Template interface { + CreateCommand() *model.CreateCommand + GetTemplateID() string +} + +func argsToMap(args any) map[string]any { + if args == nil { + return map[string]any{} + } + + if m, ok := args.(map[string]any); ok { + return m + } + + type mapper interface { + ToMap() map[string]any + } + if mapper, ok := args.(mapper); ok { + return mapper.ToMap() + } + + return map[string]any{"args": args} +} + +// CCIPMessageSent is a Template type +type CCIPMessageSent struct { + CcipOwner types.PARTY `json:"ccipOwner"` + CcvOwners []types.PARTY `json:"ccvOwners"` + Sender types.PARTY `json:"sender"` + Observers []types.PARTY `json:"observers"` + Event CCIPMessageSentEvent `json:"event"` +} + +// GetTemplateID returns the template ID for this template using the package name +func (t CCIPMessageSent) GetTemplateID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.EventsV1.Events", "CCIPMessageSent") +} + +// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name +func (t CCIPMessageSent) GetTemplateIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.EventsV1.Events", "CCIPMessageSent") +} + +// CreateCommand returns a CreateCommand for this template using the package name +func (t CCIPMessageSent) CreateCommand() *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccipOwner"] = t.CcipOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["sender"] = t.Sender.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["observers"] = func() []any { + res := make([]any, 0, len(t.Observers)) + for _, e := range t.Observers { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["event"] = model.NestedToDAMLValue(t.Event) + + return &model.CreateCommand{ + TemplateID: t.GetTemplateID(), + Arguments: args, + } +} + +// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name +func (t CCIPMessageSent) CreateCommandWithPackageID(packageID string) *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccipOwner"] = t.CcipOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["sender"] = t.Sender.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["observers"] = func() []any { + res := make([]any, 0, len(t.Observers)) + for _, e := range t.Observers { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["event"] = model.NestedToDAMLValue(t.Event) + + return &model.CreateCommand{ + TemplateID: t.GetTemplateIDWithPackageID(packageID), + Arguments: args, + } +} + +func (t CCIPMessageSent) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *CCIPMessageSent) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes CCIPMessageSent to hex string (Canton MCMS format) +func (t CCIPMessageSent) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes CCIPMessageSent from hex string (Canton MCMS format) +func (t *CCIPMessageSent) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// Choice methods for CCIPMessageSent + +// Archive exercises the Archive choice on this CCIPMessageSent contract via the IICCIPMessageSent interface +// This method uses the package name in the template ID +func (t CCIPMessageSent) Archive(contractID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.EventsV1.Events", "CCIPMessageSent"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name +func (t CCIPMessageSent) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.EventsV1.Events", "CCIPMessageSent"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// Verify interface implementations for CCIPMessageSent + +var _ clientapi.IICCIPMessageSent = (*CCIPMessageSent)(nil) + +// CCIPMessageSentEvent is a Record type +type CCIPMessageSentEvent struct { + DestChainSelector types.NUMERIC `json:"destChainSelector"` + SequenceNumber types.NUMERIC `json:"sequenceNumber"` + MessageId types.TEXT `json:"messageId"` + FeeToken splice_api_token_holding_v1.InstrumentId `json:"feeToken"` + TokenAmountBeforeTokenPoolFees types.NUMERIC `json:"tokenAmountBeforeTokenPoolFees"` + EncodedMessage types.TEXT `json:"encodedMessage"` + VerifierBlobs []types.TEXT `json:"verifierBlobs"` + Receipts []Receipt `json:"receipts"` +} + +// ToMap converts CCIPMessageSentEvent to a map for DAML arguments +func (t CCIPMessageSentEvent) ToMap() map[string]any { + m := make(map[string]any) + + m["destChainSelector"] = t.DestChainSelector + + m["sequenceNumber"] = t.SequenceNumber + + m["messageId"] = string(t.MessageId) + + m["feeToken"] = model.NestedToDAMLValue(t.FeeToken) + + m["tokenAmountBeforeTokenPoolFees"] = t.TokenAmountBeforeTokenPoolFees + + m["encodedMessage"] = string(t.EncodedMessage) + + m["verifierBlobs"] = func() []any { + res := make([]any, 0, len(t.VerifierBlobs)) + for _, e := range t.VerifierBlobs { + res = append(res, string(e)) + } + return res + }() + + m["receipts"] = func() []any { + res := make([]any, 0, len(t.Receipts)) + for _, e := range t.Receipts { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + return m +} + +func (t CCIPMessageSentEvent) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *CCIPMessageSentEvent) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes CCIPMessageSentEvent to hex string (Canton MCMS format) +func (t CCIPMessageSentEvent) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes CCIPMessageSentEvent from hex string (Canton MCMS format) +func (t *CCIPMessageSentEvent) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ExecutionStateChanged is a Template type +type ExecutionStateChanged struct { + CcipOwner types.PARTY `json:"ccipOwner"` + CcvOwners []types.PARTY `json:"ccvOwners"` + Receiver types.PARTY `json:"receiver"` + Event ExecutionStateChangedEvent `json:"event"` +} + +// GetTemplateID returns the template ID for this template using the package name +func (t ExecutionStateChanged) GetTemplateID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.EventsV1.Events", "ExecutionStateChanged") +} + +// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name +func (t ExecutionStateChanged) GetTemplateIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.EventsV1.Events", "ExecutionStateChanged") +} + +// CreateCommand returns a CreateCommand for this template using the package name +func (t ExecutionStateChanged) CreateCommand() *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccipOwner"] = t.CcipOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["receiver"] = t.Receiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["event"] = model.NestedToDAMLValue(t.Event) + + return &model.CreateCommand{ + TemplateID: t.GetTemplateID(), + Arguments: args, + } +} + +// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name +func (t ExecutionStateChanged) CreateCommandWithPackageID(packageID string) *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccipOwner"] = t.CcipOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["receiver"] = t.Receiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["event"] = model.NestedToDAMLValue(t.Event) + + return &model.CreateCommand{ + TemplateID: t.GetTemplateIDWithPackageID(packageID), + Arguments: args, + } +} + +func (t ExecutionStateChanged) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutionStateChanged) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutionStateChanged to hex string (Canton MCMS format) +func (t ExecutionStateChanged) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutionStateChanged from hex string (Canton MCMS format) +func (t *ExecutionStateChanged) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// Choice methods for ExecutionStateChanged + +// Archive exercises the Archive choice on this ExecutionStateChanged contract via the IIExecutionStateChanged interface +// This method uses the package name in the template ID +func (t ExecutionStateChanged) Archive(contractID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.EventsV1.Events", "ExecutionStateChanged"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name +func (t ExecutionStateChanged) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.EventsV1.Events", "ExecutionStateChanged"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// Verify interface implementations for ExecutionStateChanged + +var _ clientapi.IIExecutionStateChanged = (*ExecutionStateChanged)(nil) + +// ExecutionStateChangedEvent is a Record type +type ExecutionStateChangedEvent struct { + SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` + SequenceNumber types.NUMERIC `json:"sequenceNumber"` + MessageId types.TEXT `json:"messageId"` + State ccipapi.MessageExecutionState `json:"state"` + ReturnData types.TEXT `json:"returnData"` +} + +// ToMap converts ExecutionStateChangedEvent to a map for DAML arguments +func (t ExecutionStateChangedEvent) ToMap() map[string]any { + m := make(map[string]any) + + m["sourceChainSelector"] = t.SourceChainSelector + + m["sequenceNumber"] = t.SequenceNumber + + m["messageId"] = string(t.MessageId) + + m["state"] = model.NestedToDAMLValue(t.State) + + m["returnData"] = string(t.ReturnData) + + return m +} + +func (t ExecutionStateChangedEvent) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ExecutionStateChangedEvent) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ExecutionStateChangedEvent to hex string (Canton MCMS format) +func (t ExecutionStateChangedEvent) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ExecutionStateChangedEvent from hex string (Canton MCMS format) +func (t *ExecutionStateChangedEvent) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// IssuerType is an enum type +type IssuerType string + +const ( + IssuerTypeIssuerType_CCV IssuerType = "IssuerType_CCV" + + IssuerTypeIssuerType_Pool IssuerType = "IssuerType_Pool" + + IssuerTypeIssuerType_Executor IssuerType = "IssuerType_Executor" + + IssuerTypeIssuerType_Network IssuerType = "IssuerType_Network" +) + +func (e IssuerType) GetEnumConstructor() string { return string(e) } + +func (e IssuerType) GetEnumTypeID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.EventsV1.Receipts", "IssuerType") +} + +// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name +func (e IssuerType) GetEnumTypeIDWithPackageID(packageID string) string { + return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.EventsV1.Receipts", "IssuerType") +} + +func (e IssuerType) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(e) +} + +func (e *IssuerType) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, e) +} + +// MarshalHex encodes IssuerType to hex string (Canton MCMS format) +func (e IssuerType) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(e) +} + +// UnmarshalHex decodes IssuerType from hex string (Canton MCMS format) +func (e *IssuerType) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, e) +} + +var _ types.ENUM = IssuerType("") + +// Receipt is a Record type +type Receipt struct { + IssuerType IssuerType `json:"issuerType"` + IssuerAddress types.TEXT `json:"issuerAddress"` + VersionTag *types.TEXT `json:"versionTag" hex:"optional"` + DestGasLimit types.INT64 `json:"destGasLimit"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + FeeTokenAmount types.NUMERIC `json:"feeTokenAmount"` + ExtraArgs types.TEXT `json:"extraArgs"` +} + +// ToMap converts Receipt to a map for DAML arguments +func (t Receipt) ToMap() map[string]any { + m := make(map[string]any) + + m["issuerType"] = model.NestedToDAMLValue(t.IssuerType) + + m["issuerAddress"] = string(t.IssuerAddress) + + if t.VersionTag != nil { + m["versionTag"] = map[string]any{ + "_type": "optional", + "value": string(*t.VersionTag), + } + } else { + m["versionTag"] = map[string]any{ + "_type": "optional", + "value": nil, + } + } + + m["destGasLimit"] = int64(t.DestGasLimit) + + m["destBytesOverhead"] = int64(t.DestBytesOverhead) + + m["feeTokenAmount"] = t.FeeTokenAmount + + m["extraArgs"] = string(t.ExtraArgs) + + return m +} + +func (t Receipt) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *Receipt) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes Receipt to hex string (Canton MCMS format) +func (t Receipt) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes Receipt from hex string (Canton MCMS format) +func (t *Receipt) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenReceiveTicketClaimed is a Template type +type TokenReceiveTicketClaimed struct { + CcipOwner types.PARTY `json:"ccipOwner"` + CcvOwners []types.PARTY `json:"ccvOwners"` + PoolOwner types.PARTY `json:"poolOwner"` + Receiver types.PARTY `json:"receiver"` + TokenReceiver types.PARTY `json:"tokenReceiver"` + TokenReceiveTicketCid types.CONTRACT_ID `json:"tokenReceiveTicketCid"` + Event TokenReceiveTicketClaimedEvent `json:"event"` +} + +// GetTemplateID returns the template ID for this template using the package name +func (t TokenReceiveTicketClaimed) GetTemplateID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.EventsV1.Events", "TokenReceiveTicketClaimed") +} + +// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name +func (t TokenReceiveTicketClaimed) GetTemplateIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.EventsV1.Events", "TokenReceiveTicketClaimed") +} + +// CreateCommand returns a CreateCommand for this template using the package name +func (t TokenReceiveTicketClaimed) CreateCommand() *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccipOwner"] = t.CcipOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolOwner"] = t.PoolOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["receiver"] = t.Receiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["tokenReceiver"] = t.TokenReceiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["event"] = model.NestedToDAMLValue(t.Event) + + return &model.CreateCommand{ + TemplateID: t.GetTemplateID(), + Arguments: args, + } +} + +// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name +func (t TokenReceiveTicketClaimed) CreateCommandWithPackageID(packageID string) *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccipOwner"] = t.CcipOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolOwner"] = t.PoolOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["receiver"] = t.Receiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["tokenReceiver"] = t.TokenReceiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["event"] = model.NestedToDAMLValue(t.Event) + + return &model.CreateCommand{ + TemplateID: t.GetTemplateIDWithPackageID(packageID), + Arguments: args, + } +} + +func (t TokenReceiveTicketClaimed) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenReceiveTicketClaimed) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenReceiveTicketClaimed to hex string (Canton MCMS format) +func (t TokenReceiveTicketClaimed) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenReceiveTicketClaimed from hex string (Canton MCMS format) +func (t *TokenReceiveTicketClaimed) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// Choice methods for TokenReceiveTicketClaimed + +// Archive exercises the Archive choice on this TokenReceiveTicketClaimed contract +// This method uses the package name in the template ID +func (t TokenReceiveTicketClaimed) Archive(contractID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.EventsV1.Events", "TokenReceiveTicketClaimed"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name +func (t TokenReceiveTicketClaimed) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.EventsV1.Events", "TokenReceiveTicketClaimed"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// TokenReceiveTicketClaimedEvent is a Record type +type TokenReceiveTicketClaimedEvent struct { + VerifiedCCVs []chainlinkapi.RawInstanceAddress `json:"verifiedCCVs"` + TokenAdminRegistryInstanceId types.TEXT `json:"tokenAdminRegistryInstanceId"` + PoolAddress chainlinkapi.RawInstanceAddress `json:"poolAddress"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + SourceAmount types.TEXT `json:"sourceAmount"` + LocalAmount types.NUMERIC `json:"localAmount"` + SourcePoolData types.TEXT `json:"sourcePoolData"` + MessageId types.TEXT `json:"messageId"` + SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` + Finality ccipcodec.FinalityConfig `json:"finality"` + Output TokenReceiveTicketClaimedOutput `json:"output"` +} + +// ToMap converts TokenReceiveTicketClaimedEvent to a map for DAML arguments +func (t TokenReceiveTicketClaimedEvent) ToMap() map[string]any { + m := make(map[string]any) + + m["verifiedCCVs"] = func() []any { + res := make([]any, 0, len(t.VerifiedCCVs)) + for _, e := range t.VerifiedCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + m["tokenAdminRegistryInstanceId"] = string(t.TokenAdminRegistryInstanceId) + + m["poolAddress"] = model.NestedToDAMLValue(t.PoolAddress) + + m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + m["sourceAmount"] = string(t.SourceAmount) + + m["localAmount"] = t.LocalAmount + + m["sourcePoolData"] = string(t.SourcePoolData) + + m["messageId"] = string(t.MessageId) + + m["sourceChainSelector"] = t.SourceChainSelector + + m["finality"] = model.NestedToDAMLValue(t.Finality) + + m["output"] = model.NestedToDAMLValue(t.Output) + + return m +} + +func (t TokenReceiveTicketClaimedEvent) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenReceiveTicketClaimedEvent) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenReceiveTicketClaimedEvent to hex string (Canton MCMS format) +func (t TokenReceiveTicketClaimedEvent) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenReceiveTicketClaimedEvent from hex string (Canton MCMS format) +func (t *TokenReceiveTicketClaimedEvent) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenReceiveTicketClaimedCompleted is a Record type +type TokenReceiveTicketClaimedCompleted struct { + ReceiverHoldingCids []types.CONTRACT_ID `json:"receiverHoldingCids"` +} + +// ToMap converts TokenReceiveTicketClaimedCompleted to a map for DAML arguments +func (t TokenReceiveTicketClaimedCompleted) ToMap() map[string]any { + m := make(map[string]any) + + m["receiverHoldingCids"] = func() []any { + res := make([]any, 0, len(t.ReceiverHoldingCids)) + for _, e := range t.ReceiverHoldingCids { + res = append(res, e) + } + return res + }() + + return m +} + +func (t TokenReceiveTicketClaimedCompleted) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenReceiveTicketClaimedCompleted) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenReceiveTicketClaimedCompleted to hex string (Canton MCMS format) +func (t TokenReceiveTicketClaimedCompleted) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenReceiveTicketClaimedCompleted from hex string (Canton MCMS format) +func (t *TokenReceiveTicketClaimedCompleted) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenReceiveTicketClaimedOutput is a variant/union type +type TokenReceiveTicketClaimedOutput struct { + TokenReceiveTicketClaimedPending *TokenReceiveTicketClaimedPending `json:"TokenReceiveTicketClaimed_Pending,omitempty"` + TokenReceiveTicketClaimedCompleted *TokenReceiveTicketClaimedCompleted `json:"TokenReceiveTicketClaimed_Completed,omitempty"` +} + +// MarshalJSON implements custom JSON marshaling for TokenReceiveTicketClaimedOutput +func (v TokenReceiveTicketClaimedOutput) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(v) +} + +// UnmarshalJSON implements custom JSON unmarshalling for TokenReceiveTicketClaimedOutput +func (v *TokenReceiveTicketClaimedOutput) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, v) +} + +// MarshalHex encodes TokenReceiveTicketClaimedOutput to hex string (Canton MCMS format) +func (v TokenReceiveTicketClaimedOutput) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(v) +} + +// UnmarshalHex decodes TokenReceiveTicketClaimedOutput from hex string (Canton MCMS format) +func (v *TokenReceiveTicketClaimedOutput) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, v) +} + +// GetVariantTag implements types.VARIANT interface +func (v TokenReceiveTicketClaimedOutput) GetVariantTag() string { + + if v.TokenReceiveTicketClaimedPending != nil { + return "TokenReceiveTicketClaimed_Pending" + } + + if v.TokenReceiveTicketClaimedCompleted != nil { + return "TokenReceiveTicketClaimed_Completed" + } + + return "" +} + +// GetVariantValue implements types.VARIANT interface +func (v TokenReceiveTicketClaimedOutput) GetVariantValue() any { + + if v.TokenReceiveTicketClaimedPending != nil { + return v.TokenReceiveTicketClaimedPending + } + + if v.TokenReceiveTicketClaimedCompleted != nil { + return v.TokenReceiveTicketClaimedCompleted + } + + return nil +} + +var _ types.VARIANT = (*TokenReceiveTicketClaimedOutput)(nil) + +// TokenReceiveTicketClaimedPending is a Record type +type TokenReceiveTicketClaimedPending struct { + TransferInstructionCid types.CONTRACT_ID `json:"transferInstructionCid"` +} + +// ToMap converts TokenReceiveTicketClaimedPending to a map for DAML arguments +func (t TokenReceiveTicketClaimedPending) ToMap() map[string]any { + m := make(map[string]any) + + m["transferInstructionCid"] = model.NestedToDAMLValue(t.TransferInstructionCid) + + return m +} + +func (t TokenReceiveTicketClaimedPending) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenReceiveTicketClaimedPending) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenReceiveTicketClaimedPending to hex string (Canton MCMS format) +func (t TokenReceiveTicketClaimedPending) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenReceiveTicketClaimedPending from hex string (Canton MCMS format) +func (t *TokenReceiveTicketClaimedPending) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// MCMSEncoder interface for typed encoding methods. +// Implemented by Encoder for method-based encoding. +type MCMSEncoder interface { +} + +// encoder provides typed encoding methods for choice parameters (unexported). +// It wraps bind.BoundTemplate to encode parameters to hex-encoded operation data. +type encoder struct { + *bind.BoundTemplate +} + +// Contract wraps template operations with Sui-style API access. +// Use NewContract to create instances, then call Encoder() for encoding methods. +type Contract struct { + enc *encoder +} + +// NewContract creates a Contract with encoder for the given template. +// This provides Sui-style API: contract.Encoder().Method(args) +func NewContract(packageID, moduleName, templateName string) *Contract { + return &Contract{ + enc: &encoder{ + BoundTemplate: bind.NewBoundTemplate(packageID, moduleName, templateName), + }, + } +} + +// Encoder returns the encoder for Sui-style contract.Encoder().Method() usage. +func (c *Contract) Encoder() MCMSEncoder { + return c.enc +} + +// Verify MCMSEncoder interface implementation +var _ MCMSEncoder = (*encoder)(nil) diff --git a/bindings/generated/latest/ccip/executor/executor.go b/bindings/generated/latest/ccip/executor/executor.go index ab1274ccf..dfe8db6d0 100644 --- a/bindings/generated/latest/ccip/executor/executor.go +++ b/bindings/generated/latest/ccip/executor/executor.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" extensionapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/extensionapi" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" api "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/mcms/api" @@ -28,7 +28,7 @@ var ( const ( PackageName = "ccip-executor" - PackageID = "df2d8d8f288b160402feee5f8d056e7c776b5c9a99eab50afc1e6e5f8d6d428a" + PackageID = "1475d4dab2588f8e032f6b2efa28eb5d1ab53df0f71f89daccd46bec1c37db8c" SDKVersion = "3.4.11" ) @@ -271,7 +271,7 @@ type CalculateFee struct { ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` ExecutorArgs types.TEXT `json:"executorArgs"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -285,7 +285,7 @@ func (t CalculateFee) ToMap() map[string]any { m["executorArgs"] = string(t.ExecutorArgs) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) m["caller"] = t.Caller.ToMap() @@ -319,7 +319,7 @@ func (t *CalculateFee) UnmarshalHex(data string) error { type CalculateFeeMCMSParams struct { ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` ExecutorArgs types.TEXT `json:"executorArgs"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes CalculateFeeMCMSParams to hex string for MCMS operationData. @@ -336,9 +336,9 @@ func (t *CalculateFeeMCMSParams) UnmarshalHex(data string) error { // DynamicConfig is a Record type type DynamicConfig struct { - FeeAggregator *types.PARTY `json:"feeAggregator" hex:"optional"` - AllowedFinalityConfig core.FinalityConfig `json:"allowedFinalityConfig"` - CcvAllowlistEnabled types.BOOL `json:"ccvAllowlistEnabled"` + FeeAggregator *types.PARTY `json:"feeAggregator" hex:"optional"` + AllowedFinalityConfig ccipcodec.FinalityConfig `json:"allowedFinalityConfig"` + CcvAllowlistEnabled types.BOOL `json:"ccvAllowlistEnabled"` } // ToMap converts DynamicConfig to a map for DAML arguments @@ -398,12 +398,12 @@ type Executor struct { // GetTemplateID returns the template ID for this template using the package name func (t Executor) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t Executor) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Executor", "Executor") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor") } // CreateCommand returns a CreateCommand for this template using the package name @@ -512,7 +512,7 @@ func (t *Executor) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t Executor) ApplyDestChainUpdates(contractID string, args ApplyDestChainUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "ApplyDestChainUpdates", Arguments: argsToMap(args), @@ -522,7 +522,7 @@ func (t Executor) ApplyDestChainUpdates(contractID string, args ApplyDestChainUp // ApplyDestChainUpdatesWithPackageID exercises the ApplyDestChainUpdates choice using the provided package ID instead of package name func (t Executor) ApplyDestChainUpdatesWithPackageID(contractID string, packageID string, args ApplyDestChainUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "ApplyDestChainUpdates", Arguments: argsToMap(args), @@ -533,7 +533,7 @@ func (t Executor) ApplyDestChainUpdatesWithPackageID(contractID string, packageI // This method uses the package name in the template ID func (t Executor) SetDynamicConfig(contractID string, args SetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "SetDynamicConfig", Arguments: argsToMap(args), @@ -543,7 +543,7 @@ func (t Executor) SetDynamicConfig(contractID string, args SetDynamicConfig) *mo // SetDynamicConfigWithPackageID exercises the SetDynamicConfig choice using the provided package ID instead of package name func (t Executor) SetDynamicConfigWithPackageID(contractID string, packageID string, args SetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "SetDynamicConfig", Arguments: argsToMap(args), @@ -554,7 +554,7 @@ func (t Executor) SetDynamicConfigWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t Executor) CalculateFee(contractID string, args CalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "CalculateFee", Arguments: argsToMap(args), @@ -564,7 +564,7 @@ func (t Executor) CalculateFee(contractID string, args CalculateFee) *model.Exer // CalculateFeeWithPackageID exercises the CalculateFee choice using the provided package ID instead of package name func (t Executor) CalculateFeeWithPackageID(contractID string, packageID string, args CalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "CalculateFee", Arguments: argsToMap(args), @@ -575,7 +575,7 @@ func (t Executor) CalculateFeeWithPackageID(contractID string, packageID string, // This method uses the package name in the template ID func (t Executor) GetFee(contractID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -585,7 +585,7 @@ func (t Executor) GetFee(contractID string, args GetFee) *model.ExerciseCommand // GetFeeWithPackageID exercises the GetFee choice using the provided package ID instead of package name func (t Executor) GetFeeWithPackageID(contractID string, packageID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -596,7 +596,7 @@ func (t Executor) GetFeeWithPackageID(contractID string, packageID string, args // This method uses the package name in the template ID func (t Executor) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -606,7 +606,7 @@ func (t Executor) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t Executor) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -617,7 +617,7 @@ func (t Executor) ArchiveWithPackageID(contractID string, packageID string) *mod // This method uses the package name in the template ID func (t Executor) GetDestChains(contractID string, args GetDestChains) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetDestChains", Arguments: argsToMap(args), @@ -627,7 +627,7 @@ func (t Executor) GetDestChains(contractID string, args GetDestChains) *model.Ex // GetDestChainsWithPackageID exercises the GetDestChains choice using the provided package ID instead of package name func (t Executor) GetDestChainsWithPackageID(contractID string, packageID string, args GetDestChains) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetDestChains", Arguments: argsToMap(args), @@ -638,7 +638,7 @@ func (t Executor) GetDestChainsWithPackageID(contractID string, packageID string // This method uses the package name in the template ID func (t Executor) GetDynamicConfig(contractID string, args GetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetDynamicConfig", Arguments: argsToMap(args), @@ -648,7 +648,7 @@ func (t Executor) GetDynamicConfig(contractID string, args GetDynamicConfig) *mo // GetDynamicConfigWithPackageID exercises the GetDynamicConfig choice using the provided package ID instead of package name func (t Executor) GetDynamicConfigWithPackageID(contractID string, packageID string, args GetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetDynamicConfig", Arguments: argsToMap(args), @@ -659,7 +659,7 @@ func (t Executor) GetDynamicConfigWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t Executor) GetAllowedCCVs(contractID string, args GetAllowedCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetAllowedCCVs", Arguments: argsToMap(args), @@ -669,7 +669,7 @@ func (t Executor) GetAllowedCCVs(contractID string, args GetAllowedCCVs) *model. // GetAllowedCCVsWithPackageID exercises the GetAllowedCCVs choice using the provided package ID instead of package name func (t Executor) GetAllowedCCVsWithPackageID(contractID string, packageID string, args GetAllowedCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetAllowedCCVs", Arguments: argsToMap(args), @@ -680,7 +680,7 @@ func (t Executor) GetAllowedCCVsWithPackageID(contractID string, packageID strin // This method uses the package name in the template ID func (t Executor) GetMaxCCVsPerMessage(contractID string, args GetMaxCCVsPerMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetMaxCCVsPerMessage", Arguments: argsToMap(args), @@ -690,7 +690,7 @@ func (t Executor) GetMaxCCVsPerMessage(contractID string, args GetMaxCCVsPerMess // GetMaxCCVsPerMessageWithPackageID exercises the GetMaxCCVsPerMessage choice using the provided package ID instead of package name func (t Executor) GetMaxCCVsPerMessageWithPackageID(contractID string, packageID string, args GetMaxCCVsPerMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetMaxCCVsPerMessage", Arguments: argsToMap(args), @@ -701,7 +701,7 @@ func (t Executor) GetMaxCCVsPerMessageWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t Executor) GetAllowedFinalityConfig(contractID string, args GetAllowedFinalityConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetAllowedFinalityConfig", Arguments: argsToMap(args), @@ -711,7 +711,7 @@ func (t Executor) GetAllowedFinalityConfig(contractID string, args GetAllowedFin // GetAllowedFinalityConfigWithPackageID exercises the GetAllowedFinalityConfig choice using the provided package ID instead of package name func (t Executor) GetAllowedFinalityConfigWithPackageID(contractID string, packageID string, args GetAllowedFinalityConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "GetAllowedFinalityConfig", Arguments: argsToMap(args), @@ -722,7 +722,7 @@ func (t Executor) GetAllowedFinalityConfigWithPackageID(contractID string, packa // This method uses the package name in the template ID func (t Executor) ApplyAllowedCCVUpdates(contractID string, args ApplyAllowedCCVUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "ApplyAllowedCCVUpdates", Arguments: argsToMap(args), @@ -732,7 +732,7 @@ func (t Executor) ApplyAllowedCCVUpdates(contractID string, args ApplyAllowedCCV // ApplyAllowedCCVUpdatesWithPackageID exercises the ApplyAllowedCCVUpdates choice using the provided package ID instead of package name func (t Executor) ApplyAllowedCCVUpdatesWithPackageID(contractID string, packageID string, args ApplyAllowedCCVUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "Executor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "Executor"), ContractID: contractID, Choice: "ApplyAllowedCCVUpdates", Arguments: argsToMap(args), @@ -743,7 +743,7 @@ func (t Executor) ApplyAllowedCCVUpdatesWithPackageID(contractID string, package // This method uses the package name in the template ID func (t Executor) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -753,7 +753,7 @@ func (t Executor) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceive // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t Executor) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -764,7 +764,7 @@ func (t Executor) MCMSReceiverEntrypointWithPackageID(contractID string, package // This method uses the package name in the template ID func (t Executor) ExecutorCalculateFee(contractID string, args extensionapi.ExecutorCalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "IExecutor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "IExecutor"), ContractID: contractID, Choice: "Executor_CalculateFee", Arguments: argsToMap(args), @@ -774,7 +774,7 @@ func (t Executor) ExecutorCalculateFee(contractID string, args extensionapi.Exec // ExecutorCalculateFeeWithPackageID exercises the Executor_CalculateFee choice using the provided package ID instead of package name func (t Executor) ExecutorCalculateFeeWithPackageID(contractID string, packageID string, args extensionapi.ExecutorCalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "IExecutor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "IExecutor"), ContractID: contractID, Choice: "Executor_CalculateFee", Arguments: argsToMap(args), @@ -785,7 +785,7 @@ func (t Executor) ExecutorCalculateFeeWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t Executor) ExecutorGetFee(contractID string, args extensionapi.ExecutorGetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Executor", "IExecutor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.ExecutorV1", "IExecutor"), ContractID: contractID, Choice: "Executor_GetFee", Arguments: argsToMap(args), @@ -795,7 +795,7 @@ func (t Executor) ExecutorGetFee(contractID string, args extensionapi.ExecutorGe // ExecutorGetFeeWithPackageID exercises the Executor_GetFee choice using the provided package ID instead of package name func (t Executor) ExecutorGetFeeWithPackageID(contractID string, packageID string, args extensionapi.ExecutorGetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Executor", "IExecutor"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.ExecutorV1", "IExecutor"), ContractID: contractID, Choice: "Executor_GetFee", Arguments: argsToMap(args), @@ -1022,10 +1022,11 @@ func (t *GetDynamicConfigMCMSParams) UnmarshalHex(data string) error { // GetFee is a Record type type GetFee struct { - ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` - DestChainSelector types.NUMERIC `json:"destChainSelector"` - RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` - Caller types.PARTY `json:"caller"` + ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetFee to a map for DAML arguments @@ -1044,6 +1045,8 @@ func (t GetFee) ToMap() map[string]any { return res }() + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1074,9 +1077,10 @@ func (t *GetFee) UnmarshalHex(data string) error { // GetFeeMCMSParams is GetFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetFeeMCMSParams struct { - ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` - DestChainSelector types.NUMERIC `json:"destChainSelector"` - RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` + ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetFeeMCMSParams to hex string for MCMS operationData. diff --git a/bindings/generated/latest/ccip/extensionapi/extensionapi.go b/bindings/generated/latest/ccip/extensionapi/extensionapi.go index dd6903965..ed6b1fc9f 100644 --- a/bindings/generated/latest/ccip/extensionapi/extensionapi.go +++ b/bindings/generated/latest/ccip/extensionapi/extensionapi.go @@ -6,7 +6,6 @@ import ( "math/big" "strings" - core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" splice_api_token_holding_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" splice_api_token_metadata_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" @@ -27,7 +26,7 @@ var ( const ( PackageName = "ccip-extension-api" - PackageID = "ee0ce484b84662844791067b50f89f98959b9259841bb00b7a70d60a768ff351" + PackageID = "fddd2b2b8b1e423231232a39ffbe654b1888be99cdb27686ab43f83b119366e2" SDKVersion = "3.4.11" ) @@ -117,11 +116,12 @@ func argsToMap(args any) map[string]any { // CrossChainVerifierFeeQuote is a Record type type CrossChainVerifierFeeQuote struct { - CcvInstanceId types.TEXT `json:"ccvInstanceId"` - CcvOwner types.PARTY `json:"ccvOwner"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` - GasForVerification types.INT64 `json:"gasForVerification"` - PayloadSizeBytes types.INT64 `json:"payloadSizeBytes"` + CcvInstanceId types.TEXT `json:"ccvInstanceId"` + CcvOwner types.PARTY `json:"ccvOwner"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + GasForVerification types.INT64 `json:"gasForVerification"` + PayloadSizeBytes types.INT64 `json:"payloadSizeBytes"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts CrossChainVerifierFeeQuote to a map for DAML arguments @@ -138,6 +138,8 @@ func (t CrossChainVerifierFeeQuote) ToMap() map[string]any { m["payloadSizeBytes"] = int64(t.PayloadSizeBytes) + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -165,10 +167,11 @@ func (t *CrossChainVerifierFeeQuote) UnmarshalHex(data string) error { // CrossChainVerifierView is a Record type type CrossChainVerifierView struct { - InstanceId types.TEXT `json:"instanceId"` - Owner types.PARTY `json:"owner"` - CcipOwner types.PARTY `json:"ccipOwner"` - StorageLocations []types.TEXT `json:"storageLocations"` + InstanceId types.TEXT `json:"instanceId"` + Owner types.PARTY `json:"owner"` + CcipOwner types.PARTY `json:"ccipOwner"` + StorageLocations []types.TEXT `json:"storageLocations"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts CrossChainVerifierView to a map for DAML arguments @@ -189,6 +192,8 @@ func (t CrossChainVerifierView) ToMap() map[string]any { return res }() + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -217,7 +222,7 @@ func (t *CrossChainVerifierView) UnmarshalHex(data string) error { // CrossChainVerifierCalculateFee is a Record type type CrossChainVerifierCalculateFee struct { SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -227,7 +232,7 @@ func (t CrossChainVerifierCalculateFee) ToMap() map[string]any { m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) m["caller"] = t.Caller.ToMap() @@ -259,9 +264,9 @@ func (t *CrossChainVerifierCalculateFee) UnmarshalHex(data string) error { // CrossChainVerifierForwardToVerifier is a Record type type CrossChainVerifierForwardToVerifier struct { RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` VerifierArgs types.TEXT `json:"verifierArgs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -271,12 +276,12 @@ func (t CrossChainVerifierForwardToVerifier) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["verifierArgs"] = string(t.VerifierArgs) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -306,8 +311,9 @@ func (t *CrossChainVerifierForwardToVerifier) UnmarshalHex(data string) error { // CrossChainVerifierGetFee is a Record type type CrossChainVerifierGetFee struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - Caller types.PARTY `json:"caller"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts CrossChainVerifierGetFee to a map for DAML arguments @@ -316,6 +322,8 @@ func (t CrossChainVerifierGetFee) ToMap() map[string]any { m["destChainSelector"] = t.DestChainSelector + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -346,9 +354,9 @@ func (t *CrossChainVerifierGetFee) UnmarshalHex(data string) error { // CrossChainVerifierVerifyMessage is a Record type type CrossChainVerifierVerifyMessage struct { RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` VerifierResults types.TEXT `json:"verifierResults"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -358,12 +366,12 @@ func (t CrossChainVerifierVerifyMessage) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) m["verifierResults"] = string(t.VerifierResults) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -393,9 +401,10 @@ func (t *CrossChainVerifierVerifyMessage) UnmarshalHex(data string) error { // ExecutorFeeQuote is a Record type type ExecutorFeeQuote struct { - ExecutorInstanceId types.TEXT `json:"executorInstanceId"` - ExecutorOwner types.PARTY `json:"executorOwner"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + ExecutorInstanceId types.TEXT `json:"executorInstanceId"` + ExecutorOwner types.PARTY `json:"executorOwner"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts ExecutorFeeQuote to a map for DAML arguments @@ -408,6 +417,8 @@ func (t ExecutorFeeQuote) ToMap() map[string]any { m["feeUSDCents"] = t.FeeUSDCents + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -435,8 +446,9 @@ func (t *ExecutorFeeQuote) UnmarshalHex(data string) error { // ExecutorView is a Record type type ExecutorView struct { - InstanceId types.TEXT `json:"instanceId"` - Owner types.PARTY `json:"owner"` + InstanceId types.TEXT `json:"instanceId"` + Owner types.PARTY `json:"owner"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts ExecutorView to a map for DAML arguments @@ -447,6 +459,8 @@ func (t ExecutorView) ToMap() map[string]any { m["owner"] = t.Owner.ToMap() + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -477,7 +491,7 @@ type ExecutorCalculateFee struct { ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` ExecutorArgs types.TEXT `json:"executorArgs"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -491,7 +505,7 @@ func (t ExecutorCalculateFee) ToMap() map[string]any { m["executorArgs"] = string(t.ExecutorArgs) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) m["caller"] = t.Caller.ToMap() @@ -522,10 +536,11 @@ func (t *ExecutorCalculateFee) UnmarshalHex(data string) error { // ExecutorGetFee is a Record type type ExecutorGetFee struct { - ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` - DestChainSelector types.NUMERIC `json:"destChainSelector"` - RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` - Caller types.PARTY `json:"caller"` + ExpectedExecutor chainlinkapi.RawInstanceAddress `json:"expectedExecutor"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts ExecutorGetFee to a map for DAML arguments @@ -544,6 +559,8 @@ func (t ExecutorGetFee) ToMap() map[string]any { return res }() + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -573,9 +590,10 @@ func (t *ExecutorGetFee) UnmarshalHex(data string) error { // LockOrBurnResult is a Record type type LockOrBurnResult struct { - PoolChangeCids []types.CONTRACT_ID `json:"poolChangeCids"` - SenderChangeCids []types.CONTRACT_ID `json:"senderChangeCids"` - SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + PoolChangeCids []types.CONTRACT_ID `json:"poolChangeCids"` + SenderChangeCids []types.CONTRACT_ID `json:"senderChangeCids"` + SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts LockOrBurnResult to a map for DAML arguments @@ -600,6 +618,8 @@ func (t LockOrBurnResult) ToMap() map[string]any { m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -627,9 +647,10 @@ func (t *LockOrBurnResult) UnmarshalHex(data string) error { // ReleaseOrMintResult is a Record type type ReleaseOrMintResult struct { - Output ReleaseOrMintResultOutput `json:"output"` - PoolChangeCids []types.CONTRACT_ID `json:"poolChangeCids"` - ClaimedEventCid types.CONTRACT_ID `json:"claimedEventCid"` + Output ReleaseOrMintResultOutput `json:"output"` + PoolChangeCids []types.CONTRACT_ID `json:"poolChangeCids"` + ClaimedEventCid types.CONTRACT_ID `json:"claimedEventCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts ReleaseOrMintResult to a map for DAML arguments @@ -648,6 +669,8 @@ func (t ReleaseOrMintResult) ToMap() map[string]any { m["claimedEventCid"] = model.NestedToDAMLValue(t.ClaimedEventCid) + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -813,13 +836,14 @@ func (t *ReleaseOrMintResultPending) UnmarshalHex(data string) error { // TokenPoolFeeQuote is a Record type type TokenPoolFeeQuote struct { - PoolInstanceId types.TEXT `json:"poolInstanceId"` - PoolOwner types.PARTY `json:"poolOwner"` - FeeUSDCents types.NUMERIC `json:"feeUSDCents"` - DestGasOverhead types.INT64 `json:"destGasOverhead"` - DestBytesOverhead types.INT64 `json:"destBytesOverhead"` - TokenFeeBps types.NUMERIC `json:"tokenFeeBps"` - IsEnabled types.BOOL `json:"isEnabled"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolOwner types.PARTY `json:"poolOwner"` + FeeUSDCents types.NUMERIC `json:"feeUSDCents"` + DestGasOverhead types.INT64 `json:"destGasOverhead"` + DestBytesOverhead types.INT64 `json:"destBytesOverhead"` + TokenFeeBps types.NUMERIC `json:"tokenFeeBps"` + IsEnabled types.BOOL `json:"isEnabled"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts TokenPoolFeeQuote to a map for DAML arguments @@ -840,6 +864,8 @@ func (t TokenPoolFeeQuote) ToMap() map[string]any { m["isEnabled"] = bool(t.IsEnabled) + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -867,9 +893,10 @@ func (t *TokenPoolFeeQuote) UnmarshalHex(data string) error { // TokenPoolView is a Record type type TokenPoolView struct { - Owner types.PARTY `json:"owner"` - CcipOwner types.PARTY `json:"ccipOwner"` - InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Owner types.PARTY `json:"owner"` + CcipOwner types.PARTY `json:"ccipOwner"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts TokenPoolView to a map for DAML arguments @@ -882,6 +909,8 @@ func (t TokenPoolView) ToMap() map[string]any { m["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -911,10 +940,10 @@ func (t *TokenPoolView) UnmarshalHex(data string) error { type TokenPoolCalculateFee struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -926,14 +955,14 @@ func (t TokenPoolCalculateFee) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["feeQuoterCid"] = model.NestedToDAMLValue(t.FeeQuoterCid) m["tokenInstrumentId"] = model.NestedToDAMLValue(t.TokenInstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -963,10 +992,11 @@ func (t *TokenPoolCalculateFee) UnmarshalHex(data string) error { // TokenPoolGetFee is a Record type type TokenPoolGetFee struct { - FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` - DestChainSelector types.NUMERIC `json:"destChainSelector"` - TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` - Caller types.PARTY `json:"caller"` + FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts TokenPoolGetFee to a map for DAML arguments @@ -979,6 +1009,8 @@ func (t TokenPoolGetFee) ToMap() map[string]any { m["tokenInstrumentId"] = model.NestedToDAMLValue(t.TokenInstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1008,12 +1040,13 @@ func (t *TokenPoolGetFee) UnmarshalHex(data string) error { // TokenPoolGetRequiredCCVs is a Record type type TokenPoolGetRequiredCCVs struct { - RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` - SourceAmount types.TEXT `json:"sourceAmount"` - Finality core.FinalityConfig `json:"finality"` - ExtraData types.TEXT `json:"extraData"` - Direction TransferDirection `json:"direction"` - Caller types.PARTY `json:"caller"` + RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` + SourceAmount types.TEXT `json:"sourceAmount"` + Finality types.TEXT `json:"finality"` + ExtraData types.TEXT `json:"extraData"` + Direction TransferDirection `json:"direction"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts TokenPoolGetRequiredCCVs to a map for DAML arguments @@ -1024,12 +1057,14 @@ func (t TokenPoolGetRequiredCCVs) ToMap() map[string]any { m["sourceAmount"] = string(t.SourceAmount) - m["finality"] = model.NestedToDAMLValue(t.Finality) + m["finality"] = string(t.Finality) m["extraData"] = string(t.ExtraData) m["direction"] = model.NestedToDAMLValue(t.Direction) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1062,10 +1097,10 @@ type TokenPoolLockOrBurn struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` SenderInputCids []types.CONTRACT_ID `json:"senderInputCids"` Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -1079,8 +1114,6 @@ func (t TokenPoolLockOrBurn) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["senderInputCids"] = func() []any { @@ -1093,6 +1126,8 @@ func (t TokenPoolLockOrBurn) ToMap() map[string]any { m["amount"] = t.Amount + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1125,8 +1160,8 @@ type TokenPoolReleaseFromTicket struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` TokenReceiveTicketCid types.CONTRACT_ID `json:"tokenReceiveTicketCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -1140,10 +1175,10 @@ func (t TokenPoolReleaseFromTicket) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1175,8 +1210,8 @@ func (t *TokenPoolReleaseFromTicket) UnmarshalHex(data string) error { type TokenPoolVerifyInboundMessage struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -1188,10 +1223,10 @@ func (t TokenPoolVerifyInboundMessage) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1223,9 +1258,9 @@ func (t *TokenPoolVerifyInboundMessage) UnmarshalHex(data string) error { type TokenPoolVerifyOutboundCCVs struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -1237,12 +1272,12 @@ func (t TokenPoolVerifyOutboundCCVs) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["amount"] = t.Amount + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1282,12 +1317,12 @@ const ( func (e TransferDirection) GetEnumConstructor() string { return string(e) } func (e TransferDirection) GetEnumTypeID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Interfaces.TokenPool", "TransferDirection") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.InterfacesV1.TokenPool", "TransferDirection") } // GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name func (e TransferDirection) GetEnumTypeIDWithPackageID(packageID string) string { - return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Interfaces.TokenPool", "TransferDirection") + return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.InterfacesV1.TokenPool", "TransferDirection") } func (e TransferDirection) MarshalJSON() ([]byte, error) { @@ -1316,32 +1351,32 @@ var _ types.ENUM = TransferDirection("") // IICrossChainVerifierInterfaceID returns the interface ID for the IICrossChainVerifier interface using the package name func IICrossChainVerifierInterfaceID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Interfaces.CrossChainVerifier", "ICrossChainVerifier") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.InterfacesV1.CrossChainVerifier", "ICrossChainVerifier") } // IICrossChainVerifierInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name func IICrossChainVerifierInterfaceIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Interfaces.CrossChainVerifier", "ICrossChainVerifier") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.InterfacesV1.CrossChainVerifier", "ICrossChainVerifier") } // IIExecutorInterfaceID returns the interface ID for the IIExecutor interface using the package name func IIExecutorInterfaceID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Interfaces.Executor", "IExecutor") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.InterfacesV1.Executor", "IExecutor") } // IIExecutorInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name func IIExecutorInterfaceIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Interfaces.Executor", "IExecutor") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.InterfacesV1.Executor", "IExecutor") } // IITokenPoolInterfaceID returns the interface ID for the IITokenPool interface using the package name func IITokenPoolInterfaceID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Interfaces.TokenPool", "ITokenPool") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.InterfacesV1.TokenPool", "ITokenPool") } // IITokenPoolInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name func IITokenPoolInterfaceIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Interfaces.TokenPool", "ITokenPool") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.InterfacesV1.TokenPool", "ITokenPool") } // MCMSEncoder interface for typed encoding methods. diff --git a/bindings/generated/latest/ccip/factory/factory.go b/bindings/generated/latest/ccip/factory/factory.go index 596eb4711..12d0c2aa8 100644 --- a/bindings/generated/latest/ccip/factory/factory.go +++ b/bindings/generated/latest/ccip/factory/factory.go @@ -7,11 +7,13 @@ import ( "strings" burnminttokenpool "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/burnminttokenpool" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" ccipruntime "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" committeeverifier "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" executor "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/executor" lockreleasetokenpool "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/lockreleasetokenpool" + ratelimiter "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ratelimiter" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" link "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/link" api "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/mcms/api" @@ -34,7 +36,7 @@ var ( const ( PackageName = "ccip-factory" - PackageID = "9fe505c991e91a2e1b1cdaf3bb666a4354415bdd72e906b2fce2cfd4e8bd6edd" + PackageID = "a422a55ecbda292f3527b096a0c87ce7ae45029f430583cb7101b00a89dbda86" SDKVersion = "3.4.11" ) @@ -74,12 +76,12 @@ type CCIPFactory struct { // GetTemplateID returns the template ID for this template using the package name func (t CCIPFactory) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t CCIPFactory) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory") } // CreateCommand returns a CreateCommand for this template using the package name @@ -186,7 +188,7 @@ func (t *CCIPFactory) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t CCIPFactory) DeployGlobalConfig(contractID string, args DeployGlobalConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployGlobalConfig", Arguments: argsToMap(args), @@ -196,7 +198,7 @@ func (t CCIPFactory) DeployGlobalConfig(contractID string, args DeployGlobalConf // DeployGlobalConfigWithPackageID exercises the DeployGlobalConfig choice using the provided package ID instead of package name func (t CCIPFactory) DeployGlobalConfigWithPackageID(contractID string, packageID string, args DeployGlobalConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployGlobalConfig", Arguments: argsToMap(args), @@ -207,7 +209,7 @@ func (t CCIPFactory) DeployGlobalConfigWithPackageID(contractID string, packageI // This method uses the package name in the template ID func (t CCIPFactory) DeployFeeQuoter(contractID string, args DeployFeeQuoter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployFeeQuoter", Arguments: argsToMap(args), @@ -217,7 +219,7 @@ func (t CCIPFactory) DeployFeeQuoter(contractID string, args DeployFeeQuoter) *m // DeployFeeQuoterWithPackageID exercises the DeployFeeQuoter choice using the provided package ID instead of package name func (t CCIPFactory) DeployFeeQuoterWithPackageID(contractID string, packageID string, args DeployFeeQuoter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployFeeQuoter", Arguments: argsToMap(args), @@ -228,7 +230,7 @@ func (t CCIPFactory) DeployFeeQuoterWithPackageID(contractID string, packageID s // This method uses the package name in the template ID func (t CCIPFactory) DeployLinkToken(contractID string, args DeployLinkToken) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployLinkToken", Arguments: argsToMap(args), @@ -238,7 +240,7 @@ func (t CCIPFactory) DeployLinkToken(contractID string, args DeployLinkToken) *m // DeployLinkTokenWithPackageID exercises the DeployLinkToken choice using the provided package ID instead of package name func (t CCIPFactory) DeployLinkTokenWithPackageID(contractID string, packageID string, args DeployLinkToken) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployLinkToken", Arguments: argsToMap(args), @@ -249,7 +251,7 @@ func (t CCIPFactory) DeployLinkTokenWithPackageID(contractID string, packageID s // This method uses the package name in the template ID func (t CCIPFactory) DeployTokenAdminRegistry(contractID string, args DeployTokenAdminRegistry) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployTokenAdminRegistry", Arguments: argsToMap(args), @@ -259,7 +261,7 @@ func (t CCIPFactory) DeployTokenAdminRegistry(contractID string, args DeployToke // DeployTokenAdminRegistryWithPackageID exercises the DeployTokenAdminRegistry choice using the provided package ID instead of package name func (t CCIPFactory) DeployTokenAdminRegistryWithPackageID(contractID string, packageID string, args DeployTokenAdminRegistry) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployTokenAdminRegistry", Arguments: argsToMap(args), @@ -270,7 +272,7 @@ func (t CCIPFactory) DeployTokenAdminRegistryWithPackageID(contractID string, pa // This method uses the package name in the template ID func (t CCIPFactory) DeployOnRamp(contractID string, args DeployOnRamp) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployOnRamp", Arguments: argsToMap(args), @@ -280,7 +282,7 @@ func (t CCIPFactory) DeployOnRamp(contractID string, args DeployOnRamp) *model.E // DeployOnRampWithPackageID exercises the DeployOnRamp choice using the provided package ID instead of package name func (t CCIPFactory) DeployOnRampWithPackageID(contractID string, packageID string, args DeployOnRamp) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployOnRamp", Arguments: argsToMap(args), @@ -291,7 +293,7 @@ func (t CCIPFactory) DeployOnRampWithPackageID(contractID string, packageID stri // This method uses the package name in the template ID func (t CCIPFactory) DeployOffRamp(contractID string, args DeployOffRamp) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployOffRamp", Arguments: argsToMap(args), @@ -301,7 +303,7 @@ func (t CCIPFactory) DeployOffRamp(contractID string, args DeployOffRamp) *model // DeployOffRampWithPackageID exercises the DeployOffRamp choice using the provided package ID instead of package name func (t CCIPFactory) DeployOffRampWithPackageID(contractID string, packageID string, args DeployOffRamp) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployOffRamp", Arguments: argsToMap(args), @@ -312,7 +314,7 @@ func (t CCIPFactory) DeployOffRampWithPackageID(contractID string, packageID str // This method uses the package name in the template ID func (t CCIPFactory) DeployPerPartyRouterFactory(contractID string, args DeployPerPartyRouterFactory) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployPerPartyRouterFactory", Arguments: argsToMap(args), @@ -322,7 +324,7 @@ func (t CCIPFactory) DeployPerPartyRouterFactory(contractID string, args DeployP // DeployPerPartyRouterFactoryWithPackageID exercises the DeployPerPartyRouterFactory choice using the provided package ID instead of package name func (t CCIPFactory) DeployPerPartyRouterFactoryWithPackageID(contractID string, packageID string, args DeployPerPartyRouterFactory) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployPerPartyRouterFactory", Arguments: argsToMap(args), @@ -333,7 +335,7 @@ func (t CCIPFactory) DeployPerPartyRouterFactoryWithPackageID(contractID string, // This method uses the package name in the template ID func (t CCIPFactory) DeployRMNRemote(contractID string, args DeployRMNRemote) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployRMNRemote", Arguments: argsToMap(args), @@ -343,7 +345,7 @@ func (t CCIPFactory) DeployRMNRemote(contractID string, args DeployRMNRemote) *m // DeployRMNRemoteWithPackageID exercises the DeployRMNRemote choice using the provided package ID instead of package name func (t CCIPFactory) DeployRMNRemoteWithPackageID(contractID string, packageID string, args DeployRMNRemote) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployRMNRemote", Arguments: argsToMap(args), @@ -354,7 +356,7 @@ func (t CCIPFactory) DeployRMNRemoteWithPackageID(contractID string, packageID s // This method uses the package name in the template ID func (t CCIPFactory) DeployCommitteeVerifier(contractID string, args DeployCommitteeVerifier) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployCommitteeVerifier", Arguments: argsToMap(args), @@ -364,7 +366,7 @@ func (t CCIPFactory) DeployCommitteeVerifier(contractID string, args DeployCommi // DeployCommitteeVerifierWithPackageID exercises the DeployCommitteeVerifier choice using the provided package ID instead of package name func (t CCIPFactory) DeployCommitteeVerifierWithPackageID(contractID string, packageID string, args DeployCommitteeVerifier) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployCommitteeVerifier", Arguments: argsToMap(args), @@ -375,7 +377,7 @@ func (t CCIPFactory) DeployCommitteeVerifierWithPackageID(contractID string, pac // This method uses the package name in the template ID func (t CCIPFactory) DeployExecutor(contractID string, args DeployExecutor) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployExecutor", Arguments: argsToMap(args), @@ -385,7 +387,7 @@ func (t CCIPFactory) DeployExecutor(contractID string, args DeployExecutor) *mod // DeployExecutorWithPackageID exercises the DeployExecutor choice using the provided package ID instead of package name func (t CCIPFactory) DeployExecutorWithPackageID(contractID string, packageID string, args DeployExecutor) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployExecutor", Arguments: argsToMap(args), @@ -396,7 +398,7 @@ func (t CCIPFactory) DeployExecutorWithPackageID(contractID string, packageID st // This method uses the package name in the template ID func (t CCIPFactory) DeployLockReleaseTokenPool(contractID string, args DeployLockReleaseTokenPool) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployLockReleaseTokenPool", Arguments: argsToMap(args), @@ -406,7 +408,7 @@ func (t CCIPFactory) DeployLockReleaseTokenPool(contractID string, args DeployLo // DeployLockReleaseTokenPoolWithPackageID exercises the DeployLockReleaseTokenPool choice using the provided package ID instead of package name func (t CCIPFactory) DeployLockReleaseTokenPoolWithPackageID(contractID string, packageID string, args DeployLockReleaseTokenPool) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployLockReleaseTokenPool", Arguments: argsToMap(args), @@ -417,7 +419,7 @@ func (t CCIPFactory) DeployLockReleaseTokenPoolWithPackageID(contractID string, // This method uses the package name in the template ID func (t CCIPFactory) DeployBurnMintTokenPool(contractID string, args DeployBurnMintTokenPool) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployBurnMintTokenPool", Arguments: argsToMap(args), @@ -427,7 +429,7 @@ func (t CCIPFactory) DeployBurnMintTokenPool(contractID string, args DeployBurnM // DeployBurnMintTokenPoolWithPackageID exercises the DeployBurnMintTokenPool choice using the provided package ID instead of package name func (t CCIPFactory) DeployBurnMintTokenPoolWithPackageID(contractID string, packageID string, args DeployBurnMintTokenPool) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployBurnMintTokenPool", Arguments: argsToMap(args), @@ -438,7 +440,7 @@ func (t CCIPFactory) DeployBurnMintTokenPoolWithPackageID(contractID string, pac // This method uses the package name in the template ID func (t CCIPFactory) DeployRateLimiter(contractID string, args DeployRateLimiter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployRateLimiter", Arguments: argsToMap(args), @@ -448,7 +450,7 @@ func (t CCIPFactory) DeployRateLimiter(contractID string, args DeployRateLimiter // DeployRateLimiterWithPackageID exercises the DeployRateLimiter choice using the provided package ID instead of package name func (t CCIPFactory) DeployRateLimiterWithPackageID(contractID string, packageID string, args DeployRateLimiter) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "DeployRateLimiter", Arguments: argsToMap(args), @@ -459,7 +461,7 @@ func (t CCIPFactory) DeployRateLimiterWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t CCIPFactory) SetOwnerToMCMS(contractID string, args SetOwnerToMCMS) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "SetOwnerToMCMS", Arguments: argsToMap(args), @@ -469,7 +471,7 @@ func (t CCIPFactory) SetOwnerToMCMS(contractID string, args SetOwnerToMCMS) *mod // SetOwnerToMCMSWithPackageID exercises the SetOwnerToMCMS choice using the provided package ID instead of package name func (t CCIPFactory) SetOwnerToMCMSWithPackageID(contractID string, packageID string, args SetOwnerToMCMS) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "SetOwnerToMCMS", Arguments: argsToMap(args), @@ -480,7 +482,7 @@ func (t CCIPFactory) SetOwnerToMCMSWithPackageID(contractID string, packageID st // This method uses the package name in the template ID func (t CCIPFactory) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "MCMSReceiver"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -490,7 +492,7 @@ func (t CCIPFactory) Archive(contractID string) *model.ExerciseCommand { // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t CCIPFactory) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "MCMSReceiver"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -501,7 +503,7 @@ func (t CCIPFactory) ArchiveWithPackageID(contractID string, packageID string) * // This method uses the package name in the template ID func (t CCIPFactory) GetFactoryState(contractID string, args GetFactoryState) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "GetFactoryState", Arguments: argsToMap(args), @@ -511,7 +513,7 @@ func (t CCIPFactory) GetFactoryState(contractID string, args GetFactoryState) *m // GetFactoryStateWithPackageID exercises the GetFactoryState choice using the provided package ID instead of package name func (t CCIPFactory) GetFactoryStateWithPackageID(contractID string, packageID string, args GetFactoryState) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "CCIPFactory"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "CCIPFactory"), ContractID: contractID, Choice: "GetFactoryState", Arguments: argsToMap(args), @@ -522,7 +524,7 @@ func (t CCIPFactory) GetFactoryStateWithPackageID(contractID string, packageID s // This method uses the package name in the template ID func (t CCIPFactory) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.Factory", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.FactoryV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -532,7 +534,7 @@ func (t CCIPFactory) MCMSReceiverEntrypoint(contractID string, args api.MCMSRece // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t CCIPFactory) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.Factory", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.FactoryV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -814,11 +816,11 @@ func (t *DeployExecutor) UnmarshalHex(data string) error { // DeployExecutorParams is a Record type type DeployExecutorParams struct { - InstanceId types.TEXT `json:"instanceId"` - Owner types.PARTY `json:"owner"` - MaxCCVsPerMsg types.INT64 `json:"maxCCVsPerMsg"` - AllowedFinalityConfig core.FinalityConfig `json:"allowedFinalityConfig"` - CcvAllowlistEnabled types.BOOL `json:"ccvAllowlistEnabled"` + InstanceId types.TEXT `json:"instanceId"` + Owner types.PARTY `json:"owner"` + MaxCCVsPerMsg types.INT64 `json:"maxCCVsPerMsg"` + AllowedFinalityConfig ccipcodec.FinalityConfig `json:"allowedFinalityConfig"` + CcvAllowlistEnabled types.BOOL `json:"ccvAllowlistEnabled"` } // ToMap converts DeployExecutorParams to a map for DAML arguments @@ -1321,7 +1323,6 @@ type DeployOnRampParams struct { RmnRemote chainlinkapi.RawInstanceAddress `json:"rmnRemote"` TokenAdminRegistry chainlinkapi.RawInstanceAddress `json:"tokenAdminRegistry"` FeeQuoter chainlinkapi.RawInstanceAddress `json:"feeQuoter"` - CcvRegistry chainlinkapi.RawInstanceAddress `json:"ccvRegistry"` MaxUSDCentsPerMsg types.NUMERIC `json:"maxUSDCentsPerMsg"` } @@ -1339,8 +1340,6 @@ func (t DeployOnRampParams) ToMap() map[string]any { m["feeQuoter"] = model.NestedToDAMLValue(t.FeeQuoter) - m["ccvRegistry"] = model.NestedToDAMLValue(t.CcvRegistry) - m["maxUSDCentsPerMsg"] = t.MaxUSDCentsPerMsg return m @@ -1556,7 +1555,7 @@ func (t *DeployRMNRemoteParams) UnmarshalHex(data string) error { // DeployRateLimiter is a Record type type DeployRateLimiter struct { - Contract core.RateLimiter `json:"contract"` + Contract ratelimiter.RateLimiter `json:"contract"` } // ToMap converts DeployRateLimiter to a map for DAML arguments @@ -1592,15 +1591,15 @@ func (t *DeployRateLimiter) UnmarshalHex(data string) error { // DeployRateLimiterParams is a Record type type DeployRateLimiterParams struct { - InstanceId types.TEXT `json:"instanceId"` - PoolInstanceId types.TEXT `json:"poolInstanceId"` - PoolOwner types.PARTY `json:"poolOwner"` - RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` - Direction core.RateLimitDirection `json:"direction"` - Mode core.RateLimitMode `json:"mode"` - IsEnabled types.BOOL `json:"isEnabled"` - Capacity types.NUMERIC `json:"capacity"` - Rate types.NUMERIC `json:"rate"` + InstanceId types.TEXT `json:"instanceId"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolOwner types.PARTY `json:"poolOwner"` + RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` + Direction ratelimiter.RateLimitDirection `json:"direction"` + Mode ratelimiter.RateLimitMode `json:"mode"` + IsEnabled types.BOOL `json:"isEnabled"` + Capacity types.NUMERIC `json:"capacity"` + Rate types.NUMERIC `json:"rate"` } // ToMap converts DeployRateLimiterParams to a map for DAML arguments diff --git a/bindings/generated/latest/ccip/lockreleasetokenpool/lockreleasetokenpool.go b/bindings/generated/latest/ccip/lockreleasetokenpool/lockreleasetokenpool.go index e20e93852..1a13e84b3 100644 --- a/bindings/generated/latest/ccip/lockreleasetokenpool/lockreleasetokenpool.go +++ b/bindings/generated/latest/ccip/lockreleasetokenpool/lockreleasetokenpool.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" extensionapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/extensionapi" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" api "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/mcms/api" @@ -29,7 +29,7 @@ var ( const ( PackageName = "ccip-lock-release-token-pool" - PackageID = "91d0fb5eebbd1eab9139f8d95db42b3c0ea9bb3669cb34f48f1f2d597d65b119" + PackageID = "4afbee36aa18fd5ebfc041a8fdb7c0ce388013a4d91420af4527700ab364c5ad" SDKVersion = "3.4.11" ) @@ -429,10 +429,10 @@ func (t *ApplyTokenTransferFeeConfigUpdatesParams) UnmarshalHex(data string) err type CalculateFee struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -444,14 +444,14 @@ func (t CalculateFee) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["feeQuoterCid"] = model.NestedToDAMLValue(t.FeeQuoterCid) m["tokenInstrumentId"] = model.NestedToDAMLValue(t.TokenInstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -482,8 +482,8 @@ func (t *CalculateFee) UnmarshalHex(data string) error { // CalculateFeeMCMSParams is CalculateFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type CalculateFeeMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes CalculateFeeMCMSParams to hex string for MCMS operationData. @@ -505,7 +505,7 @@ type ChainUpdate struct { RemoteTokenAddress types.TEXT `json:"remoteTokenAddress" hex:"bytes"` InboundCCVs []chainlinkapi.RawInstanceAddress `json:"inboundCCVs"` OutboundCCVs []chainlinkapi.RawInstanceAddress `json:"outboundCCVs"` - FinalityConfig core.FinalityConfig `json:"finalityConfig"` + FinalityConfig ccipcodec.FinalityConfig `json:"finalityConfig"` InboundRateLimiter chainlinkapi.RawInstanceAddress `json:"inboundRateLimiter"` InboundCustomBlockConfirmationsRateLimiter chainlinkapi.RawInstanceAddress `json:"inboundCustomBlockConfirmationsRateLimiter"` OutboundRateLimiter chainlinkapi.RawInstanceAddress `json:"outboundRateLimiter"` @@ -610,10 +610,11 @@ func (t *ClearPoolReceiveContext) UnmarshalHex(data string) error { // GetFee is a Record type type GetFee struct { - FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` - DestChainSelector types.NUMERIC `json:"destChainSelector"` - TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` - Caller types.PARTY `json:"caller"` + FeeQuoterCid types.CONTRACT_ID `json:"feeQuoterCid"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Caller types.PARTY `json:"caller"` } // ToMap converts GetFee to a map for DAML arguments @@ -626,6 +627,8 @@ func (t GetFee) ToMap() map[string]any { m["tokenInstrumentId"] = model.NestedToDAMLValue(t.TokenInstrumentId) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -656,8 +659,9 @@ func (t *GetFee) UnmarshalHex(data string) error { // GetFeeMCMSParams is GetFee without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type GetFeeMCMSParams struct { - DestChainSelector types.NUMERIC `json:"destChainSelector"` - TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + TokenInstrumentId splice_api_token_holding_v1.InstrumentId `json:"tokenInstrumentId"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes GetFeeMCMSParams to hex string for MCMS operationData. @@ -676,7 +680,7 @@ func (t *GetFeeMCMSParams) UnmarshalHex(data string) error { type GetRequiredCCVs struct { RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` SourceAmount types.TEXT `json:"sourceAmount"` - Finality core.FinalityConfig `json:"finality"` + Finality ccipcodec.FinalityConfig `json:"finality"` ExtraData types.TEXT `json:"extraData"` Direction extensionapi.TransferDirection `json:"direction"` Caller types.PARTY `json:"caller"` @@ -728,7 +732,7 @@ func (t *GetRequiredCCVs) UnmarshalHex(data string) error { type GetRequiredCCVsMCMSParams struct { RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` SourceAmount types.TEXT `json:"sourceAmount"` - Finality core.FinalityConfig `json:"finality"` + Finality ccipcodec.FinalityConfig `json:"finality"` ExtraData types.TEXT `json:"extraData"` Direction extensionapi.TransferDirection `json:"direction"` } @@ -750,10 +754,10 @@ type LockOrBurn struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` SenderInputCids []types.CONTRACT_ID `json:"senderInputCids"` Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -767,8 +771,6 @@ func (t LockOrBurn) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["senderInputCids"] = func() []any { @@ -781,6 +783,8 @@ func (t LockOrBurn) ToMap() map[string]any { m["amount"] = t.Amount + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -811,9 +815,9 @@ func (t *LockOrBurn) UnmarshalHex(data string) error { // LockOrBurnMCMSParams is LockOrBurn without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type LockOrBurnMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SenderInputCids []types.CONTRACT_ID `json:"senderInputCids"` Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes LockOrBurnMCMSParams to hex string for MCMS operationData. @@ -837,7 +841,7 @@ type LockReleaseTokenPool struct { Decimals types.INT64 `json:"decimals"` RateLimitAdmin *types.PARTY `json:"rateLimitAdmin" hex:"optional"` RemoteChainConfigs map[types.NUMERIC]RemoteChainConfig `json:"remoteChainConfigs"` - TokenTransferFeeConfigs map[types.NUMERIC]TokenTransferFeeConfig2 `json:"tokenTransferFeeConfigs"` + TokenTransferFeeConfigs map[types.NUMERIC]TokenTransferFeeConfig `json:"tokenTransferFeeConfigs"` PoolReceiveContext splice_api_token_metadata_v1.ChoiceContext `json:"poolReceiveContext"` TransferTimeout TransferTimeout `json:"transferTimeout"` Deps LockReleaseTokenPoolDeps `json:"deps"` @@ -845,12 +849,12 @@ type LockReleaseTokenPool struct { // GetTemplateID returns the template ID for this template using the package name func (t LockReleaseTokenPool) GetTemplateID() string { - return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool") + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool") } // GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name func (t LockReleaseTokenPool) GetTemplateIDWithPackageID(packageID string) string { - return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool") + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool") } // CreateCommand returns a CreateCommand for this template using the package name @@ -1005,7 +1009,7 @@ func (t *LockReleaseTokenPool) UnmarshalHex(data string) error { // This method uses the package name in the template ID func (t LockReleaseTokenPool) LockOrBurn(contractID string, args LockOrBurn) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "LockOrBurn", Arguments: argsToMap(args), @@ -1015,7 +1019,7 @@ func (t LockReleaseTokenPool) LockOrBurn(contractID string, args LockOrBurn) *mo // LockOrBurnWithPackageID exercises the LockOrBurn choice using the provided package ID instead of package name func (t LockReleaseTokenPool) LockOrBurnWithPackageID(contractID string, packageID string, args LockOrBurn) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "LockOrBurn", Arguments: argsToMap(args), @@ -1026,7 +1030,7 @@ func (t LockReleaseTokenPool) LockOrBurnWithPackageID(contractID string, package // This method uses the package name in the template ID func (t LockReleaseTokenPool) ReleaseFromTicket(contractID string, args ReleaseFromTicket) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "ReleaseFromTicket", Arguments: argsToMap(args), @@ -1036,7 +1040,7 @@ func (t LockReleaseTokenPool) ReleaseFromTicket(contractID string, args ReleaseF // ReleaseFromTicketWithPackageID exercises the ReleaseFromTicket choice using the provided package ID instead of package name func (t LockReleaseTokenPool) ReleaseFromTicketWithPackageID(contractID string, packageID string, args ReleaseFromTicket) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "ReleaseFromTicket", Arguments: argsToMap(args), @@ -1047,7 +1051,7 @@ func (t LockReleaseTokenPool) ReleaseFromTicketWithPackageID(contractID string, // This method uses the package name in the template ID func (t LockReleaseTokenPool) SetRateLimitConfig(contractID string, args SetRateLimitConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "SetRateLimitConfig", Arguments: argsToMap(args), @@ -1057,7 +1061,7 @@ func (t LockReleaseTokenPool) SetRateLimitConfig(contractID string, args SetRate // SetRateLimitConfigWithPackageID exercises the SetRateLimitConfig choice using the provided package ID instead of package name func (t LockReleaseTokenPool) SetRateLimitConfigWithPackageID(contractID string, packageID string, args SetRateLimitConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "SetRateLimitConfig", Arguments: argsToMap(args), @@ -1068,7 +1072,7 @@ func (t LockReleaseTokenPool) SetRateLimitConfigWithPackageID(contractID string, // This method uses the package name in the template ID func (t LockReleaseTokenPool) ApplyTokenTransferFeeConfigUpdates(contractID string, args ApplyTokenTransferFeeConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "ApplyTokenTransferFeeConfigUpdates", Arguments: argsToMap(args), @@ -1078,7 +1082,7 @@ func (t LockReleaseTokenPool) ApplyTokenTransferFeeConfigUpdates(contractID stri // ApplyTokenTransferFeeConfigUpdatesWithPackageID exercises the ApplyTokenTransferFeeConfigUpdates choice using the provided package ID instead of package name func (t LockReleaseTokenPool) ApplyTokenTransferFeeConfigUpdatesWithPackageID(contractID string, packageID string, args ApplyTokenTransferFeeConfigUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "ApplyTokenTransferFeeConfigUpdates", Arguments: argsToMap(args), @@ -1089,7 +1093,7 @@ func (t LockReleaseTokenPool) ApplyTokenTransferFeeConfigUpdatesWithPackageID(co // This method uses the package name in the template ID func (t LockReleaseTokenPool) SetRateLimiterReferences(contractID string, args SetRateLimiterReferences) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "SetRateLimiterReferences", Arguments: argsToMap(args), @@ -1099,7 +1103,7 @@ func (t LockReleaseTokenPool) SetRateLimiterReferences(contractID string, args S // SetRateLimiterReferencesWithPackageID exercises the SetRateLimiterReferences choice using the provided package ID instead of package name func (t LockReleaseTokenPool) SetRateLimiterReferencesWithPackageID(contractID string, packageID string, args SetRateLimiterReferences) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "SetRateLimiterReferences", Arguments: argsToMap(args), @@ -1110,7 +1114,7 @@ func (t LockReleaseTokenPool) SetRateLimiterReferencesWithPackageID(contractID s // This method uses the package name in the template ID func (t LockReleaseTokenPool) ApplyChainUpdates(contractID string, args ApplyChainUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "ApplyChainUpdates", Arguments: argsToMap(args), @@ -1120,7 +1124,7 @@ func (t LockReleaseTokenPool) ApplyChainUpdates(contractID string, args ApplyCha // ApplyChainUpdatesWithPackageID exercises the ApplyChainUpdates choice using the provided package ID instead of package name func (t LockReleaseTokenPool) ApplyChainUpdatesWithPackageID(contractID string, packageID string, args ApplyChainUpdates) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "ApplyChainUpdates", Arguments: argsToMap(args), @@ -1131,7 +1135,7 @@ func (t LockReleaseTokenPool) ApplyChainUpdatesWithPackageID(contractID string, // This method uses the package name in the template ID func (t LockReleaseTokenPool) SetDynamicConfig(contractID string, args SetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "SetDynamicConfig", Arguments: argsToMap(args), @@ -1141,7 +1145,7 @@ func (t LockReleaseTokenPool) SetDynamicConfig(contractID string, args SetDynami // SetDynamicConfigWithPackageID exercises the SetDynamicConfig choice using the provided package ID instead of package name func (t LockReleaseTokenPool) SetDynamicConfigWithPackageID(contractID string, packageID string, args SetDynamicConfig) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "SetDynamicConfig", Arguments: argsToMap(args), @@ -1152,7 +1156,7 @@ func (t LockReleaseTokenPool) SetDynamicConfigWithPackageID(contractID string, p // This method uses the package name in the template ID func (t LockReleaseTokenPool) AddPoolReceiveContextNonContractValue(contractID string, args AddPoolReceiveContextNonContractValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "AddPoolReceiveContextNonContractValue", Arguments: argsToMap(args), @@ -1162,7 +1166,7 @@ func (t LockReleaseTokenPool) AddPoolReceiveContextNonContractValue(contractID s // AddPoolReceiveContextNonContractValueWithPackageID exercises the AddPoolReceiveContextNonContractValue choice using the provided package ID instead of package name func (t LockReleaseTokenPool) AddPoolReceiveContextNonContractValueWithPackageID(contractID string, packageID string, args AddPoolReceiveContextNonContractValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "AddPoolReceiveContextNonContractValue", Arguments: argsToMap(args), @@ -1173,7 +1177,7 @@ func (t LockReleaseTokenPool) AddPoolReceiveContextNonContractValueWithPackageID // This method uses the package name in the template ID func (t LockReleaseTokenPool) AddPoolReceiveContextContractValue(contractID string, args AddPoolReceiveContextContractValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "AddPoolReceiveContextContractValue", Arguments: argsToMap(args), @@ -1183,7 +1187,7 @@ func (t LockReleaseTokenPool) AddPoolReceiveContextContractValue(contractID stri // AddPoolReceiveContextContractValueWithPackageID exercises the AddPoolReceiveContextContractValue choice using the provided package ID instead of package name func (t LockReleaseTokenPool) AddPoolReceiveContextContractValueWithPackageID(contractID string, packageID string, args AddPoolReceiveContextContractValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "AddPoolReceiveContextContractValue", Arguments: argsToMap(args), @@ -1194,7 +1198,7 @@ func (t LockReleaseTokenPool) AddPoolReceiveContextContractValueWithPackageID(co // This method uses the package name in the template ID func (t LockReleaseTokenPool) RemovePoolReceiveContextValue(contractID string, args RemovePoolReceiveContextValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "RemovePoolReceiveContextValue", Arguments: argsToMap(args), @@ -1204,7 +1208,7 @@ func (t LockReleaseTokenPool) RemovePoolReceiveContextValue(contractID string, a // RemovePoolReceiveContextValueWithPackageID exercises the RemovePoolReceiveContextValue choice using the provided package ID instead of package name func (t LockReleaseTokenPool) RemovePoolReceiveContextValueWithPackageID(contractID string, packageID string, args RemovePoolReceiveContextValue) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "RemovePoolReceiveContextValue", Arguments: argsToMap(args), @@ -1215,7 +1219,7 @@ func (t LockReleaseTokenPool) RemovePoolReceiveContextValueWithPackageID(contrac // This method uses the package name in the template ID func (t LockReleaseTokenPool) ClearPoolReceiveContext(contractID string, args ClearPoolReceiveContext) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "ClearPoolReceiveContext", Arguments: argsToMap(args), @@ -1225,7 +1229,7 @@ func (t LockReleaseTokenPool) ClearPoolReceiveContext(contractID string, args Cl // ClearPoolReceiveContextWithPackageID exercises the ClearPoolReceiveContext choice using the provided package ID instead of package name func (t LockReleaseTokenPool) ClearPoolReceiveContextWithPackageID(contractID string, packageID string, args ClearPoolReceiveContext) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "ClearPoolReceiveContext", Arguments: argsToMap(args), @@ -1236,7 +1240,7 @@ func (t LockReleaseTokenPool) ClearPoolReceiveContextWithPackageID(contractID st // This method uses the package name in the template ID func (t LockReleaseTokenPool) SetTransferTimeout(contractID string, args SetTransferTimeout) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "SetTransferTimeout", Arguments: argsToMap(args), @@ -1246,7 +1250,7 @@ func (t LockReleaseTokenPool) SetTransferTimeout(contractID string, args SetTran // SetTransferTimeoutWithPackageID exercises the SetTransferTimeout choice using the provided package ID instead of package name func (t LockReleaseTokenPool) SetTransferTimeoutWithPackageID(contractID string, packageID string, args SetTransferTimeout) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "SetTransferTimeout", Arguments: argsToMap(args), @@ -1257,7 +1261,7 @@ func (t LockReleaseTokenPool) SetTransferTimeoutWithPackageID(contractID string, // This method uses the package name in the template ID func (t LockReleaseTokenPool) GetRequiredCCVs(contractID string, args GetRequiredCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "GetRequiredCCVs", Arguments: argsToMap(args), @@ -1267,7 +1271,7 @@ func (t LockReleaseTokenPool) GetRequiredCCVs(contractID string, args GetRequire // GetRequiredCCVsWithPackageID exercises the GetRequiredCCVs choice using the provided package ID instead of package name func (t LockReleaseTokenPool) GetRequiredCCVsWithPackageID(contractID string, packageID string, args GetRequiredCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "GetRequiredCCVs", Arguments: argsToMap(args), @@ -1278,7 +1282,7 @@ func (t LockReleaseTokenPool) GetRequiredCCVsWithPackageID(contractID string, pa // This method uses the package name in the template ID func (t LockReleaseTokenPool) VerifyInboundMessage(contractID string, args VerifyInboundMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "VerifyInboundMessage", Arguments: argsToMap(args), @@ -1288,7 +1292,7 @@ func (t LockReleaseTokenPool) VerifyInboundMessage(contractID string, args Verif // VerifyInboundMessageWithPackageID exercises the VerifyInboundMessage choice using the provided package ID instead of package name func (t LockReleaseTokenPool) VerifyInboundMessageWithPackageID(contractID string, packageID string, args VerifyInboundMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "VerifyInboundMessage", Arguments: argsToMap(args), @@ -1299,7 +1303,7 @@ func (t LockReleaseTokenPool) VerifyInboundMessageWithPackageID(contractID strin // This method uses the package name in the template ID func (t LockReleaseTokenPool) VerifyOutboundCCVs(contractID string, args VerifyOutboundCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "VerifyOutboundCCVs", Arguments: argsToMap(args), @@ -1309,7 +1313,7 @@ func (t LockReleaseTokenPool) VerifyOutboundCCVs(contractID string, args VerifyO // VerifyOutboundCCVsWithPackageID exercises the VerifyOutboundCCVs choice using the provided package ID instead of package name func (t LockReleaseTokenPool) VerifyOutboundCCVsWithPackageID(contractID string, packageID string, args VerifyOutboundCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "VerifyOutboundCCVs", Arguments: argsToMap(args), @@ -1320,7 +1324,7 @@ func (t LockReleaseTokenPool) VerifyOutboundCCVsWithPackageID(contractID string, // This method uses the package name in the template ID func (t LockReleaseTokenPool) CalculateFee(contractID string, args CalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "CalculateFee", Arguments: argsToMap(args), @@ -1330,7 +1334,7 @@ func (t LockReleaseTokenPool) CalculateFee(contractID string, args CalculateFee) // CalculateFeeWithPackageID exercises the CalculateFee choice using the provided package ID instead of package name func (t LockReleaseTokenPool) CalculateFeeWithPackageID(contractID string, packageID string, args CalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "CalculateFee", Arguments: argsToMap(args), @@ -1341,7 +1345,7 @@ func (t LockReleaseTokenPool) CalculateFeeWithPackageID(contractID string, packa // This method uses the package name in the template ID func (t LockReleaseTokenPool) Archive(contractID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "TokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "TokenPool"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -1351,7 +1355,7 @@ func (t LockReleaseTokenPool) Archive(contractID string) *model.ExerciseCommand // ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name func (t LockReleaseTokenPool) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "TokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "TokenPool"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -1362,7 +1366,7 @@ func (t LockReleaseTokenPool) ArchiveWithPackageID(contractID string, packageID // This method uses the package name in the template ID func (t LockReleaseTokenPool) GetFee(contractID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -1372,7 +1376,7 @@ func (t LockReleaseTokenPool) GetFee(contractID string, args GetFee) *model.Exer // GetFeeWithPackageID exercises the GetFee choice using the provided package ID instead of package name func (t LockReleaseTokenPool) GetFeeWithPackageID(contractID string, packageID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "LockReleaseTokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "LockReleaseTokenPool"), ContractID: contractID, Choice: "GetFee", Arguments: argsToMap(args), @@ -1383,7 +1387,7 @@ func (t LockReleaseTokenPool) GetFeeWithPackageID(contractID string, packageID s // This method uses the package name in the template ID func (t LockReleaseTokenPool) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -1393,7 +1397,7 @@ func (t LockReleaseTokenPool) MCMSReceiverEntrypoint(contractID string, args api // MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name func (t LockReleaseTokenPool) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "MCMSReceiver"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "MCMSReceiver"), ContractID: contractID, Choice: "MCMSReceiver_Entrypoint", Arguments: argsToMap(args), @@ -1404,7 +1408,7 @@ func (t LockReleaseTokenPool) MCMSReceiverEntrypointWithPackageID(contractID str // This method uses the package name in the template ID func (t LockReleaseTokenPool) TokenPoolGetRequiredCCVs(contractID string, args extensionapi.TokenPoolGetRequiredCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_GetRequiredCCVs", Arguments: argsToMap(args), @@ -1414,7 +1418,7 @@ func (t LockReleaseTokenPool) TokenPoolGetRequiredCCVs(contractID string, args e // TokenPoolGetRequiredCCVsWithPackageID exercises the TokenPool_GetRequiredCCVs choice using the provided package ID instead of package name func (t LockReleaseTokenPool) TokenPoolGetRequiredCCVsWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolGetRequiredCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_GetRequiredCCVs", Arguments: argsToMap(args), @@ -1425,7 +1429,7 @@ func (t LockReleaseTokenPool) TokenPoolGetRequiredCCVsWithPackageID(contractID s // This method uses the package name in the template ID func (t LockReleaseTokenPool) TokenPoolVerifyInboundMessage(contractID string, args extensionapi.TokenPoolVerifyInboundMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_VerifyInboundMessage", Arguments: argsToMap(args), @@ -1435,7 +1439,7 @@ func (t LockReleaseTokenPool) TokenPoolVerifyInboundMessage(contractID string, a // TokenPoolVerifyInboundMessageWithPackageID exercises the TokenPool_VerifyInboundMessage choice using the provided package ID instead of package name func (t LockReleaseTokenPool) TokenPoolVerifyInboundMessageWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolVerifyInboundMessage) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_VerifyInboundMessage", Arguments: argsToMap(args), @@ -1446,7 +1450,7 @@ func (t LockReleaseTokenPool) TokenPoolVerifyInboundMessageWithPackageID(contrac // This method uses the package name in the template ID func (t LockReleaseTokenPool) TokenPoolVerifyOutboundCCVs(contractID string, args extensionapi.TokenPoolVerifyOutboundCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_VerifyOutboundCCVs", Arguments: argsToMap(args), @@ -1456,7 +1460,7 @@ func (t LockReleaseTokenPool) TokenPoolVerifyOutboundCCVs(contractID string, arg // TokenPoolVerifyOutboundCCVsWithPackageID exercises the TokenPool_VerifyOutboundCCVs choice using the provided package ID instead of package name func (t LockReleaseTokenPool) TokenPoolVerifyOutboundCCVsWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolVerifyOutboundCCVs) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_VerifyOutboundCCVs", Arguments: argsToMap(args), @@ -1467,7 +1471,7 @@ func (t LockReleaseTokenPool) TokenPoolVerifyOutboundCCVsWithPackageID(contractI // This method uses the package name in the template ID func (t LockReleaseTokenPool) TokenPoolReleaseFromTicket(contractID string, args extensionapi.TokenPoolReleaseFromTicket) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_ReleaseFromTicket", Arguments: argsToMap(args), @@ -1477,7 +1481,7 @@ func (t LockReleaseTokenPool) TokenPoolReleaseFromTicket(contractID string, args // TokenPoolReleaseFromTicketWithPackageID exercises the TokenPool_ReleaseFromTicket choice using the provided package ID instead of package name func (t LockReleaseTokenPool) TokenPoolReleaseFromTicketWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolReleaseFromTicket) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_ReleaseFromTicket", Arguments: argsToMap(args), @@ -1488,7 +1492,7 @@ func (t LockReleaseTokenPool) TokenPoolReleaseFromTicketWithPackageID(contractID // This method uses the package name in the template ID func (t LockReleaseTokenPool) TokenPoolLockOrBurn(contractID string, args extensionapi.TokenPoolLockOrBurn) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_LockOrBurn", Arguments: argsToMap(args), @@ -1498,7 +1502,7 @@ func (t LockReleaseTokenPool) TokenPoolLockOrBurn(contractID string, args extens // TokenPoolLockOrBurnWithPackageID exercises the TokenPool_LockOrBurn choice using the provided package ID instead of package name func (t LockReleaseTokenPool) TokenPoolLockOrBurnWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolLockOrBurn) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_LockOrBurn", Arguments: argsToMap(args), @@ -1509,7 +1513,7 @@ func (t LockReleaseTokenPool) TokenPoolLockOrBurnWithPackageID(contractID string // This method uses the package name in the template ID func (t LockReleaseTokenPool) TokenPoolCalculateFee(contractID string, args extensionapi.TokenPoolCalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_CalculateFee", Arguments: argsToMap(args), @@ -1519,7 +1523,7 @@ func (t LockReleaseTokenPool) TokenPoolCalculateFee(contractID string, args exte // TokenPoolCalculateFeeWithPackageID exercises the TokenPool_CalculateFee choice using the provided package ID instead of package name func (t LockReleaseTokenPool) TokenPoolCalculateFeeWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolCalculateFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_CalculateFee", Arguments: argsToMap(args), @@ -1530,7 +1534,7 @@ func (t LockReleaseTokenPool) TokenPoolCalculateFeeWithPackageID(contractID stri // This method uses the package name in the template ID func (t LockReleaseTokenPool) TokenPoolGetFee(contractID string, args extensionapi.TokenPoolGetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_GetFee", Arguments: argsToMap(args), @@ -1540,7 +1544,7 @@ func (t LockReleaseTokenPool) TokenPoolGetFee(contractID string, args extensiona // TokenPoolGetFeeWithPackageID exercises the TokenPool_GetFee choice using the provided package ID instead of package name func (t LockReleaseTokenPool) TokenPoolGetFeeWithPackageID(contractID string, packageID string, args extensionapi.TokenPoolGetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ - TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPool", "ITokenPool"), + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.LockReleaseTokenPoolV1", "ITokenPool"), ContractID: contractID, Choice: "TokenPool_GetFee", Arguments: argsToMap(args), @@ -1645,8 +1649,8 @@ type ReleaseFromTicket struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` RmnRemoteCid types.CONTRACT_ID `json:"rmnRemoteCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` TokenReceiveTicketCid types.CONTRACT_ID `json:"tokenReceiveTicketCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -1660,10 +1664,10 @@ func (t ReleaseFromTicket) ToMap() map[string]any { m["rmnRemoteCid"] = model.NestedToDAMLValue(t.RmnRemoteCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["tokenReceiveTicketCid"] = model.NestedToDAMLValue(t.TokenReceiveTicketCid) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -1694,7 +1698,7 @@ func (t *ReleaseFromTicket) UnmarshalHex(data string) error { // ReleaseFromTicketMCMSParams is ReleaseFromTicket without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type ReleaseFromTicketMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes ReleaseFromTicketMCMSParams to hex string for MCMS operationData. @@ -1715,7 +1719,7 @@ type RemoteChainConfig struct { RemoteTokenAddress types.TEXT `json:"remoteTokenAddress" hex:"bytes"` InboundCCVs []chainlinkapi.RawInstanceAddress `json:"inboundCCVs"` OutboundCCVs []chainlinkapi.RawInstanceAddress `json:"outboundCCVs"` - FinalityConfig core.FinalityConfig `json:"finalityConfig"` + FinalityConfig ccipcodec.FinalityConfig `json:"finalityConfig"` InboundRateLimiter chainlinkapi.RawInstanceAddress `json:"inboundRateLimiter"` InboundCustomBlockConfirmationsRateLimiter chainlinkapi.RawInstanceAddress `json:"inboundCustomBlockConfirmationsRateLimiter"` OutboundRateLimiter chainlinkapi.RawInstanceAddress `json:"outboundRateLimiter"` @@ -2220,8 +2224,8 @@ func (t *SetTransferTimeoutParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// TokenTransferFeeConfig2 is a Record type -type TokenTransferFeeConfig2 struct { +// TokenTransferFeeConfig is a Record type +type TokenTransferFeeConfig struct { IsEnabled types.BOOL `json:"isEnabled"` DestGasOverhead types.INT64 `json:"destGasOverhead"` DestBytesOverhead types.INT64 `json:"destBytesOverhead"` @@ -2229,8 +2233,8 @@ type TokenTransferFeeConfig2 struct { FeeBps types.NUMERIC `json:"feeBps"` } -// ToMap converts TokenTransferFeeConfig2 to a map for DAML arguments -func (t TokenTransferFeeConfig2) ToMap() map[string]any { +// ToMap converts TokenTransferFeeConfig to a map for DAML arguments +func (t TokenTransferFeeConfig) ToMap() map[string]any { m := make(map[string]any) m["isEnabled"] = bool(t.IsEnabled) @@ -2246,24 +2250,24 @@ func (t TokenTransferFeeConfig2) ToMap() map[string]any { return m } -func (t TokenTransferFeeConfig2) MarshalJSON() ([]byte, error) { +func (t TokenTransferFeeConfig) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *TokenTransferFeeConfig2) UnmarshalJSON(data []byte) error { +func (t *TokenTransferFeeConfig) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes TokenTransferFeeConfig2 to hex string (Canton MCMS format) -func (t TokenTransferFeeConfig2) MarshalHex() (string, error) { +// MarshalHex encodes TokenTransferFeeConfig to hex string (Canton MCMS format) +func (t TokenTransferFeeConfig) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes TokenTransferFeeConfig2 from hex string (Canton MCMS format) -func (t *TokenTransferFeeConfig2) UnmarshalHex(data string) error { +// UnmarshalHex decodes TokenTransferFeeConfig from hex string (Canton MCMS format) +func (t *TokenTransferFeeConfig) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -2379,28 +2383,12 @@ func (v TransferTimeout) GetVariantValue() any { var _ types.VARIANT = (*TransferTimeout)(nil) -// GetVariantTagByte implements types.VariantWithTagByte interface for MCMS numeric tag encoding -func (v TransferTimeout) GetVariantTagByte() byte { - - if v.Indefinite != nil { - return 0 - } - - if v.RelativeHours != nil { - return 1 - } - - return 0xFF // Invalid/unknown variant -} - -var _ types.VariantWithTagByte = (*TransferTimeout)(nil) - // VerifyInboundMessage is a Record type type VerifyInboundMessage struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -2412,10 +2400,10 @@ func (t VerifyInboundMessage) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -2446,7 +2434,7 @@ func (t *VerifyInboundMessage) UnmarshalHex(data string) error { // VerifyInboundMessageMCMSParams is VerifyInboundMessage without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type VerifyInboundMessageMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes VerifyInboundMessageMCMSParams to hex string for MCMS operationData. @@ -2465,9 +2453,9 @@ func (t *VerifyInboundMessageMCMSParams) UnmarshalHex(data string) error { type VerifyOutboundCCVs struct { TokenAdminRegistryCid types.CONTRACT_ID `json:"tokenAdminRegistryCid"` TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` SendingMessageCid types.CONTRACT_ID `json:"sendingMessageCid"` Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` Caller types.PARTY `json:"caller"` } @@ -2479,12 +2467,12 @@ func (t VerifyOutboundCCVs) ToMap() map[string]any { m["tokenConfigCid"] = model.NestedToDAMLValue(t.TokenConfigCid) - m["extraContext"] = model.NestedToDAMLValue(t.ExtraContext) - m["sendingMessageCid"] = model.NestedToDAMLValue(t.SendingMessageCid) m["amount"] = t.Amount + m["context"] = model.NestedToDAMLValue(t.Context) + m["caller"] = t.Caller.ToMap() return m @@ -2515,8 +2503,8 @@ func (t *VerifyOutboundCCVs) UnmarshalHex(data string) error { // VerifyOutboundCCVsMCMSParams is VerifyOutboundCCVs without the Caller field for MCMS operationData encoding. // ContractId fields are omitted; pass them via the MCMS targetCids map at execution time. type VerifyOutboundCCVsMCMSParams struct { - ExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"extraContext"` - Amount types.NUMERIC `json:"amount"` + Amount types.NUMERIC `json:"amount"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // MarshalHex encodes VerifyOutboundCCVsMCMSParams to hex string for MCMS operationData. diff --git a/bindings/generated/latest/ccip/ratelimiter/ratelimiter.go b/bindings/generated/latest/ccip/ratelimiter/ratelimiter.go new file mode 100644 index 000000000..1a8511968 --- /dev/null +++ b/bindings/generated/latest/ccip/ratelimiter/ratelimiter.go @@ -0,0 +1,547 @@ +package ratelimiter + +import ( + "errors" + "fmt" + "math/big" + "strings" + + api "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/mcms/api" + "github.com/smartcontractkit/go-daml/pkg/bind" + "github.com/smartcontractkit/go-daml/pkg/codec" + "github.com/smartcontractkit/go-daml/pkg/model" + "github.com/smartcontractkit/go-daml/pkg/types" +) + +var ( + _ = fmt.Sprintf + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = model.Command{} + _ bind.BoundTemplate +) + +const ( + PackageName = "ccip-rate-limiter" + PackageID = "cf163092a8c62f4692e9026cb1d4769e158ba507787783938d85b74e16cfe28a" + SDKVersion = "3.4.11" +) + +type Template interface { + CreateCommand() *model.CreateCommand + GetTemplateID() string +} + +const ( + RateLimiterContextKey = types.TEXT("rate-limiter") +) + +func argsToMap(args any) map[string]any { + if args == nil { + return map[string]any{} + } + + if m, ok := args.(map[string]any); ok { + return m + } + + type mapper interface { + ToMap() map[string]any + } + if mapper, ok := args.(mapper); ok { + return mapper.ToMap() + } + + return map[string]any{"args": args} +} + +// ConsumeCapacity is a Record type +type ConsumeCapacity struct { + Requested types.NUMERIC `json:"requested"` +} + +// ToMap converts ConsumeCapacity to a map for DAML arguments +func (t ConsumeCapacity) ToMap() map[string]any { + m := make(map[string]any) + + m["requested"] = t.Requested + + return m +} + +func (t ConsumeCapacity) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ConsumeCapacity) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ConsumeCapacity to hex string (Canton MCMS format) +func (t ConsumeCapacity) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ConsumeCapacity from hex string (Canton MCMS format) +func (t *ConsumeCapacity) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// ConsumeCapacityResult is a Record type +type ConsumeCapacityResult struct { + RateLimiterCid types.CONTRACT_ID `json:"rateLimiterCid"` + AvailableBeforeConsume types.NUMERIC `json:"availableBeforeConsume"` + Consumed types.NUMERIC `json:"consumed"` +} + +// ToMap converts ConsumeCapacityResult to a map for DAML arguments +func (t ConsumeCapacityResult) ToMap() map[string]any { + m := make(map[string]any) + + m["rateLimiterCid"] = model.NestedToDAMLValue(t.RateLimiterCid) + + m["availableBeforeConsume"] = t.AvailableBeforeConsume + + m["consumed"] = t.Consumed + + return m +} + +func (t ConsumeCapacityResult) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *ConsumeCapacityResult) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes ConsumeCapacityResult to hex string (Canton MCMS format) +func (t ConsumeCapacityResult) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes ConsumeCapacityResult from hex string (Canton MCMS format) +func (t *ConsumeCapacityResult) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// RateLimitDirection is an enum type +type RateLimitDirection string + +const ( + RateLimitDirectionRateLimitDirection_Outbound RateLimitDirection = "RateLimitDirection_Outbound" + + RateLimitDirectionRateLimitDirection_Inbound RateLimitDirection = "RateLimitDirection_Inbound" +) + +func (e RateLimitDirection) GetEnumConstructor() string { return string(e) } + +func (e RateLimitDirection) GetEnumTypeID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiterV1", "RateLimitDirection") +} + +// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name +func (e RateLimitDirection) GetEnumTypeIDWithPackageID(packageID string) string { + return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiterV1", "RateLimitDirection") +} + +func (e RateLimitDirection) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(e) +} + +func (e *RateLimitDirection) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, e) +} + +// MarshalHex encodes RateLimitDirection to hex string (Canton MCMS format) +func (e RateLimitDirection) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(e) +} + +// UnmarshalHex decodes RateLimitDirection from hex string (Canton MCMS format) +func (e *RateLimitDirection) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, e) +} + +var _ types.ENUM = RateLimitDirection("") + +// RateLimitMode is an enum type +type RateLimitMode string + +const ( + RateLimitModeRateLimitMode_DefaultFinality RateLimitMode = "RateLimitMode_DefaultFinality" + + RateLimitModeRateLimitMode_CustomFinality RateLimitMode = "RateLimitMode_CustomFinality" +) + +func (e RateLimitMode) GetEnumConstructor() string { return string(e) } + +func (e RateLimitMode) GetEnumTypeID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiterV1", "RateLimitMode") +} + +// GetEnumTypeIDWithPackageID returns the enum type ID using the provided package ID instead of package name +func (e RateLimitMode) GetEnumTypeIDWithPackageID(packageID string) string { + return fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiterV1", "RateLimitMode") +} + +func (e RateLimitMode) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(e) +} + +func (e *RateLimitMode) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, e) +} + +// MarshalHex encodes RateLimitMode to hex string (Canton MCMS format) +func (e RateLimitMode) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(e) +} + +// UnmarshalHex decodes RateLimitMode from hex string (Canton MCMS format) +func (e *RateLimitMode) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, e) +} + +var _ types.ENUM = RateLimitMode("") + +// RateLimiter is a Template type +type RateLimiter struct { + InstanceId types.TEXT `json:"instanceId"` + PoolInstanceId types.TEXT `json:"poolInstanceId"` + PoolOwner types.PARTY `json:"poolOwner"` + RemoteChainSelector types.NUMERIC `json:"remoteChainSelector"` + Direction RateLimitDirection `json:"direction"` + Mode RateLimitMode `json:"mode"` + IsEnabled types.BOOL `json:"isEnabled"` + Capacity types.NUMERIC `json:"capacity"` + Rate types.NUMERIC `json:"rate"` + Tokens types.NUMERIC `json:"tokens"` + LastUpdated types.TIMESTAMP `json:"lastUpdated"` +} + +// GetTemplateID returns the template ID for this template using the package name +func (t RateLimiter) GetTemplateID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiterV1", "RateLimiter") +} + +// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name +func (t RateLimiter) GetTemplateIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.RateLimiterV1", "RateLimiter") +} + +// CreateCommand returns a CreateCommand for this template using the package name +func (t RateLimiter) CreateCommand() *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["instanceId"] = string(t.InstanceId) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolInstanceId"] = string(t.PoolInstanceId) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolOwner"] = t.PoolOwner.ToMap() + + if t.RemoteChainSelector != "" { + args["remoteChainSelector"] = t.RemoteChainSelector + } + + if t.Direction != "" { + args["direction"] = model.NestedToDAMLValue(t.Direction) + } + + if t.Mode != "" { + args["mode"] = model.NestedToDAMLValue(t.Mode) + } + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["isEnabled"] = bool(t.IsEnabled) + + if t.Capacity != "" { + args["capacity"] = t.Capacity + } + + if t.Rate != "" { + args["rate"] = t.Rate + } + + if t.Tokens != "" { + args["tokens"] = t.Tokens + } + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["lastUpdated"] = t.LastUpdated + + return &model.CreateCommand{ + TemplateID: t.GetTemplateID(), + Arguments: args, + } +} + +// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name +func (t RateLimiter) CreateCommandWithPackageID(packageID string) *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["instanceId"] = string(t.InstanceId) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolInstanceId"] = string(t.PoolInstanceId) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolOwner"] = t.PoolOwner.ToMap() + + if t.RemoteChainSelector != "" { + args["remoteChainSelector"] = t.RemoteChainSelector + } + + if t.Direction != "" { + args["direction"] = model.NestedToDAMLValue(t.Direction) + } + + if t.Mode != "" { + args["mode"] = model.NestedToDAMLValue(t.Mode) + } + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["isEnabled"] = bool(t.IsEnabled) + + if t.Capacity != "" { + args["capacity"] = t.Capacity + } + + if t.Rate != "" { + args["rate"] = t.Rate + } + + if t.Tokens != "" { + args["tokens"] = t.Tokens + } + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["lastUpdated"] = t.LastUpdated + + return &model.CreateCommand{ + TemplateID: t.GetTemplateIDWithPackageID(packageID), + Arguments: args, + } +} + +func (t RateLimiter) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *RateLimiter) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes RateLimiter to hex string (Canton MCMS format) +func (t RateLimiter) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes RateLimiter from hex string (Canton MCMS format) +func (t *RateLimiter) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// Choice methods for RateLimiter + +// ConsumeCapacity exercises the ConsumeCapacity choice on this RateLimiter contract +// This method uses the package name in the template ID +func (t RateLimiter) ConsumeCapacity(contractID string, args ConsumeCapacity) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiterV1", "RateLimiter"), + ContractID: contractID, + Choice: "ConsumeCapacity", + Arguments: argsToMap(args), + } +} + +// ConsumeCapacityWithPackageID exercises the ConsumeCapacity choice using the provided package ID instead of package name +func (t RateLimiter) ConsumeCapacityWithPackageID(contractID string, packageID string, args ConsumeCapacity) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiterV1", "RateLimiter"), + ContractID: contractID, + Choice: "ConsumeCapacity", + Arguments: argsToMap(args), + } +} + +// SetConfig exercises the SetConfig choice on this RateLimiter contract +// This method uses the package name in the template ID +func (t RateLimiter) SetConfig(contractID string, args SetConfig) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiterV1", "RateLimiter"), + ContractID: contractID, + Choice: "SetConfig", + Arguments: argsToMap(args), + } +} + +// SetConfigWithPackageID exercises the SetConfig choice using the provided package ID instead of package name +func (t RateLimiter) SetConfigWithPackageID(contractID string, packageID string, args SetConfig) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiterV1", "RateLimiter"), + ContractID: contractID, + Choice: "SetConfig", + Arguments: argsToMap(args), + } +} + +// Archive exercises the Archive choice on this RateLimiter contract via the IMCMSReceiver interface +// This method uses the package name in the template ID +func (t RateLimiter) Archive(contractID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiterV1", "MCMSReceiver"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name +func (t RateLimiter) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiterV1", "MCMSReceiver"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// MCMSReceiverEntrypoint exercises the MCMSReceiver_Entrypoint choice on this RateLimiter contract via the IMCMSReceiver interface +// This method uses the package name in the template ID +func (t RateLimiter) MCMSReceiverEntrypoint(contractID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.RateLimiterV1", "MCMSReceiver"), + ContractID: contractID, + Choice: "MCMSReceiver_Entrypoint", + Arguments: argsToMap(args), + } +} + +// MCMSReceiverEntrypointWithPackageID exercises the MCMSReceiver_Entrypoint choice using the provided package ID instead of package name +func (t RateLimiter) MCMSReceiverEntrypointWithPackageID(contractID string, packageID string, args api.MCMSReceiverEntrypoint) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.RateLimiterV1", "MCMSReceiver"), + ContractID: contractID, + Choice: "MCMSReceiver_Entrypoint", + Arguments: argsToMap(args), + } +} + +// Verify interface implementations for RateLimiter + +var _ api.IMCMSReceiver = (*RateLimiter)(nil) + +// SetConfig is a Record type +type SetConfig struct { + NewIsEnabled types.BOOL `json:"newIsEnabled"` + NewCapacity types.NUMERIC `json:"newCapacity"` + NewRate types.NUMERIC `json:"newRate"` +} + +// ToMap converts SetConfig to a map for DAML arguments +func (t SetConfig) ToMap() map[string]any { + m := make(map[string]any) + + m["newIsEnabled"] = bool(t.NewIsEnabled) + + m["newCapacity"] = t.NewCapacity + + m["newRate"] = t.NewRate + + return m +} + +func (t SetConfig) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *SetConfig) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes SetConfig to hex string (Canton MCMS format) +func (t SetConfig) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes SetConfig from hex string (Canton MCMS format) +func (t *SetConfig) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// MCMSEncoder interface for typed encoding methods. +// Implemented by Encoder for method-based encoding. +type MCMSEncoder interface { + ConsumeCapacity(args ConsumeCapacity) (*bind.EncodedChoice, error) + SetConfig(args SetConfig) (*bind.EncodedChoice, error) +} + +// encoder provides typed encoding methods for choice parameters (unexported). +// It wraps bind.BoundTemplate to encode parameters to hex-encoded operation data. +type encoder struct { + *bind.BoundTemplate +} + +// Contract wraps template operations with Sui-style API access. +// Use NewContract to create instances, then call Encoder() for encoding methods. +type Contract struct { + enc *encoder +} + +// NewContract creates a Contract with encoder for the given template. +// This provides Sui-style API: contract.Encoder().Method(args) +func NewContract(packageID, moduleName, templateName string) *Contract { + return &Contract{ + enc: &encoder{ + BoundTemplate: bind.NewBoundTemplate(packageID, moduleName, templateName), + }, + } +} + +// Encoder returns the encoder for Sui-style contract.Encoder().Method() usage. +func (c *Contract) Encoder() MCMSEncoder { + return c.enc +} + +// ConsumeCapacity encodes parameters for the ConsumeCapacity choice. +func (e *encoder) ConsumeCapacity(args ConsumeCapacity) (*bind.EncodedChoice, error) { + return e.EncodeChoiceArgs("ConsumeCapacity", args) +} + +// SetConfig encodes parameters for the SetConfig choice. +func (e *encoder) SetConfig(args SetConfig) (*bind.EncodedChoice, error) { + return e.EncodeChoiceArgs("SetConfig", args) +} + +// Verify MCMSEncoder interface implementation +var _ MCMSEncoder = (*encoder)(nil) diff --git a/bindings/generated/latest/ccip/receiver/receiver.go b/bindings/generated/latest/ccip/receiver/receiver.go index f783a2d21..3fc7ed4df 100644 --- a/bindings/generated/latest/ccip/receiver/receiver.go +++ b/bindings/generated/latest/ccip/receiver/receiver.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" extensionapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/extensionapi" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" splice_api_token_metadata_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" @@ -27,7 +27,7 @@ var ( const ( PackageName = "ccip-receiver" - PackageID = "3e02facd4c5b02dad1b4dd07f43339e2437bcce8b5e669660b3c8d72c9355d95" + PackageID = "b41eca10afee68eb7b2cf52cd5e45dde7071a5ba98d28542a601297a00109e9c" SDKVersion = "3.4.11" ) @@ -60,7 +60,7 @@ type CCIPMessageReceived struct { Owner types.PARTY `json:"owner"` Router types.CONTRACT_ID `json:"router"` MessageId types.TEXT `json:"messageId"` - Message core.MessageV1 `json:"message"` + Message ccipcodec.MessageV1 `json:"message"` TokenReleaseResult *extensionapi.ReleaseOrMintResult `json:"tokenReleaseResult" hex:"optional"` } @@ -194,7 +194,7 @@ type CCIPReceiver struct { RequiredCCVs []chainlinkapi.RawInstanceAddress `json:"requiredCCVs"` OptionalCCVs []chainlinkapi.RawInstanceAddress `json:"optionalCCVs"` OptionalThreshold types.INT64 `json:"optionalThreshold"` - ReceiverFinalityConfig core.FinalityConfig `json:"receiverFinalityConfig"` + ReceiverFinalityConfig ccipcodec.FinalityConfig `json:"receiverFinalityConfig"` } // GetTemplateID returns the template ID for this template using the package name @@ -399,7 +399,7 @@ func (t CCIPReceiver) UpdateRequiredCCVsWithPackageID(contractID string, package type CCVInput struct { CcvCid types.CONTRACT_ID `json:"ccvCid"` VerifierResults types.TEXT `json:"verifierResults"` - CcvExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"ccvExtraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts CCVInput to a map for DAML arguments @@ -410,7 +410,7 @@ func (t CCVInput) ToMap() map[string]any { m["verifierResults"] = string(t.VerifierResults) - m["ccvExtraContext"] = model.NestedToDAMLValue(t.CcvExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) return m } @@ -439,19 +439,17 @@ func (t *CCVInput) UnmarshalHex(data string) error { // Execute is a Record type type Execute struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` RouterCid types.CONTRACT_ID `json:"routerCid"` EncodedMessage types.TEXT `json:"encodedMessage"` TokenTransfer *TokenTransferInput `json:"tokenTransfer" hex:"optional"` CcvInputs []CCVInput `json:"ccvInputs"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts Execute to a map for DAML arguments func (t Execute) ToMap() map[string]any { m := make(map[string]any) - m["context"] = model.NestedToDAMLValue(t.Context) - m["routerCid"] = model.NestedToDAMLValue(t.RouterCid) m["encodedMessage"] = string(t.EncodedMessage) @@ -476,6 +474,8 @@ func (t Execute) ToMap() map[string]any { return res }() + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -503,18 +503,16 @@ func (t *Execute) UnmarshalHex(data string) error { // GetRequiredCCVs is a Record type type GetRequiredCCVs struct { - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` RouterCid types.CONTRACT_ID `json:"routerCid"` EncodedMessage types.TEXT `json:"encodedMessage"` TokenPoolCid *types.CONTRACT_ID `json:"tokenPoolCid" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts GetRequiredCCVs to a map for DAML arguments func (t GetRequiredCCVs) ToMap() map[string]any { m := make(map[string]any) - m["context"] = model.NestedToDAMLValue(t.Context) - m["routerCid"] = model.NestedToDAMLValue(t.RouterCid) m["encodedMessage"] = string(t.EncodedMessage) @@ -531,6 +529,8 @@ func (t GetRequiredCCVs) ToMap() map[string]any { } } + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -560,7 +560,7 @@ func (t *GetRequiredCCVs) UnmarshalHex(data string) error { type TokenTransferInput struct { TokenPoolCid types.CONTRACT_ID `json:"tokenPoolCid"` TokenReceiverParty types.PARTY `json:"tokenReceiverParty"` - PoolExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"poolExtraContext"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts TokenTransferInput to a map for DAML arguments @@ -571,7 +571,7 @@ func (t TokenTransferInput) ToMap() map[string]any { m["tokenReceiverParty"] = t.TokenReceiverParty.ToMap() - m["poolExtraContext"] = model.NestedToDAMLValue(t.PoolExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) return m } diff --git a/bindings/generated/latest/ccip/sender/sender.go b/bindings/generated/latest/ccip/sender/sender.go index d08a55612..4fd0d503b 100644 --- a/bindings/generated/latest/ccip/sender/sender.go +++ b/bindings/generated/latest/ccip/sender/sender.go @@ -6,7 +6,7 @@ import ( "math/big" "strings" - core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + clientapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/clientapi" chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" splice_api_token_metadata_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" "github.com/smartcontractkit/go-daml/pkg/bind" @@ -26,7 +26,7 @@ var ( const ( PackageName = "ccip-sender" - PackageID = "5783dfc7c23e899cdc6446dfdf113815bb2e029dffba0055139757253068350b" + PackageID = "351b22ee942526605d5047cc300de9390bcbe70cdcbfd77a005d14ec5e7d3ca7" SDKVersion = "3.4.11" ) @@ -149,7 +149,7 @@ func (t CCIPSender) SendWithPackageID(contractID string, packageID string, args // GetFee exercises the GetFee choice on this CCIPSender contract // This method uses the package name in the template ID -func (t CCIPSender) GetFee(contractID string, args GetFee2) *model.ExerciseCommand { +func (t CCIPSender) GetFee(contractID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.CCIPSender", "CCIPSender"), ContractID: contractID, @@ -159,7 +159,7 @@ func (t CCIPSender) GetFee(contractID string, args GetFee2) *model.ExerciseComma } // GetFeeWithPackageID exercises the GetFee choice using the provided package ID instead of package name -func (t CCIPSender) GetFeeWithPackageID(contractID string, packageID string, args GetFee2) *model.ExerciseCommand { +func (t CCIPSender) GetFeeWithPackageID(contractID string, packageID string, args GetFee) *model.ExerciseCommand { return &model.ExerciseCommand{ TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.CCIPSender", "CCIPSender"), ContractID: contractID, @@ -212,9 +212,9 @@ func (t CCIPSender) GetRequiredCCVsWithPackageID(contractID string, packageID st // CCVSendInput is a Record type type CCVSendInput struct { - CcvAddress chainlinkapi.RawInstanceAddress `json:"ccvAddress"` - CcvCid types.CONTRACT_ID `json:"ccvCid"` - CcvExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"ccvExtraContext"` + CcvAddress chainlinkapi.RawInstanceAddress `json:"ccvAddress"` + CcvCid types.CONTRACT_ID `json:"ccvCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts CCVSendInput to a map for DAML arguments @@ -225,7 +225,7 @@ func (t CCVSendInput) ToMap() map[string]any { m["ccvCid"] = model.NestedToDAMLValue(t.CcvCid) - m["ccvExtraContext"] = model.NestedToDAMLValue(t.CcvExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) return m } @@ -254,8 +254,8 @@ func (t *CCVSendInput) UnmarshalHex(data string) error { // ExecutorInput is a Record type type ExecutorInput struct { - ExecutorCid types.CONTRACT_ID `json:"executorCid"` - ExecutorExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"executorExtraContext"` + ExecutorCid types.CONTRACT_ID `json:"executorCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts ExecutorInput to a map for DAML arguments @@ -264,7 +264,7 @@ func (t ExecutorInput) ToMap() map[string]any { m["executorCid"] = model.NestedToDAMLValue(t.ExecutorCid) - m["executorExtraContext"] = model.NestedToDAMLValue(t.ExecutorExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) return m } @@ -342,27 +342,25 @@ func (t *FeeTokenInput) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// GetFee2 is a Record type -type GetFee2 struct { +// GetFee is a Record type +type GetFee struct { DestinationChainSelector types.NUMERIC `json:"destinationChainSelector"` - Message core.Canton2AnyMessage `json:"message"` - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Message clientapi.Canton2AnyMessage `json:"message"` RouterCid types.CONTRACT_ID `json:"routerCid"` CcvSendInputs []CCVSendInput `json:"ccvSendInputs"` TokenTransferInput *TokenTransferInput `json:"tokenTransferInput" hex:"optional"` ExecutorInput *ExecutorInput `json:"executorInput" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } -// ToMap converts GetFee2 to a map for DAML arguments -func (t GetFee2) ToMap() map[string]any { +// ToMap converts GetFee to a map for DAML arguments +func (t GetFee) ToMap() map[string]any { m := make(map[string]any) m["destinationChainSelector"] = t.DestinationChainSelector m["message"] = model.NestedToDAMLValue(t.Message) - m["context"] = model.NestedToDAMLValue(t.Context) - m["routerCid"] = model.NestedToDAMLValue(t.RouterCid) m["ccvSendInputs"] = func() []any { @@ -397,39 +395,41 @@ func (t GetFee2) ToMap() map[string]any { } } + m["context"] = model.NestedToDAMLValue(t.Context) + return m } -func (t GetFee2) MarshalJSON() ([]byte, error) { +func (t GetFee) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *GetFee2) UnmarshalJSON(data []byte) error { +func (t *GetFee) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes GetFee2 to hex string (Canton MCMS format) -func (t GetFee2) MarshalHex() (string, error) { +// MarshalHex encodes GetFee to hex string (Canton MCMS format) +func (t GetFee) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes GetFee2 from hex string (Canton MCMS format) -func (t *GetFee2) UnmarshalHex(data string) error { +// UnmarshalHex decodes GetFee from hex string (Canton MCMS format) +func (t *GetFee) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } -// GetFeeResult is a Record type -type GetFeeResult struct { +// GetFeeResult2 is a Record type +type GetFeeResult2 struct { FeeTokenAmount types.NUMERIC `json:"feeTokenAmount"` PoolFeeTokenAmount types.NUMERIC `json:"poolFeeTokenAmount"` } -// ToMap converts GetFeeResult to a map for DAML arguments -func (t GetFeeResult) ToMap() map[string]any { +// ToMap converts GetFeeResult2 to a map for DAML arguments +func (t GetFeeResult2) ToMap() map[string]any { m := make(map[string]any) m["feeTokenAmount"] = t.FeeTokenAmount @@ -439,24 +439,24 @@ func (t GetFeeResult) ToMap() map[string]any { return m } -func (t GetFeeResult) MarshalJSON() ([]byte, error) { +func (t GetFeeResult2) MarshalJSON() ([]byte, error) { jsonCodec := codec.NewJsonCodec() return jsonCodec.Marshal(t) } -func (t *GetFeeResult) UnmarshalJSON(data []byte) error { +func (t *GetFeeResult2) UnmarshalJSON(data []byte) error { jsonCodec := codec.NewJsonCodec() return jsonCodec.Unmarshal(data, t) } -// MarshalHex encodes GetFeeResult to hex string (Canton MCMS format) -func (t GetFeeResult) MarshalHex() (string, error) { +// MarshalHex encodes GetFeeResult2 to hex string (Canton MCMS format) +func (t GetFeeResult2) MarshalHex() (string, error) { hexCodec := codec.NewHexCodec() return hexCodec.Marshal(t) } -// UnmarshalHex decodes GetFeeResult from hex string (Canton MCMS format) -func (t *GetFeeResult) UnmarshalHex(data string) error { +// UnmarshalHex decodes GetFeeResult2 from hex string (Canton MCMS format) +func (t *GetFeeResult2) UnmarshalHex(data string) error { hexCodec := codec.NewHexCodec() return hexCodec.Unmarshal(data, t) } @@ -464,10 +464,10 @@ func (t *GetFeeResult) UnmarshalHex(data string) error { // GetRequiredCCVs is a Record type type GetRequiredCCVs struct { DestinationChainSelector types.NUMERIC `json:"destinationChainSelector"` - Message core.Canton2AnyMessage `json:"message"` - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Message clientapi.Canton2AnyMessage `json:"message"` RouterCid types.CONTRACT_ID `json:"routerCid"` TokenPoolCid *types.CONTRACT_ID `json:"tokenPoolCid" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts GetRequiredCCVs to a map for DAML arguments @@ -478,8 +478,6 @@ func (t GetRequiredCCVs) ToMap() map[string]any { m["message"] = model.NestedToDAMLValue(t.Message) - m["context"] = model.NestedToDAMLValue(t.Context) - m["routerCid"] = model.NestedToDAMLValue(t.RouterCid) if t.TokenPoolCid != nil { @@ -494,6 +492,8 @@ func (t GetRequiredCCVs) ToMap() map[string]any { } } + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -522,13 +522,13 @@ func (t *GetRequiredCCVs) UnmarshalHex(data string) error { // Send is a Record type type Send struct { DestinationChainSelector types.NUMERIC `json:"destinationChainSelector"` - Message core.Canton2AnyMessage `json:"message"` - Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + Message clientapi.Canton2AnyMessage `json:"message"` RouterCid types.CONTRACT_ID `json:"routerCid"` FeeTokenInput FeeTokenInput `json:"feeTokenInput"` CcvSendInputs []CCVSendInput `json:"ccvSendInputs"` TokenTransferInput *TokenTransferInput `json:"tokenTransferInput" hex:"optional"` ExecutorInput *ExecutorInput `json:"executorInput" hex:"optional"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts Send to a map for DAML arguments @@ -539,8 +539,6 @@ func (t Send) ToMap() map[string]any { m["message"] = model.NestedToDAMLValue(t.Message) - m["context"] = model.NestedToDAMLValue(t.Context) - m["routerCid"] = model.NestedToDAMLValue(t.RouterCid) m["feeTokenInput"] = model.NestedToDAMLValue(t.FeeTokenInput) @@ -577,6 +575,8 @@ func (t Send) ToMap() map[string]any { } } + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -604,9 +604,9 @@ func (t *Send) UnmarshalHex(data string) error { // TokenTransferInput is a Record type type TokenTransferInput struct { - SenderInputCids []types.CONTRACT_ID `json:"senderInputCids"` - TokenPoolCid types.CONTRACT_ID `json:"tokenPoolCid"` - PoolExtraContext splice_api_token_metadata_v1.ChoiceContext `json:"poolExtraContext"` + SenderInputCids []types.CONTRACT_ID `json:"senderInputCids"` + TokenPoolCid types.CONTRACT_ID `json:"tokenPoolCid"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } // ToMap converts TokenTransferInput to a map for DAML arguments @@ -623,7 +623,7 @@ func (t TokenTransferInput) ToMap() map[string]any { m["tokenPoolCid"] = model.NestedToDAMLValue(t.TokenPoolCid) - m["poolExtraContext"] = model.NestedToDAMLValue(t.PoolExtraContext) + m["context"] = model.NestedToDAMLValue(t.Context) return m } @@ -653,7 +653,7 @@ func (t *TokenTransferInput) UnmarshalHex(data string) error { // MCMSEncoder interface for typed encoding methods. // Implemented by Encoder for method-based encoding. type MCMSEncoder interface { - GetFee(args GetFee2) (*bind.EncodedChoice, error) + GetFee(args GetFee) (*bind.EncodedChoice, error) GetRequiredCCVs(args GetRequiredCCVs) (*bind.EncodedChoice, error) Send(args Send) (*bind.EncodedChoice, error) } @@ -686,7 +686,7 @@ func (c *Contract) Encoder() MCMSEncoder { } // GetFee encodes parameters for the GetFee choice. -func (e *encoder) GetFee(args GetFee2) (*bind.EncodedChoice, error) { +func (e *encoder) GetFee(args GetFee) (*bind.EncodedChoice, error) { return e.EncodeChoiceArgs("GetFee", args) } diff --git a/bindings/generated/latest/ccip/tickets/tickets.go b/bindings/generated/latest/ccip/tickets/tickets.go new file mode 100644 index 000000000..2823a3739 --- /dev/null +++ b/bindings/generated/latest/ccip/tickets/tickets.go @@ -0,0 +1,378 @@ +package tickets + +import ( + "errors" + "fmt" + "math/big" + "strings" + + ccipapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipapi" + ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" + chainlinkapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" + splice_api_token_holding_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" + splice_api_token_metadata_v1 "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" + "github.com/smartcontractkit/go-daml/pkg/bind" + "github.com/smartcontractkit/go-daml/pkg/codec" + "github.com/smartcontractkit/go-daml/pkg/model" + "github.com/smartcontractkit/go-daml/pkg/types" +) + +var ( + _ = fmt.Sprintf + _ = errors.New + _ = big.NewInt + _ = strings.NewReader + _ = model.Command{} + _ bind.BoundTemplate +) + +const ( + PackageName = "ccip-tickets" + PackageID = "f3de2e6d1e0f662a0ecd957ec9d3d9cb249e2ba86e7e6794822482be2a070c46" + SDKVersion = "3.4.11" +) + +type Template interface { + CreateCommand() *model.CreateCommand + GetTemplateID() string +} + +func argsToMap(args any) map[string]any { + if args == nil { + return map[string]any{} + } + + if m, ok := args.(map[string]any); ok { + return m + } + + type mapper interface { + ToMap() map[string]any + } + if mapper, ok := args.(mapper); ok { + return mapper.ToMap() + } + + return map[string]any{"args": args} +} + +// Consume2 is a Record type +type Consume2 struct { +} + +// ToMap converts Consume2 to a map for DAML arguments +func (t Consume2) ToMap() map[string]any { + m := make(map[string]any) + return m +} + +func (t Consume2) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *Consume2) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes Consume2 to hex string (Canton MCMS format) +func (t Consume2) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes Consume2 from hex string (Canton MCMS format) +func (t *Consume2) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// TokenReceiveTicket is a Template type +type TokenReceiveTicket struct { + CcipOwner types.PARTY `json:"ccipOwner"` + CcvOwners []types.PARTY `json:"ccvOwners"` + VerifiedCCVs []chainlinkapi.RawInstanceAddress `json:"verifiedCCVs"` + RequiredInboundPoolCCVs []chainlinkapi.RawInstanceAddress `json:"requiredInboundPoolCCVs"` + TokenAdminRegistryInstanceId types.TEXT `json:"tokenAdminRegistryInstanceId"` + PoolAddress chainlinkapi.RawInstanceAddress `json:"poolAddress"` + PoolOwner types.PARTY `json:"poolOwner"` + Receiver types.PARTY `json:"receiver"` + TokenReceiver types.PARTY `json:"tokenReceiver"` + InstrumentId splice_api_token_holding_v1.InstrumentId `json:"instrumentId"` + Amount types.TEXT `json:"amount"` + SourcePoolData types.TEXT `json:"sourcePoolData"` + MessageId types.TEXT `json:"messageId"` + SourceChainSelector types.NUMERIC `json:"sourceChainSelector"` + Finality ccipcodec.FinalityConfig `json:"finality"` + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` +} + +// GetTemplateID returns the template ID for this template using the package name +func (t TokenReceiveTicket) GetTemplateID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TicketsV1", "TokenReceiveTicket") +} + +// GetTemplateIDWithPackageID returns the template ID using the provided package ID instead of package name +func (t TokenReceiveTicket) GetTemplateIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.TicketsV1", "TokenReceiveTicket") +} + +// CreateCommand returns a CreateCommand for this template using the package name +func (t TokenReceiveTicket) CreateCommand() *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccipOwner"] = t.CcipOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["verifiedCCVs"] = func() []any { + res := make([]any, 0, len(t.VerifiedCCVs)) + for _, e := range t.VerifiedCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["requiredInboundPoolCCVs"] = func() []any { + res := make([]any, 0, len(t.RequiredInboundPoolCCVs)) + for _, e := range t.RequiredInboundPoolCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["tokenAdminRegistryInstanceId"] = string(t.TokenAdminRegistryInstanceId) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolAddress"] = model.NestedToDAMLValue(t.PoolAddress) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolOwner"] = t.PoolOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["receiver"] = t.Receiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["tokenReceiver"] = t.TokenReceiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["amount"] = string(t.Amount) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["sourcePoolData"] = string(t.SourcePoolData) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["messageId"] = string(t.MessageId) + + if t.SourceChainSelector != "" { + args["sourceChainSelector"] = t.SourceChainSelector + } + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["finality"] = model.NestedToDAMLValue(t.Finality) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["context"] = model.NestedToDAMLValue(t.Context) + + return &model.CreateCommand{ + TemplateID: t.GetTemplateID(), + Arguments: args, + } +} + +// CreateCommandWithPackageID returns a CreateCommand using the provided package ID instead of package name +func (t TokenReceiveTicket) CreateCommandWithPackageID(packageID string) *model.CreateCommand { + args := make(map[string]any) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccipOwner"] = t.CcipOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["ccvOwners"] = func() []any { + res := make([]any, 0, len(t.CcvOwners)) + for _, e := range t.CcvOwners { + res = append(res, e.ToMap()) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["verifiedCCVs"] = func() []any { + res := make([]any, 0, len(t.VerifiedCCVs)) + for _, e := range t.VerifiedCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["requiredInboundPoolCCVs"] = func() []any { + res := make([]any, 0, len(t.RequiredInboundPoolCCVs)) + for _, e := range t.RequiredInboundPoolCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["tokenAdminRegistryInstanceId"] = string(t.TokenAdminRegistryInstanceId) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolAddress"] = model.NestedToDAMLValue(t.PoolAddress) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["poolOwner"] = t.PoolOwner.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["receiver"] = t.Receiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["tokenReceiver"] = t.TokenReceiver.ToMap() + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["instrumentId"] = model.NestedToDAMLValue(t.InstrumentId) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["amount"] = string(t.Amount) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["sourcePoolData"] = string(t.SourcePoolData) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["messageId"] = string(t.MessageId) + + if t.SourceChainSelector != "" { + args["sourceChainSelector"] = t.SourceChainSelector + } + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["finality"] = model.NestedToDAMLValue(t.Finality) + + // IMPORTANT: always include non-optional fields (GENMAP/MAP/LIST/[] etc), even if empty + args["context"] = model.NestedToDAMLValue(t.Context) + + return &model.CreateCommand{ + TemplateID: t.GetTemplateIDWithPackageID(packageID), + Arguments: args, + } +} + +func (t TokenReceiveTicket) MarshalJSON() ([]byte, error) { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Marshal(t) +} + +func (t *TokenReceiveTicket) UnmarshalJSON(data []byte) error { + jsonCodec := codec.NewJsonCodec() + return jsonCodec.Unmarshal(data, t) +} + +// MarshalHex encodes TokenReceiveTicket to hex string (Canton MCMS format) +func (t TokenReceiveTicket) MarshalHex() (string, error) { + hexCodec := codec.NewHexCodec() + return hexCodec.Marshal(t) +} + +// UnmarshalHex decodes TokenReceiveTicket from hex string (Canton MCMS format) +func (t *TokenReceiveTicket) UnmarshalHex(data string) error { + hexCodec := codec.NewHexCodec() + return hexCodec.Unmarshal(data, t) +} + +// Choice methods for TokenReceiveTicket + +// Consume exercises the Consume choice on this TokenReceiveTicket contract via the IITokenReceiveTicket interface +// This method uses the package name in the template ID +func (t TokenReceiveTicket) Consume(contractID string, args ccipapi.Consume) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TicketsV1", "TokenReceiveTicket"), + ContractID: contractID, + Choice: "Consume", + Arguments: argsToMap(args), + } +} + +// ConsumeWithPackageID exercises the Consume choice using the provided package ID instead of package name +func (t TokenReceiveTicket) ConsumeWithPackageID(contractID string, packageID string, args ccipapi.Consume) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TicketsV1", "TokenReceiveTicket"), + ContractID: contractID, + Choice: "Consume", + Arguments: argsToMap(args), + } +} + +// Archive exercises the Archive choice on this TokenReceiveTicket contract via the IITokenReceiveTicket interface +// This method uses the package name in the template ID +func (t TokenReceiveTicket) Archive(contractID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.TicketsV1", "TokenReceiveTicket"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// ArchiveWithPackageID exercises the Archive choice using the provided package ID instead of package name +func (t TokenReceiveTicket) ArchiveWithPackageID(contractID string, packageID string) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.TicketsV1", "TokenReceiveTicket"), + ContractID: contractID, + Choice: "Archive", + Arguments: map[string]any{}, + } +} + +// Verify interface implementations for TokenReceiveTicket + +var _ ccipapi.IITokenReceiveTicket = (*TokenReceiveTicket)(nil) + +// MCMSEncoder interface for typed encoding methods. +// Implemented by Encoder for method-based encoding. +type MCMSEncoder interface { +} + +// encoder provides typed encoding methods for choice parameters (unexported). +// It wraps bind.BoundTemplate to encode parameters to hex-encoded operation data. +type encoder struct { + *bind.BoundTemplate +} + +// Contract wraps template operations with Sui-style API access. +// Use NewContract to create instances, then call Encoder() for encoding methods. +type Contract struct { + enc *encoder +} + +// NewContract creates a Contract with encoder for the given template. +// This provides Sui-style API: contract.Encoder().Method(args) +func NewContract(packageID, moduleName, templateName string) *Contract { + return &Contract{ + enc: &encoder{ + BoundTemplate: bind.NewBoundTemplate(packageID, moduleName, templateName), + }, + } +} + +// Encoder returns the encoder for Sui-style contract.Encoder().Method() usage. +func (c *Contract) Encoder() MCMSEncoder { + return c.enc +} + +// Verify MCMSEncoder interface implementation +var _ MCMSEncoder = (*encoder)(nil) diff --git a/ccip/devenv/env-canton-evm.toml b/ccip/devenv/env-canton-evm.toml index b55256f3a..8d4a1d04f 100644 --- a/ccip/devenv/env-canton-evm.toml +++ b/ccip/devenv/env-canton-evm.toml @@ -163,12 +163,12 @@ execution_interval = 15_000_000_000 [verifier.opaque_configs.canton.reader_configs.8706591216959472610] ccip_owner_party = "participant1-localparty-1" [verifier.opaque_configs.canton.reader_configs.8706591216959472610.ccip_message_sent_template_id] - package_id = "#ccip-core" - module_name = "CCIP.Events" + package_id = "#ccip-events" + module_name = "CCIP.EventsV1.Events" entity_name = "CCIPMessageSent" [verifier.opaque_configs.canton.reader_configs.8706591216959472610.rmn_remote_template_id] package_id = "#ccip-core" - module_name = "CCIP.RMNRemote" + module_name = "CCIP.CoreV1.RMNRemote" entity_name = "RMNRemote" [verifier.opaque_configs.canton.blockchain_infos.8706591216959472610] # These will be filled in by the modifier, which hydrates the config with @@ -197,12 +197,12 @@ execution_interval = 15_000_000_000 [verifier.opaque_configs.canton.reader_configs.8706591216959472610] ccip_owner_party = "participant1-localparty-1" [verifier.opaque_configs.canton.reader_configs.8706591216959472610.ccip_message_sent_template_id] - package_id = "#ccip-core" - module_name = "CCIP.Events" + package_id = "#ccip-events" + module_name = "CCIP.EventsV1.Events" entity_name = "CCIPMessageSent" [verifier.opaque_configs.canton.reader_configs.8706591216959472610.rmn_remote_template_id] package_id = "#ccip-core" - module_name = "CCIP.RMNRemote" + module_name = "CCIP.CoreV1.RMNRemote" entity_name = "RMNRemote" [verifier.opaque_configs.canton.blockchain_infos.8706591216959472610] # These will be filled in by the modifier, which hydrates the config with diff --git a/ccip/devenv/impl.go b/ccip/devenv/impl.go index 612b1abcf..b07929b5b 100644 --- a/ccip/devenv/impl.go +++ b/ccip/devenv/impl.go @@ -45,7 +45,9 @@ import ( "github.com/smartcontractkit/chainlink-canton/bindings" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/clientapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + ccipevents "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" ccipsender "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/sender" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" @@ -83,15 +85,10 @@ var ( errLockReleasePoolNotDeployed = errors.New("lock release token pool not deployed") cantonDeployDarPackages = []contracts.Package{ contracts.CCIPFactory, - contracts.CCIPCommon, + contracts.CCIPRuntime, contracts.CCIPReceiver, - contracts.CCIPOffRamp, - contracts.CCIPOnRamp, - contracts.CCIPTokenAdminRegistry, + contracts.CCIPCore, contracts.CCIPCommitteeVerifier, - contracts.CCIPPerPartyRouter, - contracts.CCIPFeeQuoter, - contracts.CCIPRMN, contracts.CCIPSender, contracts.CCIPExecutor, contracts.CCIPTest, @@ -1266,15 +1263,15 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint sendArgs := ccipsender.Send{ RouterCid: types.CONTRACT_ID(routerCid), DestinationChainSelector: types.NUMERIC(strconv.FormatUint(dest, 10)), - Message: core.Canton2AnyMessage{ + Message: clientapi.Canton2AnyMessage{ Receiver: types.TEXT(hex.EncodeToString(fields.Receiver)), Payload: types.TEXT(hex.EncodeToString(fields.Data)), FeeToken: c.feeTokenInstrument, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: clientapi.ExtraArgs{ + V3: &clientapi.GenericExtraArgsV3{ GasLimit: types.INT64(opts.ExecutionGasLimit), - Executor: core.ExecutorExtraArg{ - ExecutorUseDefault: &core.ExecutorUseDefault{}, + Executor: clientapi.ExecutorExtraArg{ + ExecutorUseDefault: &clientapi.ExecutorUseDefault{}, }, }, }, @@ -1310,7 +1307,7 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint if err != nil { return cciptestinterfaces.MessageSentEvent{}, fmt.Errorf("failed to get Token Pool Send disclosure for token pool at address %s: %w", tokenPoolAddress.String(), err) } - sendArgs.Message.TokenTransfer = &core.TokenTransfer{ + sendArgs.Message.TokenTransfer = &clientapi.TokenTransfer{ Token: splice_api_token_holding_v1.InstrumentId{ Admin: types.PARTY(outgoingMessage.TokenTransfer.Token.Admin), Id: types.TEXT(outgoingMessage.TokenTransfer.Token.Id), @@ -1318,9 +1315,9 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint Amount: types.NUMERIC(outgoingMessage.TokenTransfer.Amount), } sendArgs.TokenTransferInput = &ccipsender.TokenTransferInput{ - SenderInputCids: []types.CONTRACT_ID{types.CONTRACT_ID(c.nextTransferCID)}, - TokenPoolCid: types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId), - PoolExtraContext: tokenPoolSendDisclosure.ChoiceContext, + SenderInputCids: []types.CONTRACT_ID{types.CONTRACT_ID(c.nextTransferCID)}, + TokenPoolCid: types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId), + Context: tokenPoolSendDisclosure.ChoiceContext, } tokenPoolRequiredCCVs = tokenPoolSendDisclosure.RequiredCCVs disclosedContracts = append(disclosedContracts, tokenPoolSendDisclosure.DisclosedContracts...) @@ -1351,11 +1348,11 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint return cciptestinterfaces.MessageSentEvent{}, fmt.Errorf("failed to get CCV Send disclosure for CCV %q: %w", v, err) } sendArgs.CcvSendInputs = append(sendArgs.CcvSendInputs, ccipsender.CCVSendInput{ - CcvAddress: ccvSendDisclosure.Address.Binding(), - CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), - CcvExtraContext: ccvSendDisclosure.ChoiceContext, + CcvAddress: ccvSendDisclosure.Address.Binding(), + CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), + Context: ccvSendDisclosure.ChoiceContext, }) - sendArgs.Message.ExtraArgs.V3.Ccvs = append(sendArgs.Message.ExtraArgs.V3.Ccvs, core.CCVExtraArg{ + sendArgs.Message.ExtraArgs.V3.Ccvs = append(sendArgs.Message.ExtraArgs.V3.Ccvs, clientapi.CCVExtraArg{ CcvAddress: ccvSendDisclosure.Address.Binding(), CcvArgs: "", }) @@ -1377,8 +1374,8 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint return cciptestinterfaces.MessageSentEvent{}, fmt.Errorf("failed to get Executor Send disclosure for Executor %q: %w", *ccipSendDisclosure.Executor, err) } sendArgs.ExecutorInput = &ccipsender.ExecutorInput{ - ExecutorCid: types.CONTRACT_ID(executorSendDisclosure.ContractId), - ExecutorExtraContext: executorSendDisclosure.ChoiceContext, + ExecutorCid: types.CONTRACT_ID(executorSendDisclosure.ContractId), + Context: executorSendDisclosure.ChoiceContext, } disclosedContracts = append(disclosedContracts, executorSendDisclosure.DisclosedContracts...) } @@ -1413,7 +1410,7 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint { IdentifierFilter: &apiv2.CumulativeFilter_TemplateFilter{ TemplateFilter: &apiv2.TemplateFilter{ - TemplateId: contracts.TemplateIDFromBinding(core.CCIPMessageSent{}).ToLedgerIdentifier(), + TemplateId: contracts.TemplateIDFromBinding(ccipevents.CCIPMessageSent{}).ToLedgerIdentifier(), IncludeCreatedEventBlob: true, }, }, @@ -1479,7 +1476,7 @@ type ccipMessageSentFromSendUpdate struct { // before this send; returned seqNo is either previousSeq+1 or the sequence from the encoded payload // when that path is present. func parseFirstCCIPMessageSentFromLedgerEvents(events []*apiv2.Event, previousSeq uint64) (ccipMessageSentFromSendUpdate, error) { - messageSentTemplateID := contracts.TemplateIDFromBinding(core.CCIPMessageSent{}) + messageSentTemplateID := contracts.TemplateIDFromBinding(ccipevents.CCIPMessageSent{}) // Find CCIPMessageSent event in the events var created *apiv2.CreatedEvent @@ -1500,7 +1497,7 @@ func parseFirstCCIPMessageSentFromLedgerEvents(events []*apiv2.Event, previousSe return ccipMessageSentFromSendUpdate{}, fmt.Errorf("no CCIPMessageSent event found in sender transaction") } - parsed, err := bindings.UnmarshalCreatedEvent[core.CCIPMessageSent](created) + parsed, err := bindings.UnmarshalCreatedEvent[ccipevents.CCIPMessageSent](created) if err != nil { return ccipMessageSentFromSendUpdate{}, fmt.Errorf("unmarshal CCIPMessageSent created event: %w", err) } diff --git a/ccip/devenv/manual_execution.go b/ccip/devenv/manual_execution.go index c4947e642..5126be778 100644 --- a/ccip/devenv/manual_execution.go +++ b/ccip/devenv/manual_execution.go @@ -19,8 +19,10 @@ import ( "github.com/smartcontractkit/go-daml/pkg/types" "github.com/smartcontractkit/chainlink-canton/bindings" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipapi" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" ccipreceiver "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/receiver" "github.com/smartcontractkit/chainlink-canton/contracts" "github.com/smartcontractkit/chainlink-canton/deployment/operations/ccip/per_party_router_factory" @@ -196,7 +198,7 @@ func (c *Chain) ManuallyExecuteMessage(ctx context.Context, message protocol.Mes executeArgs.CcvInputs[i] = ccipreceiver.CCVInput{ CcvCid: types.CONTRACT_ID(ccvExecuteDisclosure.ContractId), VerifierResults: types.TEXT(hex.EncodeToString(vr)), - CcvExtraContext: ccvExecuteDisclosure.ChoiceContext, + Context: ccvExecuteDisclosure.ChoiceContext, } disclosedContracts = append(disclosedContracts, ccvExecuteDisclosure.DisclosedContracts...) } @@ -217,7 +219,7 @@ func (c *Chain) ManuallyExecuteMessage(ctx context.Context, message protocol.Mes executeArgs.TokenTransfer = &ccipreceiver.TokenTransferInput{ TokenPoolCid: types.CONTRACT_ID(tokenPoolDisclosure.ContractId), TokenReceiverParty: types.PARTY(executingParty), - PoolExtraContext: tokenPoolDisclosure.ChoiceContext, + Context: tokenPoolDisclosure.ChoiceContext, } disclosedContracts = append(disclosedContracts, tokenPoolDisclosure.DisclosedContracts...) } @@ -291,7 +293,7 @@ func (c *Chain) ManuallyExecuteMessage(ctx context.Context, message protocol.Mes } // Get ExecutionStateChangedEvent from events - expectedTemplateID := core.ExecutionStateChanged{}.GetTemplateID() + expectedTemplateID := events.ExecutionStateChanged{}.GetTemplateID() for _, event := range update.GetTransaction().GetEvents() { //nolint:nestif // need to check if all of these are nil if createdEvent := event.GetCreated(); createdEvent != nil { @@ -317,7 +319,7 @@ func (c *Chain) ManuallyExecuteMessage(ctx context.Context, message protocol.Mes // parseExecutionStateChangedEvent parses a common.ExecutionStateChanged event from a Daml CreatedEvent and converts it to cciptestinterfaces.ExecutionStateChangedEvent. func parseExecutionStateChangedEvent(event *apiv2.CreatedEvent) (cciptestinterfaces.ExecutionStateChangedEvent, error) { - executionStateChanged, err := bindings.UnmarshalCreatedEvent[core.ExecutionStateChanged](event) + executionStateChanged, err := bindings.UnmarshalCreatedEvent[events.ExecutionStateChanged](event) if err != nil { return cciptestinterfaces.ExecutionStateChangedEvent{}, fmt.Errorf("failed to unmarshal ExecutionStateChanged event: %w", err) } @@ -342,13 +344,13 @@ func parseExecutionStateChangedEvent(event *apiv2.CreatedEvent) (cciptestinterfa // Execution state var executionState cciptestinterfaces.MessageExecutionState switch executionStateChanged.Event.State { - case core.MessageExecutionStateUNTOUCHED: + case ccipapi.MessageExecutionStateUNTOUCHED: executionState = cciptestinterfaces.ExecutionStateUntouched - case core.MessageExecutionStateIN_PROGRESS: + case ccipapi.MessageExecutionStateIN_PROGRESS: executionState = cciptestinterfaces.ExecutionStateInProgress - case core.MessageExecutionStateSUCCESS: + case ccipapi.MessageExecutionStateSUCCESS: executionState = cciptestinterfaces.ExecutionStateSuccess - case core.MessageExecutionStateFAILURE: + case ccipapi.MessageExecutionStateFAILURE: executionState = cciptestinterfaces.ExecutionStateFailure default: return cciptestinterfaces.ExecutionStateChangedEvent{}, fmt.Errorf("unknown execution state %q", executionStateChanged.Event.State) @@ -398,7 +400,7 @@ func (c *Chain) findExistingExecutionState( return cciptestinterfaces.ExecutionStateChangedEvent{}, false, fmt.Errorf("findExistingExecutionState: %w", err) } - templateID := contracts.TemplateIDFromBinding(core.ExecutionStateChanged{}).ToLedgerIdentifier() + templateID := contracts.TemplateIDFromBinding(events.ExecutionStateChanged{}).ToLedgerIdentifier() activeContracts, err := testhelpers.ListActiveContractsByTemplateId(ctx, participant, templateID) if err != nil { return cciptestinterfaces.ExecutionStateChangedEvent{}, false, fmt.Errorf("findExistingExecutionState: list active ExecutionStateChanged contracts: %w", err) @@ -477,18 +479,18 @@ func (c *Chain) fetchVerifierResult(ctx context.Context, messageID protocol.Byte }, nil } -func encodeReceiverFinalityConfig(finality int64) (core.FinalityConfig, error) { +func encodeReceiverFinalityConfig(finality int64) (ccipcodec.FinalityConfig, error) { switch { case finality < 0: - return core.FinalityConfig{}, fmt.Errorf("invalid finality %d: must be non-negative", finality) + return ccipcodec.FinalityConfig{}, fmt.Errorf("invalid finality %d: must be non-negative", finality) case finality == 0: - return core.FinalityConfig{WaitForFinality: &types.UNIT{}}, nil + return ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, nil case finality == 0x00010000: - return core.FinalityConfig{WaitForSafe: &types.UNIT{}}, nil + return ccipcodec.FinalityConfig{WaitForSafe: &types.UNIT{}}, nil case finality > 0xFFFF: - return core.FinalityConfig{}, fmt.Errorf("invalid finality %d: max supported block depth is 65535", finality) + return ccipcodec.FinalityConfig{}, fmt.Errorf("invalid finality %d: max supported block depth is 65535", finality) default: - return core.FinalityConfig{BlockDepth: new(types.INT64(finality))}, nil + return ccipcodec.FinalityConfig{BlockDepth: new(types.INT64(finality))}, nil } } diff --git a/ccip/sourcereader/source_reader.go b/ccip/sourcereader/source_reader.go index 1062c9408..465ec2153 100644 --- a/ccip/sourcereader/source_reader.go +++ b/ccip/sourcereader/source_reader.go @@ -21,6 +21,7 @@ import ( "github.com/smartcontractkit/chainlink-canton/bindings" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" "github.com/smartcontractkit/chainlink-canton/contracts" "github.com/smartcontractkit/chainlink-canton/deployment/utils/operations/contract" ) @@ -265,7 +266,7 @@ func processCreatedEvent( return nil, errMetadataMismatch } - parsed, err := bindings.UnmarshalCreatedEvent[core.CCIPMessageSent](created) + parsed, err := bindings.UnmarshalCreatedEvent[events.CCIPMessageSent](created) if err != nil { return nil, fmt.Errorf("failed to unmarshal CCIPMessageSent created event: %w", err) } @@ -291,7 +292,7 @@ func processCreatedEvent( // ccipMessageSentEventToProtocol converts the binding type common.CCIPMessageSentEvent // to protocol.MessageSentEvent (hex decoding, message decode, receipt mapping, validations). -func ccipMessageSentEventToProtocol(evt *core.CCIPMessageSentEvent) (*protocol.MessageSentEvent, error) { +func ccipMessageSentEventToProtocol(evt *events.CCIPMessageSentEvent) (*protocol.MessageSentEvent, error) { messageSentEvent := &protocol.MessageSentEvent{} messageID, err := hex.DecodeString(string(evt.MessageId)) @@ -349,7 +350,7 @@ func ccipMessageSentEventToProtocol(evt *core.CCIPMessageSentEvent) (*protocol.M } // receiptsBindingToProtocol converts binding []common.Receipt to []protocol.ReceiptWithBlob. -func receiptsBindingToProtocol(receipts []core.Receipt) ([]protocol.ReceiptWithBlob, error) { +func receiptsBindingToProtocol(receipts []events.Receipt) ([]protocol.ReceiptWithBlob, error) { protoReceipts := make([]protocol.ReceiptWithBlob, 0, len(receipts)) for i, r := range receipts { decoded, err := protocol.NewUnknownAddressFromHex(string(r.IssuerAddress)) diff --git a/ccip/sourcereader/source_reader_test.go b/ccip/sourcereader/source_reader_test.go index 04725ed52..d0dc22091 100644 --- a/ccip/sourcereader/source_reader_test.go +++ b/ccip/sourcereader/source_reader_test.go @@ -21,6 +21,7 @@ import ( "github.com/smartcontractkit/go-daml/pkg/types" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" "github.com/smartcontractkit/chainlink-canton/contracts" "github.com/smartcontractkit/chainlink-canton/internal/mocks" ) @@ -209,7 +210,7 @@ func TestSourceReader_GetBlocksHeaders(t *testing.T) { func TestReceiptsBindingToProtocol_numericBounds(t *testing.T) { t.Parallel() issuer := protocol.Keccak256([]byte("issuer")) - base := core.Receipt{ + base := events.Receipt{ IssuerAddress: types.TEXT(hex.EncodeToString(issuer[:])), DestGasLimit: 1, DestBytesOverhead: 1, @@ -221,7 +222,7 @@ func TestReceiptsBindingToProtocol_numericBounds(t *testing.T) { t.Parallel() r := base r.DestGasLimit = -1 - _, err := receiptsBindingToProtocol([]core.Receipt{r}) + _, err := receiptsBindingToProtocol([]events.Receipt{r}) require.Error(t, err) require.ErrorContains(t, err, "receipts[0]: dest gas limit must be non-negative") }) @@ -230,7 +231,7 @@ func TestReceiptsBindingToProtocol_numericBounds(t *testing.T) { t.Parallel() r := base r.DestBytesOverhead = -1 - _, err := receiptsBindingToProtocol([]core.Receipt{r}) + _, err := receiptsBindingToProtocol([]events.Receipt{r}) require.Error(t, err) require.ErrorContains(t, err, "receipts[0]: dest bytes overhead must be non-negative") }) @@ -239,7 +240,7 @@ func TestReceiptsBindingToProtocol_numericBounds(t *testing.T) { t.Parallel() r := base r.DestBytesOverhead = math.MaxUint32 + 1 - _, err := receiptsBindingToProtocol([]core.Receipt{r}) + _, err := receiptsBindingToProtocol([]events.Receipt{r}) require.Error(t, err) require.ErrorContains(t, err, "receipts[0]: dest bytes overhead overflows uint32") }) @@ -248,7 +249,7 @@ func TestReceiptsBindingToProtocol_numericBounds(t *testing.T) { t.Parallel() r := base r.DestBytesOverhead = math.MaxUint32 - got, err := receiptsBindingToProtocol([]core.Receipt{r}) + got, err := receiptsBindingToProtocol([]events.Receipt{r}) require.NoError(t, err) require.Len(t, got, 1) require.Equal(t, uint32(math.MaxUint32), got[0].DestBytesOverhead) @@ -896,7 +897,7 @@ func TestSourceReader_FetchMessageSentEvents(t *testing.T) { execIssuer := protocol.Keccak256([]byte("executor")) networkIssuer := protocol.Keccak256([]byte("network")) - bindingReceipts := []core.Receipt{ + bindingReceipts := []events.Receipt{ {IssuerAddress: types.TEXT(hex.EncodeToString(ccvIssuer[:])), DestGasLimit: 100000, DestBytesOverhead: 500, FeeTokenAmount: types.NUMERIC("1000000."), ExtraArgs: types.TEXT(extraArgsHex)}, {IssuerAddress: types.TEXT(hex.EncodeToString(execIssuer[:])), DestGasLimit: 0, DestBytesOverhead: 0, FeeTokenAmount: types.NUMERIC("500000."), ExtraArgs: types.TEXT("")}, {IssuerAddress: types.TEXT(hex.EncodeToString(networkIssuer[:])), DestGasLimit: 0, DestBytesOverhead: 0, FeeTokenAmount: types.NUMERIC("500000."), ExtraArgs: types.TEXT("")}, diff --git a/contracts/README.md b/contracts/README.md index adf22171c..3525a07a2 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -5,9 +5,9 @@ on Canton. ## Contract artifacts & releases -DARs live under `contracts/dars/` (`current/` for dev, `v1_0_0/` etc. for frozen releases). Go bindings live under `bindings/generated/latest/` for all in-repo code; frozen releases snapshot DARs only (not versioned binding trees). +DARs live under `contracts/dars/` (`current/` for dev, `v2_0_0/` etc. for frozen releases). Go bindings live under `bindings/generated/latest/` for all in-repo code; frozen releases snapshot DARs only (not versioned binding trees). -For day-to-day builds (`make contracts`) and **how to cut and migrate to a new release** (e.g. 1.1.0 — freeze, `ReleaseDir`, import updates, git tag), see **[bindings/README.md](../bindings/README.md)**. +For day-to-day builds (`make contracts`) and **how to cut and migrate to a new release** (e.g. 2.1.0 — freeze, update `ReleaseDir`, import paths, and git tag), see **[bindings/README.md](../bindings/README.md)**. ## Overview @@ -22,245 +22,665 @@ messaging** - users receive verified message data and decide how to process it. | Execution model | Arbitrary execution via callbacks | Arbitrary messaging (user processes data) | | Receiver | Contract address | PartyId encoded as bytes | | Message retrieval | Automatic callback | User fetches from off-chain storage | -| State model | Global shared state | Per-party isolated state | +| State model | Global shared state | Per-party isolated state (PerPartyRouter) | | Contract visibility | Public | Explicit disclosure required | +| Risk management | RMN pausing per lane | RMN curse mechanism (global + per-chain) | +| Message execution | Single destination executor | Pluggable Executor interface | ## Architecture +### Layered Design + +CCIP Canton contracts are organized in a modular, layered architecture: + ``` -┌─────────────────────────────────────────────────────────────────────────────┐ -│ CONTRACT ARCHITECTURE │ -├─────────────────────────────────────────────────────────────────────────────┤ -│ │ -│ SHARED CONTRACTS (fetched via explicit disclosure) │ -│ ══════════════════════════════════════════════════ │ -│ │ -│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ -│ │ GlobalConfig │ │ OnRamp │ │ OffRamp │ │ CCVRegistry │ │ -│ │ │ │ │ │ │ │ │ │ -│ │ chain config │ │ send logic │ │ receive logic│ │ ticket issuer│ │ -│ │ lane configs │ │ msg encoding │ │ verification │ │ │ │ -│ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘ │ -│ │ -│ ┌──────────────────────┐ ┌──────────────────────┐ │ -│ │ TokenAdminRegistry │ │ CommitteeVerifier │ │ -│ │ │ │ (CCV) │ │ -│ │ token pool registry │ │ signature validation │ │ -│ │ ticket authority │ │ │ │ -│ └──────────────────────┘ └──────────────────────┘ │ -│ │ -│ PER-PARTY CONTRACTS (user is stakeholder) │ -│ ═════════════════════════════════════════ │ -│ │ -│ ┌────────────────────────────────────────────────────────────────────┐ │ -│ │ PerPartyRouter (one per user) │ │ -│ │ │ │ -│ │ - outboundSequenceNumbers : Map destChain -> seqNum │ │ -│ │ - executionStates : Map messageHash -> state │ │ -│ │ - receiverRequiredCCVs : [CCVId] │ │ -│ └────────────────────────────────────────────────────────────────────┘ │ -│ │ -│ TICKETS (ephemeral, created and consumed during flows) │ -│ ══════════════════════════════════════════════════════ │ -│ │ -│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ -│ │TokenSendTicket│ │ CCVTicket │ │CCVVerifyTicket│ │TokenReceive- │ │ -│ │ │ │ │ │ │ │ Ticket │ │ -│ │ outbound │ │ outbound │ │ inbound │ │ inbound │ │ -│ │ token lock │ │ attestation │ │ verification │ │ token release│ │ -│ └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘ │ -│ │ -└─────────────────────────────────────────────────────────────────────────────┘ + ┌────────────────────────────────────────────────────────────────────────┐ + │ USER TIER (not CCIP-owned) │ + │ - CCIPSender (outbound orchestrator) │ + │ - CCIPReceiver (inbound orchestrator) │ + └────────────────────────────────────────────────────────────────────────┘ + │ ClientV1 interface extension-api interfaces │ + ▼ ▼ +┌─────────────────────────────────────────────────┐ ┌─────────────────────────┐ +│ RUNTIME TIER (runtime) │ │ THIRD-PARTY TIER │ +│ - PerPartyRouter (per-user state & routing) │ │ - Executor │ +│ - OnRamp (outbound message processing) │ │ - CommitteeVerifier │ +│ - OffRamp (inbound message processing) │ │ - Token Pools │ +└─────────────────────────────────────────────────┘ └─────────────────────────┘ + │ direct calls apiv1 interfaces │ + ▼ ▼ + ┌──────────────────────────────────────────────────────────────────────────┐ + │ CORE TIER (core) │ + │ - GlobalConfig (chain & lane configs) │ + │ - TokenAdminRegistry (token & ticket authority) │ + │ - FeeQuoter (fee calculations) │ + │ - RMNRemote (risk management & curse mechanism) │ + │ - SendingMessage, ExecutingMessage (message state) │ + └──────────────────────────────────────────────────────────────────────────┘ ``` +### Contract Categories + +**SHARED CONTRACTS** (fetched via explicit disclosure): +- `GlobalConfig` — chain & lane configuration +- `TokenAdminRegistry` — token pool registry & ticket authority +- `FeeQuoter` — fee calculation engine +- `RMNRemote` — risk management with curse mechanism +- `OnRamp`, `OffRamp` — message sending/receiving logic +- CCVs (e.g., `CommitteeVerifier`) — cross-chain message verifiers +- `Executor` — message execution wrapper for destination chains + +**PER-PARTY CONTRACTS** (user is stakeholder): +- `PerPartyRouter` — isolated state container per user + - `outboundSequenceNumbers` : Map destChain → seqNum + - `executedMessages` : Set messageHash (with archive pattern for scaling) + - `customObservers` : [Party] for optional observers + +**TICKETS** (ephemeral, created and consumed during flows): +- `TokenReceiveTicket` — authorizes token release on inbound + - Factory-created via `TokenAdminRegistry` + ## Package Structure ``` contracts/ccip/ -├── common/ # Shared types and utilities +├── api/ # API interfaces (APIV1) — public contract signatures +│ └── daml/CCIP/APIV1/ +│ ├── GlobalConfig.daml # Configuration interface +│ ├── ExecutingMessage.daml # Inbound message processing +│ ├── SendingMessage.daml # Outbound message processing +│ ├── FeeQuoter.daml # Fee calculation interface +│ ├── RMNRemote.daml # Risk management interface +│ └── TokenAdminRegistry.daml # Token authority interface +├── core/ # Core implementations (CoreV1) +│ └── daml/CCIP/CoreV1/ +│ ├── GlobalConfig.daml # Chain & lane configuration +│ ├── TokenAdminRegistry.daml # Token pool registry & ticket authority +│ ├── FeeQuoter.daml # Fee calculation engine +│ ├── RMNRemote.daml # Risk management with curse mechanism +│ ├── SendingMessage.daml # Outbound message state machine +│ └── ExecutingMessage.daml # Inbound message state machine +├── runtime/ # Runtime layer (RuntimeV1) — message processing +│ └── daml/CCIP/RuntimeV1/ +│ ├── PerPartyRouter.daml # Per-user state & routing (+ factory) +│ ├── OnRamp.daml # Outbound message processing +│ └── OffRamp.daml # Inbound message processing +├── sender/ # Sender-side orchestrator (user-owned) +│ └── daml/CCIP/ +│ └── CCIPSender.daml # Outbound orchestration & fee finalization +├── receiver/ # Receiver-side orchestrator (user-owned) +│ └── daml/CCIP/ +│ └── CCIPReceiver.daml # Inbound orchestration & CCV threading +├── executor/ # Message executor (extensible) +│ └── daml/CCIP/ExecutorV1/ +│ └── Executor.daml # Remote chain execution wrapper +├── committee-verifier/ # CCV implementation — committee ECDSA +│ └── daml/CCIP/CommitteeVerifierV1/ +│ ├── CommitteeVerifier.daml # Committee-based signature verification +│ └── Crypto/ # DER encoding & signature validation +├── extension-api/ # Extension interfaces for pluggable components +│ └── daml/CCIP/InterfacesV1/ +│ ├── CrossChainVerifier.daml # ICrossChainVerifier interface +│ ├── TokenPool.daml # ITokenPool interface +│ └── Executor.daml # IExecutor interface +├── codec/ # Message encoding & cryptographic utilities +│ └── daml/CCIP/CodecV1/ +│ ├── MessageCodecV1.daml # MessageV1 encoding (EVM-compatible) +│ ├── CCVCodec.daml # CCV attestation encoding +│ ├── FinalityConfig.daml # Finality policy encoding +│ ├── Math.daml # Numeric utilities +│ └── Uint256.daml # 256-bit integer handling +├── tickets/ # Ticket templates │ └── daml/CCIP/ -│ ├── Common.daml # Chain family selectors -│ ├── Internal.daml # MessageExecutionState enum -│ ├── Client.daml # Message types for users -│ ├── CCVId.daml # CCV identifier utilities -│ ├── GlobalConfig.daml # Lane configuration -│ ├── MessageCodecV1.daml # Cross-chain message encoding -│ ├── Tickets.daml # All ticket templates -│ └── Interfaces/ -│ ├── CrossChainVerifier.daml -│ └── Any2CantonMessageReceiver.daml -├── perpartyrouter/ # Per-party routing/state contract -├── onramp/ # Outbound message handling -├── offramp/ # Inbound message handling -├── ccipsender/ # Sender entrypoint that calls verifiers + OnRamp -├── ccvs/ # CommitteeVerifier implementation -├── tokenAdminRegistry/ # Token pool registry and ticket authority -├── feequoter/ # Fee calculation -├── ccipreceiver/ # Example receiver implementation -└── test/ # Test contracts and mocks +│ └── TicketsV1.daml # TokenReceiveTicket definition +├── client/ # Client interfaces for applications +│ └── daml/CCIP/ +│ └── ClientV1.daml # Public-facing PerPartyRouter interface +├── events/ # Event contracts for off-chain observation +│ └── daml/CCIP/EventsV1/ +│ ├── Events.daml # CCIPMessageSent, ExecutionStateChanged +│ └── Receipts.daml # Event receipts +├── pools/ # Reference token pool implementations +│ ├── lock-release-token-pool/ # Lock-release pool implementation +│ └── burn-mint-token-pool/ # Burn-mint pool implementation +├── rate-limiter/ # Rate limiting contracts +├── factory/ # Factory for contract deployment +│ └── daml/CCIP/ +│ └── FactoryV1.daml # Contract deployment factory +├── test/ # Test contracts & mocks +│ └── daml/CCIP/ +│ └── *Test.daml # Unit & integration tests +└── utils/ # Utility modules + └── daml/CCIP/ + └── UtilsV1/ # Common helpers +``` + +### Package imports +```mermaid +flowchart BT + + splice-metadata-v1 + splice-holding-v1 + splice-burn-mint-v1 + splice-transfer-instruction-v1 + + chainlink-api + + mcms-api + mcms-core + mcms-core --> chainlink-api + mcms-core --> mcms-api + + ccip-api + ccip-api --> splice-metadata-v1 + ccip-api --> splice-holding-v1 + ccip-api --> splice-burn-mint-v1 + ccip-api --> splice-transfer-instruction-v1 + ccip-api --> chainlink-api + ccip-api --> ccip-codec + + ccip-client + ccip-client --> splice-metadata-v1 + ccip-client --> splice-holding-v1 + ccip-client --> splice-burn-mint-v1 + ccip-client --> splice-transfer-instruction-v1 + ccip-client --> chainlink-api + ccip-client --> ccip-codec + ccip-client --> ccip-events + ccip-client --> ccip-tickets + ccip-client --> ccip-extension-api + + ccip-codec + ccip-codec --> chainlink-api + ccip-codec --> mcms-api + + ccip-committee-verifier + ccip-committee-verifier --> splice-metadata-v1 + ccip-committee-verifier --> splice-holding-v1 + ccip-committee-verifier --> splice-burn-mint-v1 + ccip-committee-verifier --> splice-transfer-instruction-v1 + ccip-committee-verifier --> chainlink-api + ccip-committee-verifier --> mcms-api + ccip-committee-verifier --> ccip-codec + ccip-committee-verifier --> ccip-api + ccip-committee-verifier --> ccip-extension-api + + ccip-core + ccip-core --> splice-metadata-v1 + ccip-core --> splice-holding-v1 + ccip-core --> splice-burn-mint-v1 + ccip-core --> splice-transfer-instruction-v1 + ccip-core --> chainlink-api + ccip-core --> mcms-api + ccip-core --> ccip-api + ccip-core --> ccip-tickets + ccip-core --> ccip-codec + ccip-core --> ccip-events + + ccip-events + ccip-events --> splice-metadata-v1 + ccip-events --> splice-holding-v1 + ccip-events --> splice-burn-mint-v1 + ccip-events --> splice-transfer-instruction-v1 + ccip-events --> chainlink-api + ccip-events --> mcms-api + ccip-events --> ccip-api + ccip-events --> ccip-codec + + ccip-executor + ccip-executor --> splice-metadata-v1 + ccip-executor --> splice-holding-v1 + ccip-executor --> splice-burn-mint-v1 + ccip-executor --> splice-transfer-instruction-v1 + ccip-executor --> chainlink-api + ccip-executor --> mcms-api + ccip-executor --> ccip-api + ccip-executor --> ccip-codec + ccip-executor --> ccip-extension-api + + ccip-extension-api + ccip-extension-api --> splice-metadata-v1 + ccip-extension-api --> splice-holding-v1 + ccip-extension-api --> splice-burn-mint-v1 + ccip-extension-api --> splice-transfer-instruction-v1 + ccip-extension-api --> chainlink-api + ccip-extension-api --> ccip-api + + ccip-burn-mint-token-pool + ccip-burn-mint-token-pool --> splice-metadata-v1 + ccip-burn-mint-token-pool --> splice-holding-v1 + ccip-burn-mint-token-pool --> splice-burn-mint-v1 + ccip-burn-mint-token-pool --> splice-transfer-instruction-v1 + ccip-burn-mint-token-pool --> chainlink-api + ccip-burn-mint-token-pool --> mcms-api + ccip-burn-mint-token-pool --> ccip-api + ccip-burn-mint-token-pool --> ccip-tickets + ccip-burn-mint-token-pool --> ccip-codec + ccip-burn-mint-token-pool --> ccip-utils + ccip-burn-mint-token-pool --> ccip-events + ccip-burn-mint-token-pool --> ccip-rate-limiter + ccip-burn-mint-token-pool --> ccip-extension-api + + ccip-lock-release-token-pool + ccip-lock-release-token-pool --> splice-metadata-v1 + ccip-lock-release-token-pool --> splice-holding-v1 + ccip-lock-release-token-pool --> splice-burn-mint-v1 + ccip-lock-release-token-pool --> splice-transfer-instruction-v1 + ccip-lock-release-token-pool --> chainlink-api + ccip-lock-release-token-pool --> mcms-api + ccip-lock-release-token-pool --> ccip-api + ccip-lock-release-token-pool --> ccip-tickets + ccip-lock-release-token-pool --> ccip-codec + ccip-lock-release-token-pool --> ccip-utils + ccip-lock-release-token-pool --> ccip-events + ccip-lock-release-token-pool --> ccip-rate-limiter + ccip-lock-release-token-pool --> ccip-extension-api + + ccip-rate-limiter + ccip-rate-limiter --> chainlink-api + ccip-rate-limiter --> mcms-api + + ccip-runtime + ccip-runtime --> splice-metadata-v1 + ccip-runtime --> splice-holding-v1 + ccip-runtime --> splice-burn-mint-v1 + ccip-runtime --> splice-transfer-instruction-v1 + ccip-runtime --> chainlink-api + ccip-runtime --> mcms-api + ccip-runtime --> ccip-api + ccip-runtime --> ccip-tickets + ccip-runtime --> ccip-core + ccip-runtime --> ccip-utils + ccip-runtime --> ccip-codec + ccip-runtime --> ccip-extension-api + ccip-runtime --> ccip-events + ccip-runtime --> ccip-client + + ccip-tickets + ccip-tickets --> splice-metadata-v1 + ccip-tickets --> splice-holding-v1 + ccip-tickets --> splice-burn-mint-v1 + ccip-tickets --> splice-transfer-instruction-v1 + ccip-tickets --> chainlink-api + ccip-tickets --> ccip-api + ccip-tickets --> ccip-codec + + ccip-utils + ccip-utils --> splice-metadata-v1 + ccip-utils --> mcms-api + + link + link --> splice-metadata-v1 + link --> splice-holding-v1 + link --> splice-burn-mint-v1 + link --> splice-transfer-instruction-v1 + ``` ## Core Contracts ### PerPartyRouter -Per-party routing/state contract used by sender/receiver flows. Each party gets their own router to avoid state +Per-party routing and state container for sender and receiver flows. Each party gets their own router to avoid state contention. +**Fields:** ```daml template PerPartyRouter with - ccipOwner : Party - partyOwner : Party - environmentId : Text - outboundSequenceNumbers : Map (Numeric 0) (Numeric 0) -- destChain -> seqNum - executionStates : Map BytesHex MessageExecutionState -- messageHash -> state - receiverRequiredCCVs : [CCVId] -- CCVs required for inbound + instanceId : Text -- Unique identifier + ccipOwner : Party -- CCIP system owner + partyOwner : Party -- Message sender/receiver + deps : PerPartyRouterDeps -- Dependency container + outboundSequenceNumbers : Map (Numeric 0) (Numeric 0) -- destChain → seqNum + executedMessages : Set BytesHex -- messageHash set (for replay detection) + archivedExecutionContractIds : [ContractId ArchivedExecutedMessages] -- archived message sets + customObservers : [Party] -- Optional observers ``` -**Key choices:** - -- `CCIPSend` - Send a cross-chain message -- `Execute` - Execute an inbound message -- `GetRequiredCCVsForSend` - Query required CCVs for sending -- `GetRequiredCCVsForExecute` - Query required CCVs for receiving +**Key Choices:** +- `GetSequenceNumber` — Query next sequence number for a destination chain +- `PrepareSend` — Initiate outbound message (creates SendingMessageV1) +- `GetFee` — Calculate total fee including CCVs, pool, executor, and network costs +- `FinalizeFee` — Apply fee to message and fee payment instruction +- `CCIPSend` — Finalize outbound message (creates CCIPMessageSent event) +- `PrepareExecute` — Initiate inbound message (creates ExecutingMessageV1) +- `GetRequiredCCVsForExecute` — Query final required CCVs for execution +- `Execute` — Finalize inbound message (creates ExecutionStateChanged event) +- `SetDeps` — (Factory) Update dependencies (MCMS-protected) ### OnRamp -Contains business logic for outbound messages. Called by PerPartyRouter. +Implements outbound message processing, called by `PerPartyRouter.CCIPSend`. Encodes messages, +validates lane configurations, collects CCVs, and issues `TokenSendTicket` if token transfer present. +**Fields:** ```daml template OnRamp with + instanceId : Text ccipOwner : Party - environmentId : Text + deps : OnRampDeps -- Includes GlobalConfig, FeeQuoter, RMNRemote ``` -**Key choice:** - -- `CCIPSendFromRouter` - Validates tickets, encodes message, returns encoded result +**Key Choices:** +- `GetRequiredCCVsForSendFromRouter` — Compute required CCVs for outbound lane +- `GetFeeFromRouter` — Calculate fee components (network, CCV, token pool, executor) +- `PrepareSendFromRouter` — Build SendingMessageV1 (message state machine) +- `FinalizeFeeFromRouter` — Apply fee to message and compute fee instructions +- `CCIPSendFromRouter` — Encode message, collect CCVs, create CCIPMessageSent event ### OffRamp -Contains business logic for inbound messages. Called by PerPartyRouter. +Implements inbound message processing, called by `PerPartyRouter.Execute`. Decodes messages, +validates source chain configs, collects CCVs, and issues `TokenReceiveTicket`. +**Fields:** ```daml template OffRamp with + instanceId : Text ccipOwner : Party - environmentId : Text + deps : OffRampDeps -- Includes GlobalConfig, RMNRemote, TokenAdminRegistry ``` -**Key choice:** - -- `ExecuteFromRouter` - Decodes message, validates CCVs, issues TokenReceiveTicket +**Key Choices:** +- `GetRequiredCCVsForExecuteFromRouter` — Compute required CCVs for inbound lane +- `PrepareExecuteFromRouter` — Decode message, build ExecutingMessageV1 (message state machine) +- `ExecuteFromRouter` — Validate CCVs, issue TokenReceiveTicket, create ExecutionStateChanged event ### GlobalConfig -Shared configuration for lane settings. +Shared configuration for chain selectors and lane settings. Managed by `ccipOwner` via MCMS. +**Fields:** ```daml template GlobalConfig with + instanceId : Text ccipOwner : Party - environmentId : Text - chainSelector : Numeric 0 -- This chain's selector - onRampAddress : BytesHex -- This chain's OnRamp address - destChainConfigs : Map (Numeric 0) DestChainConfig - sourceChainConfigs : Map (Numeric 0) SourceChainConfig + chainSelector : Numeric 0 -- This chain's identifier + destChainConfigs : Map (Numeric 0) DestChainConfig -- Outbound lanes + sourceChainConfigs : Map (Numeric 0) SourceChainConfig -- Inbound lanes +``` +**Key Choices:** +- `GetDestChainConfig` — Fetch destination chain configuration +- `GetSourceChainConfig` — Fetch source chain configuration +- `ApplyDestChainConfigUpdates` — Update outbound lane configs (MCMS-protected) +- `ApplySourceChainConfigUpdates` — Update inbound lane configs (MCMS-protected) + +**DestChainConfig:** +```daml data DestChainConfig = DestChainConfig with isEnabled : Bool - offRampAddress : BytesHex - laneMandatedCCVs : [CCVId] -- Required for this lane + addressBytesLength : Int + baseExecutionGasCost : Int + tokenReceiverAllowed : Bool + offRampAddress : BytesHex -- Remote OffRamp address + defaultExecutor : Optional BytesHex -- Default executor address if none specified + laneMandatedCCVs : [CCVId] -- Required CCVs for this lane defaultCCVs : [CCVId] -- Fallback if none specified + messageNetworkFeeUSDCents : Numeric 0 -- Per-message fee + tokenNetworkFeeUSDCents : Numeric 0 -- Per-token-transfer fee +``` +**SourceChainConfig:** +```daml data SourceChainConfig = SourceChainConfig with isEnabled : Bool - onRampAddress : BytesHex + onRampAddresses : [BytesHex] -- Remote OnRamp addresses laneMandatedCCVs : [CCVId] defaultCCVs : [CCVId] ``` ### TokenAdminRegistry -Central authority for token-related tickets. Manages which pools are authorized for which tokens. +Central authority for token pool registration and `TokenReceiveTicket` issuance. +**Fields:** ```daml template TokenAdminRegistry with - owner : Party + instanceId : Text + ccipOwner : Party tokenConfigs : Map InstrumentId TokenConfig +``` + +**Key Choices:** +- `GetTokenConfig` — Query registered pool for a token +- `SetPool` — Register or unregister a pool for a token (admin-protected) +- `ConsumeReceiveTicket` — Consume ticket to release inbound tokens (pool + ccipOwner authority) +- `SetOutboundPoolCCVs` — Record pool's required CCVs for outbound transfers +- `SetInboundPoolCCVs` — Record pool's required CCVs for inbound transfers +- `ProposeAdministrator` / `AcceptAdminRole` — Two-step admin transfer (MCMS-protected) + +### RMNRemote -data TokenConfig = TokenConfig +Risk Management Network providing emergency stop capability via **curse mechanism** (matching EVM `RMNRemote.sol`). +Supports both global curses and per-chain curses. + +**Fields:** +```daml +template RMNRemote with - admin : Optional Party - pendingAdmin : Optional Party - tokenPoolOwner : Optional Party - requiredCCVs : [CCVId] -- Pool's required CCVs + instanceId : Text + rmnOwner : Party -- Party controlling curse operations (separate from ccipOwner) + ccipOwner : Party -- For association/validation + customObservers : [Party] -- Optional observers + cursedSubjects : [BytesHex] -- Currently cursed subjects ``` -**Key choices:** +**Curse Subjects:** +- Global curse: `bytes16(uint128(0x01000000000000000000000000000001))` +- Per-chain curse: `bytes16(uint128(chainSelector))` -- `SetPool` - Registers or clears the pool for an instrument -- `ProposeAdministrator` / `AcceptAdminRole` / `TransferAdminRole` - Two-step token admin management -- `ConsumeReceiveTicket` - Called by pool to release tokens against an inbound ticket -- `SetOutboundPoolCCVs` / `SetInboundPoolCCVs` - Records pool-required CCVs on outbound and inbound message state -- `AddTokenSendFee` / `AddTokenSend` / `FinalizeExecute` - Finalizes token-side message accounting and execution state +**Key Choices:** +- `Curse` — Curse a specific subject (rmnOwner authority) +- `Uncurse` — Uncurse a subject (rmnOwner authority) +- `CurseChain` — Curse a specific chain selector (convenience) +- `UncurseChain` — Uncurse a specific chain selector (convenience) +- `IsCursed` — Check if globally cursed +- `IsCursedForChain` — Check if globally OR chain-specifically cursed +- `GetCursedSubjects` — List all currently cursed subjects + +### FeeQuoter + +Fee calculation engine for per-message and per-token costs. Used by OnRamp and CCIPSender. + +**Key Choices:** +- `GetFeeTokenConfig` — Retrieve native fee token configuration +- `UpdateTokenPrices` — Update exchange rate prices (MCMS-protected) +- `UpdateFeeTokenConfig` — Update fee token settings (MCMS-protected) + +### SendingMessage & ExecutingMessage + +**SendingMessage** (CoreV1) — Outbound message state machine created by OnRamp, threaded through: +1. Fee calculation (CCIPSender.CalculateFee) +2. CCV forwarding to verifiers (CCIPSender.ForwardToVerifier) +3. Final send (PerPartyRouter.CCIPSend → OnRamp.CCIPSendFromRouter) + +**ExecutingMessage** (CoreV1) — Inbound message state machine created by OffRamp, threaded through: +1. CCV verification (CCIPReceiver.Execute → CCVs) +2. Token pool verification (if token transfer) +3. Final execution (PerPartyRouter.Execute → OffRamp.ExecuteFromRouter) + +## Extension Components + +### ICrossChainVerifier Interface + +Pluggable interface for cross-chain message verification implementations. Implementations include `CommitteeVerifier`. + +**Key Choices:** +- `CrossChainVerifier_VerifyMessage` — Verify inbound message and append verification to ExecutingMessageV1 +- `CrossChainVerifier_CalculateFee` — Calculate fee for message and append to SendingMessageV1 +- `CrossChainVerifier_GetFee` — Quote-only fee for a destination chain (no message required) +- `CrossChainVerifier_ForwardToVerifier` — Forward message for verification and append verifier data to SendingMessageV1 ### CommitteeVerifier -A CCV implementation using committee-based ECDSA signature verification. +CCV implementation using committee-based ECDSA signature verification (matching EVM pattern). +**Fields:** ```daml template CommitteeVerifier with + instanceId : Text + owner : Party -- CCV operator + ccipOwner : Party -- CCIP system owner + versionTag : BytesHex -- e.g., "e9a05a20" for v2.0.0 + allowListAdmin : Optional Party -- Two-step admin control + messageSentObservers : [Party] -- CCIPMessageSent observers + storageLocations : [Text] -- Off-chain storage URLs + storageLocationsAdmin : Party + remoteChainConfigs : Map (Numeric 0) RemoteChainConfig + signerConfigs : Map (Numeric 0) SignatureConfig + deps : CommitteeVerifierDeps +``` + +**Key Choices:** +- `VerifyMessage` (via interface) — ECDSA signature verification for inbound +- `CalculateFee` — Per-message CCV verification fee +- `GetFee` — Quote CCV fee without message +- `ForwardToVerifier` — Forward message for off-chain attestation +- `ApplySignatureConfigs` — Update per-chain signature requirements (MCMS) +- `ApplyRemoteChainConfigUpdates` — Update remote chain fees & thresholds (MCMS) + +### IExecutor Interface + +Pluggable interface for message execution on remote chains. Default implementation is `Executor`. + +**Key Choices:** +- `Executor_CalculateFee` — Calculate execution cost +- `Executor_GetFee` — Quote execution fee + +### Executor + +Message execution wrapper for destination chains. + +**Fields:** +```daml +template Executor + with + instanceId : Text owner : Party - ccipOwner : Party - versionTag : BytesHex -- e.g., "e9a05a20" - threshold : Int -- Minimum signatures required - signers : [BytesHex] -- Authorized signer public keys + maxCCVsPerMsg : Int -- Safety limit + dynamicConfig : DynamicConfig + allowedCCVs : [RawInstanceAddress] -- Whitelisted CCVs + remoteChainConfigs : Map (Numeric 0) RemoteChainConfig ``` -## Ticket Pattern +**Key Choices:** +- `CalculateFee` — Compute execution gas and fee for a message +- `GetFee` — Query fee for destination chain +- `ApplyDestChainUpdates` — Update per-chain fee and gas configs (MCMS) -Canton's privacy model means CCIP infrastructure cannot directly call user contracts. The **ticket pattern** solves -this: +### ITokenPool Interface -1. User calls their contract (e.g., TokenPool) to perform an action -2. Contract issues a ticket proving the action occurred -3. User passes ticket to CCIP contracts -4. CCIP validates and consumes the ticket +Pluggable interface for token pool implementations. + +**Key Choices:** +- `TokenPool_LockOrBurn` — Initiate outbound token transfer (issuer authority) +- `TokenPool_ReleaseFromTicket` — Release/mint inbound tokens (pool authority) +- `TokenPool_GetRequiredCCVs` — Get token-specific CCV requirements -### Ticket Types +### Orchestrators -| Ticket | Issued By | Consumed By | Purpose | -|----------------------|----------------------------------|------------------------------|-----------------------------------------------| -| `TokenSendTicket` | TokenPool via TokenAdminRegistry | OnRamp | Proves tokens were locked | -| `VerifierData` | CCV (`ForwardToVerifier`) | OnRamp / message pipeline | Attestation data attached to outbound message | -| `CCVVerification` | CCV (`VerifyMessage`) | OffRamp / execution pipeline | Proves inbound message verification | -| `TokenReceiveTicket` | OffRamp via TokenAdminRegistry | TokenPool | Authorizes token release | +#### CCIPSender -## CCV Identification +User-owned sender orchestrator. Executes the full outbound flow in a single atomic transaction. -Cross-Chain Verifiers are identified by a `CCVId` combining: +**Fields:** +```daml +template CCIPSender + with + owner : Party -- Message sender (signatory) + -- ccipOwner is NOT a party on this contract (disclosed only) +``` -- **Version tag** (4 bytes hex): Identifies the CCV type/version -- **Party**: Identifies the CCV operator +**Key Steps:** +1. Accept token holdings (via Holding contract IDs) +2. Query required CCVs from PerPartyRouter +3. Get fee quotes from each CCV +4. Calculate total fee (CCV + network + token pool + executor) +5. Forward message to CCVs for attestation +6. Call PerPartyRouter.CCIPSend with finalized SendingMessageV1 +7. Emit CCIPMessageSent event with messageId and encoded message +**Key Choices:** +- `Send` — Execute full outbound flow + +#### CCIPReceiver + +User-owned receiver orchestrator. Executes inbound message through CCV verification and pool verification. + +**Fields:** +```daml +template CCIPReceiver + with + instanceId : Text + owner : Party -- Message receiver (signatory) + requiredCCVs : [RawInstanceAddress] -- Receiver's required CCVs + optionalCCVs : [RawInstanceAddress] + optionalThreshold : Int + receiverFinalityConfig : FinalityConfig + -- ccipOwner is NOT a party on this contract (disclosed only) ``` -CCVId = "@" -Example: "e9a05a20@participant1::ccv-owner" + +**Key Steps:** +1. Accept encoded message and CCV verifications +2. Thread ExecutingMessageV1 through each CCV.VerifyMessage +3. Thread ExecutingMessageV1 through optional token pool verification +4. Call PerPartyRouter.Execute with fully verified ExecutingMessageV1 +5. Emit ExecutionStateChanged event with messageId and execution state + +**Key Choices:** +- `Execute` — Execute full inbound flow +- `GetRequiredCCVs` — Query final CCV requirements (aggregated from lane + receiver + pool) + +## Ticket Pattern + +Canton's privacy model means CCIP infrastructure cannot directly call user contracts. The **ticket pattern** solves this: + +1. User calls their contract (e.g., TokenPool) to perform an action +2. Contract issues a ticket proving the action occurred (signatory: ccipOwner + pool/participant) +3. User passes ticket CID to CCIP workflow +4. CCIP validates and consumes the ticket + +### TokenReceiveTicket + +Created by OffRamp after successful inbound execution. Authorizes token release on receiving chain. + +**Fields:** +```daml +template TokenReceiveTicket + with + ccipOwner : Party + ccvOwners : [Party] -- CCV operators (from verifications) + verifiedCCVs : [RawInstanceAddress] -- Exact CCVs that verified the message + requiredInboundPoolCCVs : [RawInstanceAddress] -- Pool-required CCVs + poolAddress : RawInstanceAddress -- Exact pool instance + poolOwner : Party -- Pool that should release + receiver : Party -- Message receiver + tokenReceiver : Party -- Who gets the tokens + instrumentId : InstrumentId + amount : BytesHex + sourcePoolData : BytesHex + messageId : BytesHex + sourceChainSelector : Numeric 0 + finality : FinalityConfig ``` -The version tag is embedded in the first 4 bytes of `verifierBlob`/`ccvData`, preventing CCVs from lying about their -type. +**Signatory:** `[ccipOwner, poolOwner] ++ ccvOwners` (deduplicated) + +**Key Choice:** +- `Consume` — Archive the ticket after pool releases tokens (ccipOwner + poolOwner authority) -## Message Encoding +## Message Encoding (EVM-Compatible) -Messages are encoded to match EVM's `MessageV1Codec.sol` exactly for cross-chain `messageId` compatibility: +Messages are encoded to exactly match EVM's `MessageV1Codec.sol` for cross-chain `messageId` compatibility: ``` messageId = keccak256(encodedMessage) @@ -271,22 +691,35 @@ messageId = keccak256(encodedMessage) ```daml data MessageV1 = MessageV1 with - -- Static section (69 bytes) + -- Static section (69 bytes) — enables deterministic messageId sourceChainSelector : Numeric 0 -- uint64 destChainSelector : Numeric 0 -- uint64 sequenceNumber : Numeric 0 -- uint64 executionGasLimit : Int -- uint32 ccipReceiveGasLimit : Int -- uint32 finality : BytesHex -- bytes4 finality config - ccvAndExecutorHash : BytesHex -- bytes32 + ccvAndExecutorHash : BytesHex -- bytes32 (keccak256(CCV_configs || executor_config)) -- Variable section - onRampAddress : BytesHex - offRampAddress : BytesHex - sender : BytesHex -- PartyId encoded - receiver : BytesHex -- PartyId encoded - destBlob : BytesHex + onRampAddress : BytesHex -- Remote OnRamp address + offRampAddress : BytesHex -- Remote OffRamp address + sender : BytesHex -- PartyId encoded as bytes + receiver : BytesHex -- PartyId encoded as bytes + destBlob : BytesHex -- Executor-specific arguments tokenTransfer : Optional TokenTransferV1 - messageData : BytesHex + messageData : BytesHex -- Arbitrary user payload +``` + +**TokenTransferV1:** +```daml +data TokenTransferV1 = TokenTransferV1 + with + amount : BytesHex + poolAddress : BytesHex -- Remote token pool address + sourceTokenAddress : BytesHex -- Local token address + destTokenAddress : BytesHex -- Remote token address + destTokenAmount : BytesHex + sourcePoolData : BytesHex -- Pool-specific encoding + extraData : BytesHex -- Optional pool extra data ``` ## Explicit Disclosure @@ -325,9 +758,6 @@ they're not stakeholders of. Sending a cross-chain message from Canton to another chain. -Note: some legacy diagrams below still use `CCVTicket` naming. Current verifier integration is direct via verifier -interface choices. - ``` ┌─────────────────────────────────────────────────────────────────────────────┐ │ SEND FLOW │ @@ -347,7 +777,7 @@ interface choices. │ 2. GET CCV ATTESTATION │ │ ══════════════════════ │ │ │ -│ User ──► ForwardToVerifier │ +│ User ──► ForwardToVerifier │ │ │ │ │ ▼ │ │ VerifierData appended to SendingMessageV1 │ @@ -585,7 +1015,7 @@ Required CCVs = lane-mandated + receiver + pool + defaults ``` 1. **Lane-mandated**: `GlobalConfig.sourceChainConfigs[source].laneMandatedCCVs` -2. **Receiver CCVs**: `PerPartyRouter.receiverRequiredCCVs` +2. **Receiver CCVs**: Configured via `CCIPReceiver.requiredCCVs` (passed to PerPartyRouter) 3. **Pool CCVs**: `TokenAdminRegistry.tokenConfigs[instrument].requiredCCVs` (if token transfer) 4. **Defaults**: `GlobalConfig.sourceChainConfigs[source].defaultCCVs` (if no others specified) @@ -593,7 +1023,7 @@ Required CCVs = lane-mandated + receiver + pool + defaults ## Bi-directional Validation -Security is enforced through mutual validation: +Security is enforced through mutual validation between PerPartyRouter and OnRamp/OffRamp: ``` ┌───────────────────┐ ┌───────────────────┐ @@ -602,12 +1032,13 @@ Security is enforced through mutual validation: │ 1. Fetch ramp │───────────────────►│ │ │ 2. Validate: │ │ │ │ - ccipOwner │ │ │ -│ - environmentId│ │ │ +│ - instanceId │ │ │ │ │ │ │ │ 3. Exercise │───────────────────►│ 4. Validate: │ -│ choice │ │ - environmentId│ +│ choice │ │ - instanceId │ │ │◄───────────────────│ 5. Return result │ │ 6. Update state │ │ │ +│ (seqNum, etc) │ │ │ └───────────────────┘ └───────────────────┘ ``` @@ -671,10 +1102,21 @@ Build all Daml contracts: cd contracts && dpm build --all ``` -Build a single package: +Build individual packages by category: ```bash -cd contracts/ccip/perpartyrouter && dpm build +# Core infrastructure +cd contracts/ccip/core && dpm build +cd contracts/ccip/runtime && dpm build + +# Orchestrators +cd contracts/ccip/sender && dpm build +cd contracts/ccip/receiver && dpm build + +# Extension implementations +cd contracts/ccip/committee-verifier && dpm build +cd contracts/ccip/executor && dpm build +cd contracts/ccip/pools/lock-release-token-pool && dpm build ``` Clean all build artifacts: @@ -683,4 +1125,6 @@ Clean all build artifacts: cd contracts && dpm clean --all ``` -Built DARs are output to `.daml/dist/` in each package directory. +Built DARs are output to `.daml/dist/` in each package directory. After building, run `make contracts` from the repo root to: +1. Copy DARs to `contracts/dars/current/` +2. Generate Go bindings to `bindings/generated/latest/` diff --git a/contracts/ccip/api/daml.yaml b/contracts/ccip/api/daml.yaml new file mode 100644 index 000000000..e9259140c --- /dev/null +++ b/contracts/ccip/api/daml.yaml @@ -0,0 +1,17 @@ +sdk-version: 3.4.11 +name: ccip-api +source: daml +version: 2.0.0 +build-options: + - "-Wno-crypto-text-is-alpha" + - "-Werror=unused-dependency" +data-dependencies: + - ../../dependencies/splice/splice-api-token-metadata-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/api/daml/CCIP/APIV1/ExecutingMessage.daml b/contracts/ccip/api/daml/CCIP/APIV1/ExecutingMessage.daml new file mode 100644 index 000000000..8b2e4d67b --- /dev/null +++ b/contracts/ccip/api/daml/CCIP/APIV1/ExecutingMessage.daml @@ -0,0 +1,67 @@ +module CCIP.APIV1.ExecutingMessage where + +import DA.Crypto.Text (BytesHex) + +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CodecV1.MessageCodecV1 + +data MessageExecutionState + = UNTOUCHED + | IN_PROGRESS + | SUCCESS + | FAILURE + deriving (Eq, Show) + +interface IExecutingMessage where + viewtype ExecutingMessageView + + executingMessage_cancelExecuteImpl : ContractId IExecutingMessage -> ExecutingMessage_CancelExecute -> Update () + executingMessage_addCCVVerificationImpl : ContractId IExecutingMessage -> ExecutingMessage_AddCCVVerification -> Update (ContractId IExecutingMessage) + + nonconsuming choice ExecutingMessage_CancelExecute : () + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do executingMessage_cancelExecuteImpl this self arg + + nonconsuming choice ExecutingMessage_AddCCVVerification : ContractId IExecutingMessage + with + ccvInstanceId : Text + versionTag : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do executingMessage_addCCVVerificationImpl this self arg + +data ExecutingMessageView = ExecutingMessageView + with + ccipOwner : Party + + message : CCIP.CodecV1.MessageCodecV1.MessageV1 + + offRamp : Chainlink.InstanceAddress.RawInstanceAddress + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +interface ITokenReceiveTicket where + viewtype TokenReceiveTicketView + + choice Consume : () + controller (view this).ccipOwner, (view this).poolOwner + do pure () + +data TokenReceiveTicketView = TokenReceiveTicketView + with + ccipOwner : Party + poolOwner : Party + ccvOwners : [Party] + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/api/daml/CCIP/APIV1/FeeQuoter.daml b/contracts/ccip/api/daml/CCIP/APIV1/FeeQuoter.daml new file mode 100644 index 000000000..c294b1837 --- /dev/null +++ b/contracts/ccip/api/daml/CCIP/APIV1/FeeQuoter.daml @@ -0,0 +1,107 @@ +module CCIP.APIV1.FeeQuoter where + +import qualified Splice.Api.Token.MetadataV1 +import qualified Splice.Api.Token.HoldingV1 + +import qualified Chainlink.InstanceAddress + +feeQuoterContextKey : Text +feeQuoterContextKey = "fee-quoter" + +interface IFeeQuoter where + viewtype FeeQuoterView + + feeQuoter_publicFetchImpl : ContractId IFeeQuoter -> FeeQuoter_PublicFetch -> Update FeeQuoterView + feeQuoter_getTokenPriceImpl : ContractId IFeeQuoter -> FeeQuoter_GetTokenPrice -> Update TimestampedPrice + feeQuoter_getDestinationChainGasPriceImpl : ContractId IFeeQuoter -> FeeQuoter_GetDestinationChainGasPrice -> Update TimestampedPrice + feeQuoter_getTokenTransferFeeImpl : ContractId IFeeQuoter -> FeeQuoter_GetTokenTransferFee -> Update (Numeric 0, Int, Int) + feeQuoter_quoteGasForExecImpl : ContractId IFeeQuoter -> FeeQuoter_QuoteGasForExec -> Update QuoteGasForExecResult + feeQuoter_getFeeTokensImpl : ContractId IFeeQuoter -> FeeQuoter_GetFeeTokens -> Update [Splice.Api.Token.HoldingV1.InstrumentId] + + -- | Fetch the view of the FeeQuoter contract. + nonconsuming choice FeeQuoter_PublicFetch : FeeQuoterView + with + -- | The expected address of the FeeQuoter contract. + -- Implementations MUST validate that this matches the actual address of the contract. + -- This way, callers can ensure that they are fetching the correct contract, provided all vetted + -- Daml packages only contain interface implementations that check the expected address. + expectedAddress : Chainlink.InstanceAddress.RawInstanceAddress + -- | Context reserved for future use. + context : Splice.Api.Token.MetadataV1.ChoiceContext + -- | The party fetching the contract. + caller : Party + controller caller + do feeQuoter_publicFetchImpl this self arg + + -- Prices + + nonconsuming choice FeeQuoter_GetTokenPrice : TimestampedPrice + with + token : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do feeQuoter_getTokenPriceImpl this self arg + + nonconsuming choice FeeQuoter_GetDestinationChainGasPrice : TimestampedPrice + with + destChainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do feeQuoter_getDestinationChainGasPriceImpl this self arg + + -- Fee Quoting + + nonconsuming choice FeeQuoter_GetTokenTransferFee : (Numeric 0, Int, Int) + with + destChainSelector : Numeric 0 + token : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do feeQuoter_getTokenTransferFeeImpl this self arg + + nonconsuming choice FeeQuoter_QuoteGasForExec : QuoteGasForExecResult + with + destChainSelector : Numeric 0 + nonCalldataGas : Int + calldataSize : Int + feeToken : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do feeQuoter_quoteGasForExecImpl this self arg + + -- Fee Tokens + + nonconsuming choice FeeQuoter_GetFeeTokens : [Splice.Api.Token.HoldingV1.InstrumentId] + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do feeQuoter_getFeeTokensImpl this self arg + +data FeeQuoterView = FeeQuoterView + with + ccipOwner : Party + instanceId : Text + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +data TimestampedPrice = TimestampedPrice + with + -- 10-decimal USD price, stored as Decimal. + price : Decimal + timestamp : Time + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +data QuoteGasForExecResult = QuoteGasForExecResult + with + totalGas : Int + gasCostUSDCents : Numeric 0 + feeTokenPrice : Decimal + premiumMultiplier : Decimal + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) diff --git a/contracts/ccip/api/daml/CCIP/APIV1/GlobalConfig.daml b/contracts/ccip/api/daml/CCIP/APIV1/GlobalConfig.daml new file mode 100644 index 000000000..c6ffd1ce1 --- /dev/null +++ b/contracts/ccip/api/daml/CCIP/APIV1/GlobalConfig.daml @@ -0,0 +1,71 @@ +module CCIP.APIV1.GlobalConfig where + +import DA.Crypto.Text (BytesHex) + +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +globalConfigContextKey : Text +globalConfigContextKey = "global-config" + +interface IGlobalConfig where + viewtype GlobalConfigView + + globalConfig_publicFetchImpl : ContractId IGlobalConfig -> GlobalConfig_PublicFetch -> Update GlobalConfigView + globalConfig_getDestChainConfigImpl : ContractId IGlobalConfig -> GlobalConfig_GetDestChainConfig -> Update (Optional DestChainConfig) + globalConfig_getSourceChainConfigImpl : ContractId IGlobalConfig -> GlobalConfig_GetSourceChainConfig -> Update (Optional SourceChainConfig) + + nonconsuming choice GlobalConfig_PublicFetch : GlobalConfigView + with + expectedAddress : Chainlink.InstanceAddress.RawInstanceAddress + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do globalConfig_publicFetchImpl this self arg + + nonconsuming choice GlobalConfig_GetDestChainConfig : Optional DestChainConfig + with + destChainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do globalConfig_getDestChainConfigImpl this self arg + + nonconsuming choice GlobalConfig_GetSourceChainConfig : Optional SourceChainConfig + with + sourceChainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do globalConfig_getSourceChainConfigImpl this self arg + +data GlobalConfigView = GlobalConfigView + with + ccipOwner : Party + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +data DestChainConfig = DestChainConfig + with + isEnabled : Bool -- Flag whether this destination chain is enabled or not. + addressBytesLength : Int -- The length of an address on this chain in bytes, e.g. 20 for EVM, 32 for SVM. + tokenReceiverAllowed : Bool -- Whether specifying `tokenReceiver` in extraArgs is allowed. Must be set to false for all EVM chains. + baseExecutionGasCost : Int -- Base destination-chain gas cost added to ccipReceiveGasLimit for execution pricing. + offRampAddress : BytesHex -- OffRamp address on the destination chain. + defaultExecutor : Optional Chainlink.InstanceAddress.RawInstanceAddress -- Default executor to use for messages to this destination chain. `None` means no executor. + laneMandatedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs to use for all messages to this destination chain. + defaultCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Default CCVs to use for messages to this destination chain. + messageNetworkFeeUSDCents : Numeric 0 -- Network fee in USD cents for messages without token transfers. + tokenNetworkFeeUSDCents : Numeric 0 -- Network fee in USD cents for messages with token transfers. + context : Splice.Api.Token.MetadataV1.ChoiceContext -- Additional return context for future use. + deriving (Eq, Show) + +data SourceChainConfig = SourceChainConfig + with + isEnabled : Bool -- Flag whether the source chain is enabled or not. + onRampAddresses : [BytesHex] -- OnRamp addresses on the source chain. + defaultCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Default CCVs to use for messages from this source chain. + laneMandatedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs to use for all messages from this source chain. + context : Splice.Api.Token.MetadataV1.ChoiceContext -- Additional return context for future use. + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/api/daml/CCIP/APIV1/RMNRemote.daml b/contracts/ccip/api/daml/CCIP/APIV1/RMNRemote.daml new file mode 100644 index 000000000..0aae5d519 --- /dev/null +++ b/contracts/ccip/api/daml/CCIP/APIV1/RMNRemote.daml @@ -0,0 +1,65 @@ +module CCIP.APIV1.RMNRemote where + +import DA.Crypto.Text (BytesHex) + +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +rmnRemoteContextKey : Text +rmnRemoteContextKey = "rmn-remote" + +interface IRMNRemote where + viewtype RMNRemoteView + + rmnRemote_publicFetchImpl : ContractId IRMNRemote -> RMNRemote_PublicFetch -> Update RMNRemoteView + rmnRemote_isCursedImpl : ContractId IRMNRemote -> RMNRemote_IsCursed -> Update Bool + rmnRemote_isCursedForChainImpl : ContractId IRMNRemote -> RMNRemote_IsCursedForChain -> Update Bool + rmnRemote_getCursedSubjectsImpl : ContractId IRMNRemote -> RMNRemote_GetCursedSubjects -> Update [BytesHex] + + -- | Fetch the view of the RMNRemote contract. + nonconsuming choice RMNRemote_PublicFetch : RMNRemoteView + with + -- | The expected address of the RMNRemote contract. + -- Implementations MUST validate that this matches the actual address of the contract. + -- This way, callers can ensure that they are fetching the correct contract, provided all vetted + -- Daml packages only contain interface implementations that check the expected address. + expectedAddress : Chainlink.InstanceAddress.RawInstanceAddress + -- | Context reserved for future use. + context : Splice.Api.Token.MetadataV1.ChoiceContext + -- | The party fetching the contract. + caller : Party + controller caller + do rmnRemote_publicFetchImpl this self arg + + -- | Check if globally cursed + nonconsuming choice RMNRemote_IsCursed : Bool + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do rmnRemote_isCursedImpl this self arg + + -- | Check if cursed for specific chain (global OR chain-specific) + nonconsuming choice RMNRemote_IsCursedForChain : Bool + with + chainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do rmnRemote_isCursedForChainImpl this self arg + + -- | Get all cursed subjects + nonconsuming choice RMNRemote_GetCursedSubjects : [BytesHex] + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do rmnRemote_getCursedSubjectsImpl this self arg + +data RMNRemoteView = RMNRemoteView + with + ccipOwner : Party + rmnOwner : Party + instanceId : Text + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/api/daml/CCIP/APIV1/SendingMessage.daml b/contracts/ccip/api/daml/CCIP/APIV1/SendingMessage.daml new file mode 100644 index 000000000..afcf36765 --- /dev/null +++ b/contracts/ccip/api/daml/CCIP/APIV1/SendingMessage.daml @@ -0,0 +1,81 @@ +module CCIP.APIV1.SendingMessage where + +import DA.Crypto.Text (BytesHex) + +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +interface ISendingMessage where + viewtype SendingMessageView + + sendingMessage_feeTokenAmountImpl : ContractId ISendingMessage -> SendingMessage_FeeTokenAmount -> Update Decimal + sendingMessage_addCCVFeeImpl : ContractId ISendingMessage -> SendingMessage_AddCCVFee -> Update (ContractId ISendingMessage) + sendingMessage_addVerifierDataImpl : ContractId ISendingMessage -> SendingMessage_AddVerifierData -> Update (ContractId ISendingMessage) + sendingMessage_addExecutorFeeImpl : ContractId ISendingMessage -> SendingMessage_AddExecutorFee -> Update (ContractId ISendingMessage) + + nonconsuming choice SendingMessage_FeeTokenAmount : Decimal + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do sendingMessage_feeTokenAmountImpl this self arg + + -- CCVs + + nonconsuming choice SendingMessage_AddCCVFee : ContractId ISendingMessage + with + ccvInstanceId : Text + feeUSDCents : Numeric 0 + destGasLimit : Int + destBytesOverhead : Int + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do sendingMessage_addCCVFeeImpl this self arg + + nonconsuming choice SendingMessage_AddVerifierData : ContractId ISendingMessage + with + ccvInstanceId : Text + versionTag : Text + verifierBlob : BytesHex + messageSentObservers : [Party] + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do sendingMessage_addVerifierDataImpl this self arg + + -- Executors + + nonconsuming choice SendingMessage_AddExecutorFee : ContractId ISendingMessage + with + executorInstanceId : Text + executorArgs : BytesHex + feeUSDCents : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do sendingMessage_addExecutorFeeImpl this self arg + + -- Token Pools interact with the SendingMessage via TokenAdminRegistry only. + + +data SendingMessageView = SendingMessageView + with + ccipOwner : Party + sender : Party + destChainSelector : Numeric 0 + + -- CCVs + requiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + outboundPoolCCVs : Optional [Chainlink.InstanceAddress.RawInstanceAddress] + + router : Chainlink.InstanceAddress.RawInstanceAddress + onRamp : Chainlink.InstanceAddress.RawInstanceAddress + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress + + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/api/daml/CCIP/APIV1/TokenAdminRegistry.daml b/contracts/ccip/api/daml/CCIP/APIV1/TokenAdminRegistry.daml new file mode 100644 index 000000000..571ae403d --- /dev/null +++ b/contracts/ccip/api/daml/CCIP/APIV1/TokenAdminRegistry.daml @@ -0,0 +1,244 @@ +module CCIP.APIV1.TokenAdminRegistry where + +import DA.Crypto.Text (BytesHex) + +import qualified Splice.Api.Token.BurnMintV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 +import qualified Splice.Api.Token.TransferInstructionV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.SendingMessage + +tokenAdminRegistryContextKey : Text +tokenAdminRegistryContextKey = "token-admin-registry" + +tokenConfigContextKey : Text +tokenConfigContextKey = "token-config" + +interface ITokenAdminRegistry where + viewtype TokenAdminRegistryView + + tokenAdminRegistry_publicFetchImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_PublicFetch -> Update TokenAdminRegistryView + tokenAdminRegistry_fetchTokenConfigImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_FetchTokenConfig -> Update TokenConfigView + tokenAdminRegistry_setPoolImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_SetPool -> Update (ContractId ITokenConfig) + tokenAdminRegistry_setTransferFactoryImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_SetTransferFactory -> Update (ContractId ITokenConfig) + tokenAdminRegistry_setBurnMintFactoryImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_SetBurnMintFactory -> Update (ContractId ITokenConfig) + tokenAdminRegistry_proposeAdministratorImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_ProposeAdministrator -> Update ProposeAdministratorResult + tokenAdminRegistry_acceptAdminRoleImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_AcceptAdminRole -> Update (ContractId ITokenConfig) + tokenAdminRegistry_transferAdminRoleImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_TransferAdminRole -> Update (ContractId ITokenConfig) + tokenAdminRegistry_isAdministratorImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_IsAdministrator -> Update Bool + tokenAdminRegistry_setInboundPoolCCVsImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_SetInboundPoolCCVs -> Update (ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage) + tokenAdminRegistry_setOutboundPoolCCVsImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_SetOutboundPoolCCVs -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) + tokenAdminRegistry_addTokenSendImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_AddTokenSend -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) + tokenAdminRegistry_addTokenSendFeeImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_AddTokenSendFee -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) + tokenAdminRegistry_consumeReceiveTicketImpl : ContractId ITokenAdminRegistry -> TokenAdminRegistry_ConsumeReceiveTicket -> Update () + + nonconsuming choice TokenAdminRegistry_PublicFetch : TokenAdminRegistryView + with + expectedAddress : Chainlink.InstanceAddress.RawInstanceAddress + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_publicFetchImpl this self arg + + nonconsuming choice TokenAdminRegistry_FetchTokenConfig : TokenConfigView + with + tokenConfigCid : ContractId ITokenConfig + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_fetchTokenConfigImpl this self arg + + nonconsuming choice TokenAdminRegistry_SetPool : ContractId ITokenConfig + with + tokenConfigCid : ContractId ITokenConfig + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + tokenPool : Optional PoolRegistration + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_setPoolImpl this self arg + + nonconsuming choice TokenAdminRegistry_SetTransferFactory : ContractId ITokenConfig + with + tokenConfigCid : ContractId ITokenConfig + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + transferFactory : Optional (ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory) + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_setTransferFactoryImpl this self arg + + nonconsuming choice TokenAdminRegistry_SetBurnMintFactory : ContractId ITokenConfig + with + tokenConfigCid : ContractId ITokenConfig + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + burnMintFactory : Optional (ContractId Splice.Api.Token.BurnMintV1.BurnMintFactory) + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_setBurnMintFactoryImpl this self arg + + nonconsuming choice TokenAdminRegistry_ProposeAdministrator : ProposeAdministratorResult + with + tokenConfigCid : Optional (ContractId ITokenConfig) + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + newAdmin : Party + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_proposeAdministratorImpl this self arg + + nonconsuming choice TokenAdminRegistry_AcceptAdminRole : ContractId ITokenConfig + with + tokenConfigCid : ContractId ITokenConfig + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_acceptAdminRoleImpl this self arg + + nonconsuming choice TokenAdminRegistry_TransferAdminRole : ContractId ITokenConfig + with + tokenConfigCid : ContractId ITokenConfig + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + newAdmin : Party + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_transferAdminRoleImpl this self arg + + nonconsuming choice TokenAdminRegistry_IsAdministrator : Bool + with + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + tokenConfigCid : Optional (ContractId ITokenConfig) + administrator : Party + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_isAdministratorImpl this self arg + + nonconsuming choice TokenAdminRegistry_SetInboundPoolCCVs : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage + with + tokenConfigCid : ContractId ITokenConfig + executingMessageCid : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage + poolInstanceId : Text + poolCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_setInboundPoolCCVsImpl this self arg + + nonconsuming choice TokenAdminRegistry_SetOutboundPoolCCVs : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + with + tokenConfigCid : ContractId ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + poolInstanceId : Text + poolCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_setOutboundPoolCCVsImpl this self arg + + nonconsuming choice TokenAdminRegistry_AddTokenSend : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + with + tokenConfigCid : ContractId ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + poolInstanceId : Text + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + amount : BytesHex + destTokenAddress : BytesHex + extraData : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_addTokenSendImpl this self arg + + nonconsuming choice TokenAdminRegistry_AddTokenSendFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + with + tokenConfigCid : ContractId ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + poolInstanceId : Text + feeUSDCents : Numeric 0 + destGasOverhead : Int + destBytesOverhead : Int + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_addTokenSendFeeImpl this self arg + + nonconsuming choice TokenAdminRegistry_ConsumeReceiveTicket : () + with + tokenConfigCid : ContractId ITokenConfig + tokenReceiveTicketCid : ContractId CCIP.APIV1.ExecutingMessage.ITokenReceiveTicket + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + poolInstanceId : Text + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenAdminRegistry_consumeReceiveTicketImpl this self arg + +data TokenAdminRegistryView = TokenAdminRegistryView + with + ccipOwner : Party + instanceId : Text + deriving (Eq, Show) + +interface ITokenConfig where + viewtype TokenConfigView + + tokenConfig_publicFetchImpl : ContractId ITokenConfig -> TokenConfig_PublicFetch -> Update TokenConfigView + tokenConfig_assertConfiguredTransferFactoryImpl : ContractId ITokenConfig -> TokenConfig_AssertConfiguredTransferFactory -> Update () + tokenConfig_assertConfiguredBurnMintFactoryImpl : ContractId ITokenConfig -> TokenConfig_AssertConfiguredBurnMintFactory -> Update () + + nonconsuming choice TokenConfig_PublicFetch : TokenConfigView + with + expectedAddress : Chainlink.InstanceAddress.RawInstanceAddress + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenConfig_publicFetchImpl this self arg + + nonconsuming choice TokenConfig_AssertConfiguredTransferFactory : () + with + suppliedFactory : ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenConfig_assertConfiguredTransferFactoryImpl this self arg + + nonconsuming choice TokenConfig_AssertConfiguredBurnMintFactory : () + with + suppliedFactory : ContractId Splice.Api.Token.BurnMintV1.BurnMintFactory + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do tokenConfig_assertConfiguredBurnMintFactoryImpl this self arg + +data TokenConfigView = TokenConfigView + with + ccipOwner : Party + instanceId : Text + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + tokenPool : Optional PoolRegistration + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +data PoolRegistration = PoolRegistration + with + poolOwner : Party + poolInstanceId : Text + deriving (Eq, Show) + +data ProposeAdministratorResult = ProposeAdministratorResult + with + tokenAdminRegistryCid : ContractId ITokenAdminRegistry + tokenConfigCid : ContractId ITokenConfig + created : Bool + index : Int + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) diff --git a/contracts/ccip/client-api/daml.yaml b/contracts/ccip/client-api/daml.yaml new file mode 100644 index 000000000..c0fb231f4 --- /dev/null +++ b/contracts/ccip/client-api/daml.yaml @@ -0,0 +1,19 @@ +sdk-version: 3.4.11 +name: ccip-client-api +source: daml +version: 2.0.0 +build-options: + - "-Wno-crypto-text-is-alpha" + - "-Werror=unused-dependency" +data-dependencies: + - ../../dependencies/splice/splice-api-token-metadata-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/client-api/daml/CCIP/ClientV1.daml b/contracts/ccip/client-api/daml/CCIP/ClientV1.daml new file mode 100644 index 000000000..06dad9b5a --- /dev/null +++ b/contracts/ccip/client-api/daml/CCIP/ClientV1.daml @@ -0,0 +1,260 @@ +module CCIP.ClientV1 where + +import DA.Crypto.Text (BytesHex) + +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 +import qualified Splice.Api.Token.TransferInstructionV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.InterfacesV1.CrossChainVerifier +import qualified CCIP.InterfacesV1.Executor +import qualified CCIP.InterfacesV1.TokenPool + +interface PerPartyRouter where + viewtype PerPartyRouterView + + perPartyRouter_getSequenceNumberImpl : ContractId PerPartyRouter -> PerPartyRouter_GetSequenceNumber -> Update (Numeric 0) + perPartyRouter_getRequiredCCVsForSendImpl : ContractId PerPartyRouter -> PerPartyRouter_GetRequiredCCVsForSend -> Update [Chainlink.InstanceAddress.RawInstanceAddress] + perPartyRouter_getFeeImpl : ContractId PerPartyRouter -> PerPartyRouter_GetFee -> Update GetFeeResult + perPartyRouter_prepareSendImpl : ContractId PerPartyRouter -> PerPartyRouter_PrepareSend -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) + perPartyRouter_finalizeFeeImpl : ContractId PerPartyRouter -> PerPartyRouter_FinalizeFee -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) + perPartyRouter_ccipSendImpl : ContractId PerPartyRouter -> PerPartyRouter_CCIPSend -> Update CCIPSendResult + + perPartyRouter_getExecutionStateImpl : ContractId PerPartyRouter -> PerPartyRouter_GetExecutionState -> Update CCIP.APIV1.ExecutingMessage.MessageExecutionState + perPartyRouter_getRequiredCCVsForExecuteImpl : ContractId PerPartyRouter -> PerPartyRouter_GetRequiredCCVsForExecute -> Update [Chainlink.InstanceAddress.RawInstanceAddress] + perPartyRouter_prepareExecuteImpl : ContractId PerPartyRouter -> PerPartyRouter_PrepareExecute -> Update (ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage) + perPartyRouter_executeImpl : ContractId PerPartyRouter -> PerPartyRouter_Execute -> Update ExecuteResult + + -- =================== + -- Message Sending + -- =================== + + nonconsuming choice PerPartyRouter_GetSequenceNumber : Numeric 0 + with + destChainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + controller (view this).owner + do perPartyRouter_getSequenceNumberImpl this self arg + + nonconsuming choice PerPartyRouter_GetRequiredCCVsForSend : [Chainlink.InstanceAddress.RawInstanceAddress] + with + destChainSelector : Numeric 0 + message : Canton2AnyMessage + poolReportedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + context : Splice.Api.Token.MetadataV1.ChoiceContext + controller (view this).owner + do perPartyRouter_getRequiredCCVsForSendImpl this self arg + + nonconsuming choice PerPartyRouter_GetFee : GetFeeResult + with + destChainSelector : Numeric 0 + message : Canton2AnyMessage + ccvFeeQuotes : [CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote] + tokenPoolFeeQuote : Optional CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote + executorFeeQuote : Optional CCIP.InterfacesV1.Executor.ExecutorFeeQuote + context : Splice.Api.Token.MetadataV1.ChoiceContext + controller (view this).owner + do perPartyRouter_getFeeImpl this self arg + + nonconsuming choice PerPartyRouter_PrepareSend : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + with + destinationChainSelector : Numeric 0 + message : Canton2AnyMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext + controller (view this).owner + do perPartyRouter_prepareSendImpl this self arg + + nonconsuming choice PerPartyRouter_FinalizeFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + with + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext + controller (view this).owner + do perPartyRouter_finalizeFeeImpl this self arg + + nonconsuming choice PerPartyRouter_CCIPSend : CCIPSendResult + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + feeTokenHoldingCids : [ContractId Splice.Api.Token.HoldingV1.Holding] + feeTokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + feeTokenTransferFactory : ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory + feeTokenExtraArgs : Splice.Api.Token.MetadataV1.ExtraArgs + controller (view this).owner + do perPartyRouter_ccipSendImpl this self arg + + -- ===================== + -- Message Execution + -- ===================== + + nonconsuming choice PerPartyRouter_GetExecutionState : CCIP.APIV1.ExecutingMessage.MessageExecutionState + with + messageHash : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do perPartyRouter_getExecutionStateImpl this self arg + + nonconsuming choice PerPartyRouter_GetRequiredCCVsForExecute : [Chainlink.InstanceAddress.RawInstanceAddress] + with + message : CCIP.CodecV1.MessageCodecV1.MessageV1 + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalThreshold : Int + tokenPoolRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + context : Splice.Api.Token.MetadataV1.ChoiceContext + controller (view this).owner + do perPartyRouter_getRequiredCCVsForExecuteImpl this self arg + + nonconsuming choice PerPartyRouter_PrepareExecute : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage + with + encodedMessage : BytesHex + receiverParty : Party + tokenReceiverParty : Optional Party + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalThreshold : Int + receiverFinalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller (view this).owner + do perPartyRouter_prepareExecuteImpl this self arg + + nonconsuming choice PerPartyRouter_Execute : ExecuteResult + with + executingMessageCid : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext + controller (view this).owner + do perPartyRouter_executeImpl this self arg + +data GetFeeResult = GetFeeResult + with + -- Final amount payable in the selected fee token, including CCV fees, + -- token-pool fee, CCIP network fee, executor flat fee, and execution gas cost. + feeTokenAmount : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +interface ICCIPMessageSent where + viewtype CCIPMessageSentView + +data CCIPMessageSentView = CCIPMessageSentView + with + ccipOwner : Party + messageId : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +data CCIPSendResult = CCIPSendResult + with + router : ContractId PerPartyRouter + ccipMessageSent : ContractId ICCIPMessageSent + messageId : BytesHex + feeChangeCids : [ContractId Splice.Api.Token.HoldingV1.Holding] + pendingFeeInstructions : [ContractId Splice.Api.Token.TransferInstructionV1.TransferInstruction] + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +interface IExecutionStateChanged where + viewtype ExecutionStateChangedView + +data ExecutionStateChangedView = ExecutionStateChangedView + with + ccipOwner : Party + messageId : BytesHex + state : CCIP.APIV1.ExecutingMessage.MessageExecutionState + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +data ExecuteResult = ExecuteResult + with + router : ContractId PerPartyRouter + tokenReceiveTicket : Optional (ContractId CCIP.APIV1.ExecutingMessage.ITokenReceiveTicket) + executionStateChanged : ContractId IExecutionStateChanged + messageId : BytesHex + message : CCIP.CodecV1.MessageCodecV1.MessageV1 + state : CCIP.APIV1.ExecutingMessage.MessageExecutionState + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +data PerPartyRouterView = PerPartyRouterView + with + ccipOwner : Party + owner : Party + +-- Message types + +data Canton2AnyMessage = Canton2AnyMessage + with + receiver : BytesHex + payload : BytesHex + tokenTransfer : Optional TokenTransfer + feeToken : Splice.Api.Token.HoldingV1.InstrumentId + extraArgs : ExtraArgs + deriving (Eq, Show) + +data TokenTransfer = TokenTransfer + with + token : Splice.Api.Token.HoldingV1.InstrumentId + amount : Decimal + deriving (Eq, Show) + +data CCVExtraArg = CCVExtraArg + with + ccvAddress : Chainlink.InstanceAddress.RawInstanceAddress + ccvArgs : BytesHex + deriving (Eq, Show) + +data ExecutorExtraArg + = Executor_NoExecutor + | Executor_UseDefault with + executorArgs : BytesHex + | Executor_WithAddress with + executorAddress : Chainlink.InstanceAddress.RawInstanceAddress + executorArgs : BytesHex + deriving (Eq, Show) + +data ExtraArgs + = V3 GenericExtraArgsV3 + deriving (Eq, Show) + +data GenericExtraArgsV3 = GenericExtraArgsV3 + with + -- | Gas limit for the callback on the destination chain. + -- | If the gas limit is zero and the message data length is also zero, no callback + -- | will be performed, even if a receiver is specified. A gas limit of zero is useful + -- | when only token transfers are desired, or when the receiver is an EOA account + -- | instead of a contract. Besides this gasLimit check, there are other checks on the + -- | destination chain that may prevent the callback from being executed, depending on + -- | the destination chain family. + -- | The sender is billed for the gas specified, not the gas actually used. Any unspent + -- | gas is not refunded. There are various ways to estimate the gas required for a + -- | callback on the destination chain, depending on the chain family. Please refer to + -- | the documentation for each chain for more details. + gasLimit : Int + -- | Sender-specified CCV addresses for the message. + -- | May be empty to indicate that the destination chain defaults should be used. + ccvs : [CCVExtraArg] + -- | How executor selection should be resolved for the message. + executor : ExecutorExtraArg + -- | Address of the token receiver on the destination chain, in bytes format. If an empty + -- | bytes array is provided, the receiver address from the message itself is used for + -- | token transfers. This field allows for scenarios where the token receiver is + -- | different from the message receiver. + -- | May be empty, the behavior differs depending on if there is a token transfer or not: + -- | - If there is a token transfer, the receiver from the message is used. + -- | - If there is no token transfer, this field should be empty. + tokenReceiver : BytesHex + -- | Additional arguments for token transfers. + -- | This field is passed into the token pool on the source chain and is not inspected by + -- | CCIP itself. The format of this field is therefore specific to the token pool being + -- | used and may vary between different pools. + -- | May be empty depending on the token pool. + tokenArgs : BytesHex + deriving (Eq, Show) diff --git a/contracts/ccip/codec/daml.yaml b/contracts/ccip/codec/daml.yaml new file mode 100644 index 000000000..afc1840b5 --- /dev/null +++ b/contracts/ccip/codec/daml.yaml @@ -0,0 +1,15 @@ +sdk-version: 3.4.11 +name: ccip-codec +source: daml +version: 2.0.0 +build-options: + - "-Wno-crypto-text-is-alpha" + - "-Werror=unused-dependency" +data-dependencies: + - ../../dependencies/splice/splice-api-token-metadata-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/core/daml/CCIP/Codec.daml b/contracts/ccip/codec/daml/CCIP/CodecV1.daml similarity index 90% rename from contracts/ccip/core/daml/CCIP/Codec.daml rename to contracts/ccip/codec/daml/CCIP/CodecV1.daml index d674d69d8..87d0708ee 100644 --- a/contracts/ccip/core/daml/CCIP/Codec.daml +++ b/contracts/ccip/codec/daml/CCIP/CodecV1.daml @@ -1,7 +1,7 @@ -- | CCIP-specific codec utilities. -- Contains Splice-specific (InstrumentId) and CCIP-specific (RawInstanceAddress) encoders. -- For generic primitives, import from MCMS.Codec directly. -module CCIP.Codec +module CCIP.CodecV1 ( -- InstrumentId encoding (Splice-specific) encodeInstrumentId , decodeInstrumentId @@ -32,10 +32,13 @@ import MCMS.Codec import DA.Crypto.Text (BytesHex, toHex, fromHex, byteCount) import DA.Optional (fromSome) + import qualified Splice.Api.Token.HoldingV1 -import qualified CCIP.FinalityConfig as FinalityCodec + import Chainlink.InstanceAddress (RawInstanceAddress(..)) +import qualified CCIP.CodecV1.FinalityConfig + -- =========================================================================== -- INSTRUMENT ID ENCODING/DECODING (Splice-specific) -- Format: [uint8 adminLen][admin party text as hex][uint8 idLen][id text as hex] @@ -131,25 +134,25 @@ decodeRawInstanceAddressListHelper encoded offset remaining acc = do -- 2 = BlockDepth -- =========================================================================== -encodeRequestedFinality : FinalityCodec.FinalityConfig -> BytesHex +encodeRequestedFinality : CCIP.CodecV1.FinalityConfig.FinalityConfig -> BytesHex encodeRequestedFinality requestedFinality = case requestedFinality of - FinalityCodec.WaitForFinality -> fromSome (encodeUint8 0) - FinalityCodec.WaitForSafe -> fromSome (encodeUint8 1) - FinalityCodec.BlockDepth depth -> + CCIP.CodecV1.FinalityConfig.WaitForFinality -> fromSome (encodeUint8 0) + CCIP.CodecV1.FinalityConfig.WaitForSafe -> fromSome (encodeUint8 1) + CCIP.CodecV1.FinalityConfig.BlockDepth depth -> fromSome (encodeUint8 2) <> fromSome (encodeInt64 depth) -decodeRequestedFinalityAt : BytesHex -> Int -> Optional (FinalityCodec.FinalityConfig, Int) +decodeRequestedFinalityAt : BytesHex -> Int -> Optional (CCIP.CodecV1.FinalityConfig.FinalityConfig, Int) decodeRequestedFinalityAt encoded offset = do tagHex <- extractBytes encoded offset 1 tag <- decodeUint8 tagHex case tag of - 0 -> Some (FinalityCodec.WaitForFinality, offset + 1) - 1 -> Some (FinalityCodec.WaitForSafe, offset + 1) + 0 -> Some (CCIP.CodecV1.FinalityConfig.WaitForFinality, offset + 1) + 1 -> Some (CCIP.CodecV1.FinalityConfig.WaitForSafe, offset + 1) 2 -> do (depth, newOffset) <- decodeInt64At encoded (offset + 1) - if FinalityCodec.isValidBlockDepth depth - then Some (FinalityCodec.BlockDepth depth, newOffset) + if CCIP.CodecV1.FinalityConfig.isValidBlockDepth depth + then Some (CCIP.CodecV1.FinalityConfig.BlockDepth depth, newOffset) else None _ -> None diff --git a/contracts/ccip/core/daml/CCIP/Internal.daml b/contracts/ccip/codec/daml/CCIP/CodecV1/CCVCodec.daml similarity index 71% rename from contracts/ccip/core/daml/CCIP/Internal.daml rename to contracts/ccip/codec/daml/CCIP/CodecV1/CCVCodec.daml index c73e39a9a..e1ac2fc9f 100644 --- a/contracts/ccip/core/daml/CCIP/Internal.daml +++ b/contracts/ccip/codec/daml/CCIP/CodecV1/CCVCodec.daml @@ -1,20 +1,14 @@ -module CCIP.Internal where +module CCIP.CodecV1.CCVCodec where import DA.List (dedup) import DA.Optional (fromOptional, isSome) -import qualified CCIP.MessageCodecV1 -import Chainlink.InstanceAddress (RawInstanceAddress(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -data MessageExecutionState - = UNTOUCHED - | IN_PROGRESS - | SUCCESS - | FAILURE - deriving (Eq, Show) +import qualified Chainlink.InstanceAddress -useDefaultCCVs : RawInstanceAddress -useDefaultCCVs = RawInstanceAddress "default-ccvs" +import qualified CCIP.CodecV1.MessageCodecV1 + +useDefaultCCVs : Chainlink.InstanceAddress.RawInstanceAddress +useDefaultCCVs = Chainlink.InstanceAddress.RawInstanceAddress "default-ccvs" -- EVM GenericExtraArgsV3 encodes the user CCV count in one byte. Keep Canton -- bounded to the same absolute protocol ceiling; executors may enforce lower @@ -28,17 +22,17 @@ assertMaxCCVListLength label ccvs = assertCCVInstanceId : Text - -> [RawInstanceAddress] - -> Optional [RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] + -> Optional [Chainlink.InstanceAddress.RawInstanceAddress] -> Text -> Party -> Update () assertCCVInstanceId msg requiredCCVs extraAllowedCCVs ccvInstanceId caller = - let claimed = RawInstanceAddress.make ccvInstanceId caller + let claimed = Chainlink.InstanceAddress.make ccvInstanceId caller allowedCCVs = dedup (requiredCCVs ++ fromOptional [] extraAllowedCCVs) in assertMsg msg (claimed `elem` allowedCCVs) -resolveDefaultCCVs : [RawInstanceAddress] -> RawInstanceAddress -> [RawInstanceAddress] -> [RawInstanceAddress] +resolveDefaultCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -> Chainlink.InstanceAddress.RawInstanceAddress -> [Chainlink.InstanceAddress.RawInstanceAddress] -> [Chainlink.InstanceAddress.RawInstanceAddress] resolveDefaultCCVs defaultCCVs useDefaultCCVs ccvs = foldr (\ccv acc -> if ccv == useDefaultCCVs @@ -48,17 +42,17 @@ resolveDefaultCCVs defaultCCVs useDefaultCCVs ccvs = -- EVM-style required CCV resolution: empty means use defaults; otherwise the -- useDefaultCCVs sentinel expands in place. -resolveRequiredCCVsWithDefaults : [RawInstanceAddress] -> [RawInstanceAddress] -> [RawInstanceAddress] +resolveRequiredCCVsWithDefaults : [Chainlink.InstanceAddress.RawInstanceAddress] -> [Chainlink.InstanceAddress.RawInstanceAddress] -> [Chainlink.InstanceAddress.RawInstanceAddress] resolveRequiredCCVsWithDefaults defaultCCVs ccvs = case ccvs of [] -> defaultCCVs _ -> resolveDefaultCCVs defaultCCVs useDefaultCCVs ccvs resolveOptionalCCVs - : [RawInstanceAddress] - -> [RawInstanceAddress] + : [Chainlink.InstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] -> Int - -> ([RawInstanceAddress], Int) + -> ([Chainlink.InstanceAddress.RawInstanceAddress], Int) resolveOptionalCCVs requiredCCVs optionalCCVs optionalThreshold = foldl (\(remainingOptional, remainingThreshold) requiredCCV -> @@ -73,13 +67,13 @@ resolveOptionalCCVs requiredCCVs optionalCCVs optionalThreshold = requiredCCVs computeExecuteCCVs - : [RawInstanceAddress] - -> [RawInstanceAddress] - -> CCIP.MessageCodecV1.MessageV1 - -> [RawInstanceAddress] - -> [RawInstanceAddress] + : [Chainlink.InstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] + -> CCIP.CodecV1.MessageCodecV1.MessageV1 + -> [Chainlink.InstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] -> Int - -> Update ([RawInstanceAddress], [RawInstanceAddress], Int) + -> Update ([Chainlink.InstanceAddress.RawInstanceAddress], [Chainlink.InstanceAddress.RawInstanceAddress], Int) computeExecuteCCVs defaultCCVs laneMandatedCCVs message receiverRequiredCCVs receiverOptionalCCVs receiverOptionalThreshold = let isTokenOnlyTransfer = message.messageData == "" @@ -111,12 +105,12 @@ computeExecuteCCVs defaultCCVs laneMandatedCCVs message receiverRequiredCCVs rec pure (baseRequiredCCVs, baseOptionalCCVs, baseOptionalCCVThreshold) mergeInboundPoolCCVs - : [RawInstanceAddress] - -> [RawInstanceAddress] - -> [RawInstanceAddress] + : [Chainlink.InstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] -> Int - -> [RawInstanceAddress] - -> ([RawInstanceAddress], [RawInstanceAddress], Int) + -> [Chainlink.InstanceAddress.RawInstanceAddress] + -> ([Chainlink.InstanceAddress.RawInstanceAddress], [Chainlink.InstanceAddress.RawInstanceAddress], Int) mergeInboundPoolCCVs sourceDefaultCCVs requiredCCVs optionalCCVs optionalCCVThreshold poolCCVs = let resolvedPoolCCVs = resolveRequiredCCVsWithDefaults sourceDefaultCCVs poolCCVs mergedRequiredCCVs = dedup (requiredCCVs ++ resolvedPoolCCVs) diff --git a/contracts/ccip/core/daml/CCIP/FinalityConfig.daml b/contracts/ccip/codec/daml/CCIP/CodecV1/FinalityConfig.daml similarity index 99% rename from contracts/ccip/core/daml/CCIP/FinalityConfig.daml rename to contracts/ccip/codec/daml/CCIP/CodecV1/FinalityConfig.daml index 121d9705e..4433e52b0 100644 --- a/contracts/ccip/core/daml/CCIP/FinalityConfig.daml +++ b/contracts/ccip/codec/daml/CCIP/CodecV1/FinalityConfig.daml @@ -1,8 +1,8 @@ -module CCIP.FinalityConfig where +module CCIP.CodecV1.FinalityConfig where +import qualified DA.Crypto.Text import DA.Crypto.Text (BytesHex, byteCount) import DA.Optional (fromSomeNote) -import qualified DA.Crypto.Text import qualified DA.Text as Text data FinalityConfig diff --git a/contracts/ccip/core/daml/CCIP/Math.daml b/contracts/ccip/codec/daml/CCIP/CodecV1/Math.daml similarity index 99% rename from contracts/ccip/core/daml/CCIP/Math.daml rename to contracts/ccip/codec/daml/CCIP/CodecV1/Math.daml index b452be921..295f46cee 100644 --- a/contracts/ccip/core/daml/CCIP/Math.daml +++ b/contracts/ccip/codec/daml/CCIP/CodecV1/Math.daml @@ -23,7 +23,7 @@ -- This module is intentionally narrow. It exists to support CCIP's exact fee -- arithmetic, Decimal/Numeric0 boundary shifts, and protocol-side amount -- normalization, not as a general math library. -module CCIP.Math +module CCIP.CodecV1.Math ( mulDivDown , mulDivUp , calculateLocalAmountChecked diff --git a/contracts/ccip/core/daml/CCIP/MessageCodecV1.daml b/contracts/ccip/codec/daml/CCIP/CodecV1/MessageCodecV1.daml similarity index 97% rename from contracts/ccip/core/daml/CCIP/MessageCodecV1.daml rename to contracts/ccip/codec/daml/CCIP/CodecV1/MessageCodecV1.daml index 5bb6d8159..52491f023 100644 --- a/contracts/ccip/core/daml/CCIP/MessageCodecV1.daml +++ b/contracts/ccip/codec/daml/CCIP/CodecV1/MessageCodecV1.daml @@ -1,4 +1,4 @@ -module CCIP.MessageCodecV1 +module CCIP.CodecV1.MessageCodecV1 ( MessageV1(..) , TokenTransferV1(..) , encodeMessageV1 @@ -23,14 +23,15 @@ module CCIP.MessageCodecV1 , messageId ) where -import DA.Crypto.Text +import DA.Crypto.Text (BytesHex, byteCount, toHex, packHexBytes, fromHex, keccak256) import qualified DA.Text as Text import DA.Optional (fromSome) -import qualified CCIP.FinalityConfig -import qualified CCIP.NumericHex as NumericHex import qualified Splice.Api.Token.HoldingV1 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.NumericHex + -- | MessageV1 struct matching EVM MessageV1Codec.sol exactly. -- The encoding order is critical for cross-chain messageId compatibility: -- messageId = keccak256(encodedMessage) @@ -50,7 +51,7 @@ data MessageV1 = MessageV1 sequenceNumber : Numeric 0 -- uint64 (called messageNumber in EVM) executionGasLimit : Int -- uint32 ccipReceiveGasLimit : Int -- uint32 (gas limit for user callback) - finality : CCIP.FinalityConfig.DecodedFinality -- bytes4 finality config + finality : CCIP.CodecV1.FinalityConfig.DecodedFinality -- bytes4 finality config ccvAndExecutorHash : BytesHex -- bytes32 (hash of CCVs and executor) -- Variable length fields (must be in this exact order for encoding) onRampAddress : BytesHex -- bytes (length-prefixed) @@ -104,7 +105,7 @@ encodeMessageV1 message = <> (if byteCount message.finality.raw == 4 then message.finality.raw else error "MessageCodecV1.encodeMessageV1: finality must be 4 bytes") - <> NumericHex.padLeft 64 "0" message.ccvAndExecutorHash -- ccvAndExecutorHash (32 bytes = 64 hex chars) + <> CCIP.CodecV1.NumericHex.padLeft 64 "0" message.ccvAndExecutorHash -- ccvAndExecutorHash (32 bytes = 64 hex chars) -- Variable length section - MUST match EVM order exactly variableSection = @@ -180,11 +181,11 @@ encodeUint32 n = -- Convert a Numeric 0 to a hex-encoded uint64 (8 bytes) encodeUint64 : Numeric 0 -> Optional BytesHex -encodeUint64 = NumericHex.encodeUint64 +encodeUint64 = CCIP.CodecV1.NumericHex.encodeUint64 -- Convert a Numeric 0 to a hex-encoded uint256 (32 bytes) encodeUint256 : Numeric 0 -> Optional BytesHex -encodeUint256 = NumericHex.encodeUint256 +encodeUint256 = CCIP.CodecV1.NumericHex.encodeUint256 -- Compute 32-byte party address from Party. -- Returns keccak256(partyToText(party)) for privacy-preserving cross-chain addressing. @@ -534,7 +535,7 @@ decodeMessageV1 encoded = -- Extract finality config (4 bytes, offset 33) finalityHex <- extractBytes encoded 33 4 - finality <- CCIP.FinalityConfig.decodeRequestedFinality finalityHex + finality <- CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalityHex -- Extract ccvAndExecutorHash (32 bytes, offset 37) ccvHashHex <- extractBytes encoded 37 32 diff --git a/contracts/ccip/core/daml/CCIP/NumericHex.daml b/contracts/ccip/codec/daml/CCIP/CodecV1/NumericHex.daml similarity index 99% rename from contracts/ccip/core/daml/CCIP/NumericHex.daml rename to contracts/ccip/codec/daml/CCIP/CodecV1/NumericHex.daml index 965db0b15..f511ae3e1 100644 --- a/contracts/ccip/core/daml/CCIP/NumericHex.daml +++ b/contracts/ccip/codec/daml/CCIP/CodecV1/NumericHex.daml @@ -2,7 +2,7 @@ -- -- These helpers intentionally operate through decimal text rather than Int so -- uint64/uint256-sized protocol values do not lose precision on-ledger. -module CCIP.NumericHex +module CCIP.CodecV1.NumericHex ( encodeUint64 , encodeUint256 , numeric0ToDecimalString diff --git a/contracts/ccip/core/daml/CCIP/Uint256.daml b/contracts/ccip/codec/daml/CCIP/CodecV1/Uint256.daml similarity index 92% rename from contracts/ccip/core/daml/CCIP/Uint256.daml rename to contracts/ccip/codec/daml/CCIP/CodecV1/Uint256.daml index e46dfb915..eb4a7f2a9 100644 --- a/contracts/ccip/core/daml/CCIP/Uint256.daml +++ b/contracts/ccip/codec/daml/CCIP/CodecV1/Uint256.daml @@ -3,7 +3,7 @@ -- MessageV1 token amounts are source-denominated uint256 values. They can be -- larger than Canton's Numeric 0 range and must be preserved exactly until the -- destination pool applies source-to-local decimal conversion. -module CCIP.Uint256 +module CCIP.CodecV1.Uint256 ( LocalAmountConversionResult(..) , maxUint256DecimalText , maxNumeric0DecimalText @@ -19,7 +19,7 @@ module CCIP.Uint256 import DA.Crypto.Text (BytesHex, byteCount) import DA.Text qualified as Text -import CCIP.NumericHex qualified as NumericHex +import CCIP.CodecV1.NumericHex maxUint256DecimalText : Text maxUint256DecimalText = "115792089237316195423570985008687907853269984665640564039457584007913129639935" @@ -40,18 +40,18 @@ isUint256Bytes raw = byteCount raw == 32 uint256BytesToDecimalText : BytesHex -> Optional Text uint256BytesToDecimalText raw = if not (isUint256Bytes raw) then None - else NumericHex.hexStringToDecimalString raw + else CCIP.CodecV1.NumericHex.hexStringToDecimalString raw decimalTextToUint256Bytes : Text -> Optional BytesHex decimalTextToUint256Bytes raw = do normalized <- normalizeDecimalText raw if decimalTextGreaterThan normalized maxUint256DecimalText then None - else Some (NumericHex.padLeft 64 "0" (NumericHex.decimalStringToHex normalized)) + else Some (CCIP.CodecV1.NumericHex.padLeft 64 "0" (CCIP.CodecV1.NumericHex.decimalStringToHex normalized)) numeric0ToUint256Bytes : Numeric 0 -> Optional BytesHex numeric0ToUint256Bytes n = - decimalTextToUint256Bytes (NumericHex.numeric0ToDecimalString n) + decimalTextToUint256Bytes (CCIP.CodecV1.NumericHex.numeric0ToDecimalString n) decimalTextFitsNumeric0 : Text -> Bool decimalTextFitsNumeric0 raw = case parseNumeric0 raw of @@ -114,7 +114,7 @@ normalizeDecimalTextOrZero raw = in if Text.isEmpty stripped then "0" else stripped decimalTextGreaterThan : Text -> Text -> Bool -decimalTextGreaterThan = NumericHex.compareDecimalStrings +decimalTextGreaterThan = CCIP.CodecV1.NumericHex.compareDecimalStrings parseNumeric0 : Text -> Optional (Numeric 0) parseNumeric0 raw = do @@ -143,7 +143,7 @@ divideDecimalByPow10 raw pow = multiplyDecimalBySmall : Text -> Int -> Text multiplyDecimalBySmall raw factor = - let digits = NumericHex.parseDecimalDigits raw + let digits = CCIP.CodecV1.NumericHex.parseDecimalDigits raw result = multiplyDigitsBySmall digits factor in digitsToDecimalString result @@ -165,8 +165,8 @@ prependCarryDigits carry acc = addDecimalStrings : Text -> Text -> Text addDecimalStrings a b = - let digitsA = reverse (NumericHex.parseDecimalDigits a) - digitsB = reverse (NumericHex.parseDecimalDigits b) + let digitsA = reverse (CCIP.CodecV1.NumericHex.parseDecimalDigits a) + digitsB = reverse (CCIP.CodecV1.NumericHex.parseDecimalDigits b) result = addDigitLists digitsA digitsB 0 in digitsToDecimalString (reverse result) diff --git a/contracts/ccip/committee-verifier/daml.yaml b/contracts/ccip/committee-verifier/daml.yaml index 014bd79bc..0982a385b 100644 --- a/contracts/ccip/committee-verifier/daml.yaml +++ b/contracts/ccip/committee-verifier/daml.yaml @@ -10,10 +10,11 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar - - ../core/.daml/dist/ccip-core-2.0.0.dar - - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar diff --git a/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifier.daml b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1.daml similarity index 83% rename from contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifier.daml rename to contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1.daml index 2aefcb366..459e0c2e1 100644 --- a/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifier.daml +++ b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1.daml @@ -1,6 +1,6 @@ -module CCIP.CommitteeVerifier ( - module CCIP.CommitteeVerifier, - module CCIP.CommitteeVerifierTypes, +module CCIP.CommitteeVerifierV1 ( + module CCIP.CommitteeVerifierV1, + module CCIP.CommitteeVerifierV1.CommitteeVerifierTypes, ) where import qualified DA.Action @@ -9,10 +9,22 @@ import DA.Foldable (forA_) import DA.List (dedup, (\\)) import DA.Map qualified as Map import DA.Optional (fromOptional, fromSomeNote) +import DA.Text qualified as Text + +import qualified Splice.Api.Token.MetadataV1 + +import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) + +import qualified Chainlink.InstanceAddress -import Splice.Api.Token.MetadataV1 (ChoiceContext) +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.InterfacesV1.CrossChainVerifier -import CCIP.CommitteeVerifierCodecGen ( +import qualified CCIP.CommitteeVerifierV1.Crypto.DerEncoding +import CCIP.CommitteeVerifierV1.CommitteeVerifierCodecGen ( decodeApplySignatureConfigsParamsAt, decodeSetDynamicConfigParamsAt, decodeApplyRemoteChainConfigUpdatesParamsAt, @@ -21,7 +33,7 @@ import CCIP.CommitteeVerifierCodecGen ( decodeUpdateStorageLocationsParamsAt, decodeSetDepsParamsAt, ) -import CCIP.CommitteeVerifierTypes ( +import CCIP.CommitteeVerifierV1.CommitteeVerifierTypes ( DynamicConfig(..), RemoteChainConfig(..), RemoteChainConfigArgs(..), @@ -36,17 +48,6 @@ import CCIP.CommitteeVerifierTypes ( TransferStorageLocationsAdminParams(..), UpdateStorageLocationsParams(..), ) -import DA.Text qualified as Text -import qualified CCIP.Crypto.DerEncoding -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.MessageCodecV1 -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import Chainlink.InstanceAddress (assertValidInstanceId) -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 -import qualified CCIP.Interfaces.CrossChainVerifier - -import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -- The preimage is bytes4(keccak256("CommitteeVerifier 2.0.0")) versionTagV2_0_0 : BytesHex @@ -101,43 +102,45 @@ template CommitteeVerifier -- Ensure signer configs have a positive threshold within the verifierResults -- proof limit, no duplicate signer keys, and that map keys match the embedded -- sourceChainSelector in each config. - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && versionTag /= "" && all (\(k, config) -> k == config.sourceChainSelector && isValidSignatureConfig config) (Map.toList signerConfigs) - interface instance CCIP.Interfaces.CrossChainVerifier.ICrossChainVerifier for CommitteeVerifier where - view = CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierView with + interface instance CCIP.InterfacesV1.CrossChainVerifier.ICrossChainVerifier for CommitteeVerifier where + view = CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierView with instanceId = instanceId owner = owner ccipOwner = ccipOwner storageLocations = storageLocations + context = Splice.Api.Token.MetadataV1.emptyChoiceContext crossChainVerifier_verifyMessageImpl self arg = do exercise (fromInterfaceContractId @CommitteeVerifier self) VerifyMessage with rmnRemoteCid = arg.rmnRemoteCid - extraContext = arg.extraContext executingMessageCid = arg.executingMessageCid verifierResults = arg.verifierResults + context = arg.context caller = arg.caller crossChainVerifier_calculateFeeImpl self arg = do exercise (fromInterfaceContractId @CommitteeVerifier self) CalculateFee with sendingMessageCid = arg.sendingMessageCid - extraContext = arg.extraContext + context = arg.context caller = arg.caller crossChainVerifier_getFeeImpl self arg = do exercise (fromInterfaceContractId @CommitteeVerifier self) GetFee with destChainSelector = arg.destChainSelector + context = arg.context caller = arg.caller crossChainVerifier_forwardToVerifierImpl self arg = do exercise (fromInterfaceContractId @CommitteeVerifier self) ForwardToVerifier with rmnRemoteCid = arg.rmnRemoteCid - extraContext = arg.extraContext + context = arg.context sendingMessageCid = arg.sendingMessageCid verifierArgs = arg.verifierArgs caller = arg.caller @@ -302,57 +305,57 @@ template CommitteeVerifier -- | Verify an inbound message and append CCV verification to ExecutingMessageV1. -- Fetches ExecutingMessageV1 for decoded message content and re-encodes -- for signature verification (encoding is deterministic). - nonconsuming choice VerifyMessage : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + nonconsuming choice VerifyMessage : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage with - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : ChoiceContext - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + context : Splice.Api.Token.MetadataV1.ChoiceContext + executingMessageCid : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage verifierResults : BytesHex caller : Party controller caller do execMsg <- fetch executingMessageCid + let execMsgView = view execMsg -- Domain separation: the verifier and the executing message must share a ccipOwner. -- Without this, a verification produced under a different ccipOwner domain could still -- satisfy the executing message's required verifier set because AddCCVVerification -- records identity as (ccvInstanceId, ccvOwner) only. assertMsg "verifier: executing message ccipOwner mismatch" - (execMsg.ccipOwner == ccipOwner) + (execMsgView.ccipOwner == ccipOwner) - let message = execMsg.message + let message = execMsgView.message -- Get source chain signature config let signerConfig = fromSomeNote "source chain not configured" (Map.lookup message.sourceChainSelector signerConfigs) -- Validate RMN instance and check source chain curse - rmnRemote <- exercise rmnRemoteCid CCIP.RMNRemote.Get with caller - RawInstanceAddress.assertEqual "verifier: rmn mismatch" - rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote + rmnRemote <- fetch rmnRemoteCid + let rmnRemoteView = view rmnRemote + Chainlink.InstanceAddress.assertEqual "verifier: rmn mismatch" + rmnRemoteView.instanceId rmnRemoteView.rmnOwner deps.rmnRemote assertMsg "verifier: executing message rmn mismatch" - (execMsg.deps.rmnRemote == deps.rmnRemote) - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with - caller = owner + (execMsgView.rmnRemote == deps.rmnRemote) + isCursed <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_IsCursedForChain with chainSelector = message.sourceChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = owner assertMsg "verifier: source chain is cursed" (not isCursed) -- Verify version tag matches - let verifierVersion = fromSomeNote "Failed to extract verifier version" (CCIP.MessageCodecV1.extractBytes verifierResults 0 (byteCount versionTag)) + let verifierVersion = fromSomeNote "Failed to extract verifier version" (CCIP.CodecV1.MessageCodecV1.extractBytes verifierResults 0 (byteCount versionTag)) assertMsg "Invalid CCV Version" (verifierVersion == versionTag) - let signatureLength = fromSomeNote "Failed to extract signature length" (CCIP.MessageCodecV1.decodeUint16 (fromSomeNote "Failed to extract signature length bytes" (CCIP.MessageCodecV1.extractBytes verifierResults (byteCount versionTag) 2))) + let signatureLength = fromSomeNote "Failed to extract signature length" (CCIP.CodecV1.MessageCodecV1.decodeUint16 (fromSomeNote "Failed to extract signature length bytes" (CCIP.CodecV1.MessageCodecV1.extractBytes verifierResults (byteCount versionTag) 2))) assertMsg "Invalid verifierResults" ((byteCount verifierResults) == ((byteCount versionTag) + 2 + signatureLength)) let numberOfSignatures = signatureLength / signature_length assertMsg "Insufficient signatures provided" (numberOfSignatures >= signerConfig.threshold) - let signatureData = fromSomeNote "Failed to extract signature data" (CCIP.MessageCodecV1.extractBytes verifierResults (byteCount versionTag + 2) signatureLength) + let signatureData = fromSomeNote "Failed to extract signature data" (CCIP.CodecV1.MessageCodecV1.extractBytes verifierResults (byteCount versionTag + 2) signatureLength) let signatures = parseSignatures signatureData -- re-calculate messageId hash for signature verification. - let messageId = CCIP.MessageCodecV1.messageId execMsg.message - - -- validate that exec message content matches the calculated messageId - assertMsg "verifier: executing message ID mismatch" (messageId == execMsg.messageId) + let messageId = CCIP.CodecV1.MessageCodecV1.messageId execMsgView.message -- Matches EVM: signers sign keccak256(versionTag ++ messageHash) let signedHash = keccak256 (versionTag <> messageId) @@ -369,92 +372,93 @@ template CommitteeVerifier (validSignerCount >= signerConfig.threshold) -- Append CCV verification to ExecutingMessageV1 - exercise executingMessageCid CCIP.ExecutingMessageV1.AddCCVVerification with + exercise executingMessageCid CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = instanceId versionTag = versionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner -- | Calculate fee for outbound message (USD cents only). -- Reads destChainSelector from SendingMessageV1, looks up per-chain -- fee config, appends fee via AddCCVFee. - nonconsuming choice CalculateFee - : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice CalculateFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 - extraContext : ChoiceContext + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do sendingMsg <- fetch sendingMessageCid - assertMsg "verifier: sending message ccipOwner mismatch" - (sendingMsg.ccipOwner == ccipOwner) - let chainConfig = fromSomeNote "no fee config for dest chain" - (Map.lookup sendingMsg.destChainSelector remoteChainConfigs) + let sendingMsgView = view sendingMsg + assertMsg "verifier: sending message ccipOwner mismatch" (sendingMsgView.ccipOwner == ccipOwner) + let chainConfig = fromSomeNote "no fee config for dest chain" (Map.lookup sendingMsgView.destChainSelector remoteChainConfigs) - exercise sendingMessageCid CCIP.SendingMessageV1.AddCCVFee with + exercise sendingMessageCid CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = instanceId feeUSDCents = chainConfig.feeUSDCents destGasLimit = chainConfig.gasForVerification destBytesOverhead = chainConfig.payloadSizeBytes + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner -- | Quote fee for outbound message (USD cents only). - nonconsuming choice GetFee - : CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierFeeQuote + nonconsuming choice GetFee : CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote with destChainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do let chainConfig = fromSomeNote "no fee config for dest chain" (Map.lookup destChainSelector remoteChainConfigs) - pure CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierFeeQuote with + pure CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote with ccvInstanceId = instanceId ccvOwner = owner feeUSDCents = chainConfig.feeUSDCents gasForVerification = chainConfig.gasForVerification payloadSizeBytes = chainConfig.payloadSizeBytes + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- | Forward message for verification. Exercises AddVerifierData -- directly on SendingMessageV1. - nonconsuming choice ForwardToVerifier - : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice ForwardToVerifier : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + context : Splice.Api.Token.MetadataV1.ChoiceContext + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage verifierArgs : BytesHex caller : Party controller caller do sendingMsg <- fetch sendingMessageCid - assertMsg "verifier: sending message ccipOwner mismatch" - (sendingMsg.ccipOwner == ccipOwner) + let sendingMsgView = view sendingMsg + assertMsg "verifier: sending message ccipOwner mismatch" (sendingMsgView.ccipOwner == ccipOwner) -- Validate RMN instance and check destination chain curse - rmnRemote <- exercise rmnRemoteCid CCIP.RMNRemote.Get with caller - RawInstanceAddress.assertEqual "verifier: rmn mismatch" - rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote - assertMsg "verifier: sending message rmn mismatch" - (sendingMsg.deps.rmnRemote == deps.rmnRemote) - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with + rmnRemote <- fetch rmnRemoteCid + let rmnRemoteView = view rmnRemote + Chainlink.InstanceAddress.assertEqual "verifier: rmn mismatch" rmnRemoteView.instanceId rmnRemoteView.rmnOwner deps.rmnRemote + assertMsg "verifier: sending message rmn mismatch" (sendingMsgView.rmnRemote == deps.rmnRemote) + isCursed <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_IsCursedForChain with + chainSelector = sendingMsgView.destChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner - chainSelector = sendingMsg.destChainSelector assertMsg "verifier: destination chain is cursed" (not isCursed) -- Assert that the sender is allowed to send messages if allowlist is enabled for the destination chain - let destChainConfig = fromSomeNote "no config for dest chain" (Map.lookup sendingMsg.destChainSelector remoteChainConfigs) + let destChainConfig = fromSomeNote "no config for dest chain" (Map.lookup sendingMsgView.destChainSelector remoteChainConfigs) DA.Action.when destChainConfig.allowListEnabled - $ assertMsg "Sender not allowed to send messages to destination chain" (sendingMsg.sender `elem` destChainConfig.allowedSendersList) + $ assertMsg "Sender not allowed to send messages to destination chain" (sendingMsgView.sender `elem` destChainConfig.allowedSendersList) let verifierBlob = versionTag - exercise sendingMessageCid CCIP.SendingMessageV1.AddVerifierData with + exercise sendingMessageCid CCIP.APIV1.SendingMessage.SendingMessage_AddVerifierData with ccvInstanceId = instanceId versionTag = versionTag verifierBlob = verifierBlob messageSentObservers = messageSentObservers + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner -- ========================================== @@ -547,16 +551,16 @@ parseSignatures signatureData = extractRSComponents : BytesHex -> Int -> (BytesHex, BytesHex) extractRSComponents signatureData index = let offset = index * signature_length - r = fromSomeNote "Failed to extract r component" (CCIP.MessageCodecV1.extractBytes signatureData offset signature_component_length) - s = fromSomeNote "Failed to extract s component" (CCIP.MessageCodecV1.extractBytes signatureData (offset + signature_component_length) signature_component_length) + r = fromSomeNote "Failed to extract r component" (CCIP.CodecV1.MessageCodecV1.extractBytes signatureData offset signature_component_length) + s = fromSomeNote "Failed to extract s component" (CCIP.CodecV1.MessageCodecV1.extractBytes signatureData (offset + signature_component_length) signature_component_length) in (r, s) validateSignature : BytesHex -> PublicKeyHex -> BytesHex -> BytesHex -> Bool validateSignature messageHash publicKey r s = let - derSignature = CCIP.Crypto.DerEncoding.rawToDerSignature r s - derPublicKey = CCIP.Crypto.DerEncoding.secp256k1PublicKeyToDer publicKey + derSignature = CCIP.CommitteeVerifierV1.Crypto.DerEncoding.rawToDerSignature r s + derPublicKey = CCIP.CommitteeVerifierV1.Crypto.DerEncoding.secp256k1PublicKeyToDer publicKey in secp256k1WithEcdsaOnly derSignature messageHash derPublicKey diff --git a/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierCodecGen.daml b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/CommitteeVerifierCodecGen.daml similarity index 94% rename from contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierCodecGen.daml rename to contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/CommitteeVerifierCodecGen.daml index e36348c28..e19927bd6 100644 --- a/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierCodecGen.daml +++ b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/CommitteeVerifierCodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.CommitteeVerifierCodecGen where +module CCIP.CommitteeVerifierV1.CommitteeVerifierCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.CommitteeVerifierTypes (CommitteeVerifierDeps(..), SetDepsParams(..), DynamicConfig(..), SignatureConfig(..), RemoteChainConfigArgs(..), RemoteChainConfig(..), AllowListConfigArgs(..), ApplySignatureConfigsParams(..), SetDynamicConfigParams(..), ApplyRemoteChainConfigUpdatesParams(..), ApplyAllowListUpdatesParams(..), TransferStorageLocationsAdminParams(..), UpdateStorageLocationsParams(..)) +import CCIP.CommitteeVerifierV1.CommitteeVerifierTypes (CommitteeVerifierDeps(..), SetDepsParams(..), DynamicConfig(..), SignatureConfig(..), RemoteChainConfigArgs(..), RemoteChainConfig(..), AllowListConfigArgs(..), ApplySignatureConfigsParams(..), SetDynamicConfigParams(..), ApplyRemoteChainConfigUpdatesParams(..), ApplyAllowListUpdatesParams(..), TransferStorageLocationsAdminParams(..), UpdateStorageLocationsParams(..)) import MCMS.Codec ( decodeBoolAt, @@ -27,7 +27,7 @@ import MCMS.Codec ( encodeText ) -import CCIP.Codec (decodeRawInstanceAddressAt, encodeRawInstanceAddress) +import CCIP.CodecV1 (decodeRawInstanceAddressAt, encodeRawInstanceAddress) -- =============================================== diff --git a/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierTypes.daml b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/CommitteeVerifierTypes.daml similarity index 94% rename from contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierTypes.daml rename to contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/CommitteeVerifierTypes.daml index a728ac959..37d1233f5 100644 --- a/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierTypes.daml +++ b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/CommitteeVerifierTypes.daml @@ -1,18 +1,18 @@ -module CCIP.CommitteeVerifierTypes where +module CCIP.CommitteeVerifierV1.CommitteeVerifierTypes where import DA.Crypto.Text (BytesHex) -import Chainlink.InstanceAddress qualified as RawInstanceAddress +import qualified Chainlink.InstanceAddress data CommitteeVerifierDeps = CommitteeVerifierDeps with - rmnRemote : RawInstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) -- | Parameters for SetDeps - optional fields for selective updates data SetDepsParams = SetDepsParams with - rmnRemote : Optional RawInstanceAddress.RawInstanceAddress + rmnRemote : Optional Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) data DynamicConfig = DynamicConfig diff --git a/contracts/ccip/committee-verifier/daml/CCIP/Crypto/DerEncoding.daml b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/Crypto/DerEncoding.daml similarity index 77% rename from contracts/ccip/committee-verifier/daml/CCIP/Crypto/DerEncoding.daml rename to contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/Crypto/DerEncoding.daml index e2bb1c419..bf8fa4874 100644 --- a/contracts/ccip/committee-verifier/daml/CCIP/Crypto/DerEncoding.daml +++ b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/Crypto/DerEncoding.daml @@ -1,9 +1,9 @@ -module CCIP.Crypto.DerEncoding where +module CCIP.CommitteeVerifierV1.Crypto.DerEncoding where import DA.Crypto.Text (BytesHex, byteCount) import DA.Text qualified as Text -import qualified CCIP.Crypto.Hex +import qualified CCIP.CommitteeVerifierV1.Crypto.Hex -- | Convert raw ECDSA signature (r, s) to DER format -- @@ -25,21 +25,21 @@ rawToDerSignature r s = _ = if byteCount s < 1 || byteCount s > 32 then error "s component must be 1-32 bytes (256-bit max)" else () -- Remove zeroes to compress (0003 == 3) - rTrimmed = CCIP.Crypto.Hex.trimLeadingZeros r - sTrimmed = CCIP.Crypto.Hex.trimLeadingZeros s + rTrimmed = CCIP.CommitteeVerifierV1.Crypto.Hex.trimLeadingZeros r + sTrimmed = CCIP.CommitteeVerifierV1.Crypto.Hex.trimLeadingZeros s -- r and s components are never negative so the sign byte is always 00 - rWithPrefix = if CCIP.Crypto.Hex.highBitSet rTrimmed then "00" <> rTrimmed else rTrimmed - sWithPrefix = if CCIP.Crypto.Hex.highBitSet sTrimmed then "00" <> sTrimmed else sTrimmed + rWithPrefix = if CCIP.CommitteeVerifierV1.Crypto.Hex.highBitSet rTrimmed then "00" <> rTrimmed else rTrimmed + sWithPrefix = if CCIP.CommitteeVerifierV1.Crypto.Hex.highBitSet sTrimmed then "00" <> sTrimmed else sTrimmed rLen = byteCount rWithPrefix sLen = byteCount sWithPrefix - rLenHex = CCIP.Crypto.Hex.byteToHex rLen - sLenHex = CCIP.Crypto.Hex.byteToHex sLen + rLenHex = CCIP.CommitteeVerifierV1.Crypto.Hex.byteToHex rLen + sLenHex = CCIP.CommitteeVerifierV1.Crypto.Hex.byteToHex sLen contentLen = 2 + rLen + 2 + sLen - totalLenHex = CCIP.Crypto.Hex.byteToHex contentLen + totalLenHex = CCIP.CommitteeVerifierV1.Crypto.Hex.byteToHex contentLen in "30" <> totalLenHex <> "02" <> rLenHex <> rWithPrefix <> "02" <> sLenHex <> sWithPrefix diff --git a/contracts/ccip/committee-verifier/daml/CCIP/Crypto/Hex.daml b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/Crypto/Hex.daml similarity index 97% rename from contracts/ccip/committee-verifier/daml/CCIP/Crypto/Hex.daml rename to contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/Crypto/Hex.daml index 5a8e927c9..002adabd3 100644 --- a/contracts/ccip/committee-verifier/daml/CCIP/Crypto/Hex.daml +++ b/contracts/ccip/committee-verifier/daml/CCIP/CommitteeVerifierV1/Crypto/Hex.daml @@ -1,4 +1,4 @@ -module CCIP.Crypto.Hex where +module CCIP.CommitteeVerifierV1.Crypto.Hex where import DA.Crypto.Text (BytesHex) import DA.Text qualified as Text diff --git a/contracts/ccip/core/daml.yaml b/contracts/ccip/core/daml.yaml index 0e2afad75..ad1607444 100644 --- a/contracts/ccip/core/daml.yaml +++ b/contracts/ccip/core/daml.yaml @@ -10,8 +10,12 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../events/.daml/dist/ccip-events-2.0.0.dar + - ../tickets/.daml/dist/ccip-tickets-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar diff --git a/contracts/ccip/core/daml/CCIP/Client.daml b/contracts/ccip/core/daml/CCIP/Client.daml deleted file mode 100644 index 6ff4f3f18..000000000 --- a/contracts/ccip/core/daml/CCIP/Client.daml +++ /dev/null @@ -1,75 +0,0 @@ -module CCIP.Client where - -import DA.Crypto.Text (BytesHex) - -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified Splice.Api.Token.HoldingV1 - -data Canton2AnyMessage = Canton2AnyMessage - with - receiver : BytesHex - payload : BytesHex - tokenTransfer : Optional TokenTransfer - feeToken : Splice.Api.Token.HoldingV1.InstrumentId - extraArgs : ExtraArgs - deriving (Eq, Show) - -data TokenTransfer = TokenTransfer - with - token : Splice.Api.Token.HoldingV1.InstrumentId - amount : Decimal - deriving (Eq, Show) - -data CCVExtraArg = CCVExtraArg - with - ccvAddress : RawInstanceAddress.RawInstanceAddress - ccvArgs : BytesHex - deriving (Eq, Show) - -data ExecutorExtraArg - = Executor_NoExecutor - | Executor_UseDefault with - executorArgs : BytesHex - | Executor_WithAddress with - executorAddress : RawInstanceAddress.RawInstanceAddress - executorArgs : BytesHex - deriving (Eq, Show) - -data ExtraArgs - = V3 GenericExtraArgsV3 - deriving (Eq, Show) - -data GenericExtraArgsV3 = GenericExtraArgsV3 - with - -- | Gas limit for the callback on the destination chain. - -- | If the gas limit is zero and the message data length is also zero, no callback - -- | will be performed, even if a receiver is specified. A gas limit of zero is useful - -- | when only token transfers are desired, or when the receiver is an EOA account - -- | instead of a contract. Besides this gasLimit check, there are other checks on the - -- | destination chain that may prevent the callback from being executed, depending on - -- | the destination chain family. - -- | The sender is billed for the gas specified, not the gas actually used. Any unspent - -- | gas is not refunded. There are various ways to estimate the gas required for a - -- | callback on the destination chain, depending on the chain family. Please refer to - -- | the documentation for each chain for more details. - gasLimit : Int - -- | Sender-specified CCV addresses for the message. - -- | May be empty to indicate that the destination chain defaults should be used. - ccvs : [CCVExtraArg] - -- | How executor selection should be resolved for the message. - executor : ExecutorExtraArg - -- | Address of the token receiver on the destination chain, in bytes format. If an empty - -- | bytes array is provided, the receiver address from the message itself is used for - -- | token transfers. This field allows for scenarios where the token receiver is - -- | different from the message receiver. - -- | May be empty, the behavior differs depending on if there is a token transfer or not: - -- | - If there is a token transfer, the receiver from the message is used. - -- | - If there is no token transfer, this field should be empty. - tokenReceiver : BytesHex - -- | Additional arguments for token transfers. - -- | This field is passed into the token pool on the source chain and is not inspected by - -- | CCIP itself. The format of this field is therefore specific to the token pool being - -- | used and may vary between different pools. - -- | May be empty depending on the token pool. - tokenArgs : BytesHex - deriving (Eq, Show) diff --git a/contracts/ccip/core/daml/CCIP/Context.daml b/contracts/ccip/core/daml/CCIP/Context.daml deleted file mode 100644 index 848b41a0f..000000000 --- a/contracts/ccip/core/daml/CCIP/Context.daml +++ /dev/null @@ -1,163 +0,0 @@ -module CCIP.Context where - -import DA.Time -import DA.TextMap qualified as TextMap - -import Splice.Api.Token.MetadataV1 - --- TODO: resolve circular dependency (ccip-common → ccip-rmn) so the key and --- lookup can live in CCIP.RMNRemote alongside the template instead of here. -import qualified CCIP.RMNRemote - --- Choice context creation and parsing --------------------------------------- - --- | Values that can be converted to AnyValue -class ToAnyValue a where - toAnyValue : a -> AnyValue - --- | Convenience function to create maps that contain an optional value if it is --- set. See its use sites for examples. -addOptionalAnyValue : ToAnyValue a => Text -> Optional a -> TextMap.TextMap AnyValue -> TextMap.TextMap AnyValue -addOptionalAnyValue _k None m = m -addOptionalAnyValue k (Some value) m = TextMap.insert k (toAnyValue value) m - --- | Attempt to parse a value from AnyValue. --- --- If a type implements both `ToAnyValue` and `FromAnyValue` then it must hold that --- `fromAnyValue (toAnyValue x) = Right x` for all `x`. -class FromAnyValue a where - fromAnyValue : AnyValue -> Either Text a - --- | Lookup and decode a value within a choice context. -lookupFromContext : FromAnyValue a => ChoiceContext -> Text -> Either Text (Optional a) -lookupFromContext context k = do - case TextMap.lookup k context.values of - None -> pure None - Some av -> case fromAnyValue av of - Left err -> fail $ "Failed to decode context value for '" <> k <> "': " <> err - Right v -> pure (Some v) - --- | Get a value from a choice context, failing if it is not present or fails to parse. -getFromContext : FromAnyValue a => ChoiceContext -> Text -> Either Text a -getFromContext context k = do - optValue <- lookupFromContext context k - case optValue of - None -> fail $ "Missing context entry for: " <> k - Some v -> pure v - --- | Convenience version of `lookupFromContext` that raises the failure within the `Update`. -lookupFromContextU : FromAnyValue a => ChoiceContext -> Text -> Update (Optional a) -lookupFromContextU context k = either fail pure $ lookupFromContext context k - --- | Convenience version of `getFromContext` that raises the failure within the `Update`. -getFromContextU : FromAnyValue a => ChoiceContext -> Text -> Update a -getFromContextU context k = either fail pure $ getFromContext context k - - --- instances for ToAnyValue ---------------------------- - -instance ToAnyValue Text where - toAnyValue t = AV_Text t - -instance ToAnyValue Int where - toAnyValue x = AV_Int x - -instance ToAnyValue Decimal where - toAnyValue t = AV_Decimal t - -instance ToAnyValue Bool where - toAnyValue x = AV_Bool x - -instance ToAnyValue Date where - toAnyValue x = AV_Date x - -instance ToAnyValue Time where - toAnyValue x = AV_Time x - -instance ToAnyValue RelTime where - toAnyValue x = AV_RelTime x -instance ToAnyValue Party where - toAnyValue p = AV_Party p - -instance ToAnyValue (ContractId t) where - toAnyValue x = AV_ContractId $ coerceContractId x - -instance ToAnyValue a => ToAnyValue [a] where - toAnyValue = AV_List . map toAnyValue - -instance ToAnyValue ChoiceContext where - toAnyValue (ChoiceContext values) = AV_Map values - - --- FromAnyValue instances -------------------------- - -instance FromAnyValue Text where - fromAnyValue (AV_Text t) = Right t - fromAnyValue av = Left $ "expected Text, got: " <> show av - -instance FromAnyValue Int where - fromAnyValue (AV_Int i) = Right i - fromAnyValue av = Left $ "expected Int, got: " <> show av - -instance FromAnyValue Decimal where - fromAnyValue (AV_Decimal i) = Right i - fromAnyValue av = Left $ "expected Decimal, got: " <> show av - -instance FromAnyValue Bool where - fromAnyValue (AV_Bool b) = Right b - fromAnyValue av = Left $ "expected bool, got: " <> show av - -instance FromAnyValue Date where - fromAnyValue (AV_Date p) = Right p - fromAnyValue av = Left $ "expected Date, got: " <> show av - -instance FromAnyValue Time where - fromAnyValue (AV_Time t) = Right t - fromAnyValue av = Left $ "expected Time, got: " <> show av -instance FromAnyValue RelTime where - fromAnyValue (AV_RelTime t) = Right t - fromAnyValue av = Left $ "expected RelTime, got: " <> show av - -instance FromAnyValue Party where - fromAnyValue (AV_Party p) = Right p - fromAnyValue av = Left $ "expected Party, got: " <> show av - -instance Template t => FromAnyValue (ContractId t) where - fromAnyValue (AV_ContractId av) = Right (coerceContractId av) - fromAnyValue av = Left $ "expected contract id, got: " <> show av - -instance FromAnyValue a => FromAnyValue [a] where - fromAnyValue (AV_List avs) = mapA fromAnyValue avs - fromAnyValue av = Left $ "expected list, got: " <> show av - -instance FromAnyValue ChoiceContext where - fromAnyValue (AV_Map values) = Right $ ChoiceContext with values - fromAnyValue av = Left $ "expected map, got: " <> show av - -instance FromAnyValue AnyValue where - fromAnyValue av = Right av - -instance FromAnyValue (TextMap.TextMap AnyValue) where - fromAnyValue (AV_Map values) = Right values - fromAnyValue av = Left $ "expected map, got: " <> show av - -instance FromAnyValue (TextMap.TextMap Text) where - fromAnyValue (AV_Map values) = do - let kvs = TextMap.toList values - results <- mapA (\(k, av) -> do - txt <- fromAnyValue av - pure (k, txt)) kvs - pure $ TextMap.fromList results - fromAnyValue av = Left $ "expected map, got: " <> show av - --- | RMNRemote keys -rmnRemoteKey : Text -rmnRemoteKey = "rmn-remote" - -lookupRmnRemoteCid : ChoiceContext -> Update (ContractId CCIP.RMNRemote.RMNRemote) -lookupRmnRemoteCid ctx = getFromContextU ctx rmnRemoteKey - - diff --git a/contracts/ccip/core/daml/CCIP/ExecutingMessageV1.daml b/contracts/ccip/core/daml/CCIP/CoreV1/ExecutingMessage.daml similarity index 69% rename from contracts/ccip/core/daml/CCIP/ExecutingMessageV1.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/ExecutingMessage.daml index 9df718fe1..d79a04210 100644 --- a/contracts/ccip/core/daml/CCIP/ExecutingMessageV1.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/ExecutingMessage.daml @@ -2,20 +2,23 @@ -- Created by PrepareExecute, acts as a collecting contract: CCVs and pools -- exercise choices directly on it to record verification state. -- Consumed by OffRamp.ExecuteFromRouter after successful execution. -module CCIP.ExecutingMessageV1 where +module CCIP.CoreV1.ExecutingMessage where import DA.Crypto.Text (BytesHex) import DA.List (dedup, unique) import DA.Optional (isNone, isSome) -import qualified CCIP.Events -import qualified CCIP.FinalityConfig -import qualified CCIP.Internal -import qualified CCIP.MessageCodecV1 -import Chainlink.InstanceAddress (RawInstanceAddress) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.Tickets import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.EventsV1.Events +import qualified CCIP.TicketsV1 -- | Record of a CCV verification appended via AddCCVVerification. -- The ccvOwner is authenticated by Daml's controller mechanism. @@ -33,17 +36,17 @@ data ExecutingMessageState data ExecutingMessageDeps = ExecutingMessageDeps with - offRamp : RawInstanceAddress - globalConfig : RawInstanceAddress - rmnRemote : RawInstanceAddress - tokenAdminRegistry : RawInstanceAddress + offRamp : Chainlink.InstanceAddress.RawInstanceAddress + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) data InboundPoolVerification = InboundPoolVerification with poolInstanceId : Text poolOwner : Party - poolCCVs : [RawInstanceAddress] + poolCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] deriving (Eq, Show) -- | Build the observer list from receiver, optional token receiver, and executor. @@ -55,10 +58,10 @@ buildObservingParties receiver tokenReceiver executor = Some p -> [p] None -> [] -template ExecutingMessageV1 +template ExecutingMessage with ccipOwner : Party - message : CCIP.MessageCodecV1.MessageV1 + message : CCIP.CodecV1.MessageCodecV1.MessageV1 messageId : BytesHex receiver : Party tokenReceiver : Optional Party @@ -68,11 +71,11 @@ template ExecutingMessageV1 -- Explicit list of CCV owner parties accumulated via AddCCVVerification. ccvOwners : [Party] -- Resolved execute-time CCV requirements, computed during PrepareExecute. - requiredCCVs : [RawInstanceAddress] - optionalCCVs : [RawInstanceAddress] + requiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + optionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] optionalCCVThreshold : Int - receiverFinalityConfig : CCIP.FinalityConfig.FinalityConfig - sourceDefaultCCVs : [RawInstanceAddress] + receiverFinalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig + sourceDefaultCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Pool identity and declared inbound CCV requirements, set via -- SetInboundPoolCCVs. None = pool hasn't been called; Some with -- empty poolCCVs = called, no pool-specific requirements. @@ -92,10 +95,37 @@ template ExecutingMessageV1 None -> []) observer observingParties + interface instance CCIP.APIV1.ExecutingMessage.IExecutingMessage for ExecutingMessage where + view = CCIP.APIV1.ExecutingMessage.ExecutingMessageView with + ccipOwner = ccipOwner + + message = message + + offRamp = deps.offRamp + globalConfig = deps.globalConfig + rmnRemote = deps.rmnRemote + tokenAdminRegistry = deps.tokenAdminRegistry + + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + executingMessage_cancelExecuteImpl self arg = do + exercise (fromInterfaceContractId @ExecutingMessage self) CancelExecute with + context = arg.context + caller = arg.caller + + executingMessage_addCCVVerificationImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @ExecutingMessage self) AddCCVVerification + with + ccvInstanceId = arg.ccvInstanceId + versionTag = arg.versionTag + context = arg.context + caller = arg.caller + -- Cleanup choice for failed or abandoned flows. Not used for the success path -- (which goes through FinalizeExecute). choice CancelExecute : () with + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -105,16 +135,17 @@ template ExecutingMessageV1 -- Append a CCV verification record and widen the signatory set. -- CCV exercises this after successful signature verification; -- ccvOwner = caller is Daml-authenticated. - choice AddCCVVerification : ContractId ExecutingMessageV1 + choice AddCCVVerification : ContractId ExecutingMessage with ccvInstanceId : Text versionTag : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do assertMsg "executingMessage: AddCCVVerification only allowed in Prepared" (state == ExecutingMessageState_Prepared) - CCIP.Internal.assertCCVInstanceId + CCIP.CodecV1.CCVCodec.assertCCVInstanceId "executingMessage: caller is not an allowed CCV" requiredCCVs (Some optionalCCVs) @@ -133,13 +164,13 @@ template ExecutingMessageV1 -- Record the pool's inbound CCV requirements. Only exercisable by ccipOwner and the pool owner itself. -- ccipOwner authorizes through TAR's signatory context when pool calls SetInboundPoolCCVs. -- We don't validate the the poolOwner is the actual owner of the pool since this will have already been checked by TAR's SetInboundPoolCCVs. - -- The pool's signatory is later used to create the TokenReceiveTicket, which the pool is expected to validate before releasing tokens, + -- The pool's signatory is later used to create the TokenReceiveTicket, which the pool is expected to validate before releasing tokens, -- so an invalid poolOwner would also lead to the pool's check to fail. - choice SetInboundPoolCCVs : ContractId ExecutingMessageV1 + choice SetInboundPoolCCVs : ContractId ExecutingMessage with poolInstanceId : Text poolOwner : Party - poolCCVs : [RawInstanceAddress] + poolCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] controller ccipOwner, poolOwner do assertMsg "executingMessage: SetInboundPoolCCVs only allowed while pool CCVs are required" @@ -147,17 +178,17 @@ template ExecutingMessageV1 assertMsg "executingMessage: inbound pool verification only valid for token transfers" (isSome tokenReceiver) assertMsg "SetInboundPoolCCVs: already set" (isNone inboundPoolVerification) - CCIP.Internal.assertMaxCCVListLength "executingMessage: inbound pool CCVs" poolCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "executingMessage: inbound pool CCVs" poolCCVs assertMsg "SetInboundPoolCCVs: duplicate CCVs not allowed" (unique poolCCVs) let (mergedRequiredCCVs, mergedOptionalCCVs, mergedOptionalCCVThreshold) = - CCIP.Internal.mergeInboundPoolCCVs + CCIP.CodecV1.CCVCodec.mergeInboundPoolCCVs sourceDefaultCCVs requiredCCVs optionalCCVs optionalCCVThreshold poolCCVs - CCIP.Internal.assertMaxCCVListLength "executingMessage: resolved required CCVs" mergedRequiredCCVs - CCIP.Internal.assertMaxCCVListLength "executingMessage: resolved optional CCVs" mergedOptionalCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "executingMessage: resolved required CCVs" mergedRequiredCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "executingMessage: resolved optional CCVs" mergedOptionalCCVs create this with requiredCCVs = mergedRequiredCCVs optionalCCVs = mergedOptionalCCVs @@ -174,7 +205,7 @@ template ExecutingMessageV1 choice FinalizeExecute : FinalizeExecuteResult with tokenAdminRegistryInstanceId : Text - maybePoolAddress : Optional RawInstanceAddress + maybePoolAddress : Optional Chainlink.InstanceAddress.RawInstanceAddress maybeTicketReceiver : Optional Party maybeTokenReceiver : Optional Party maybeInstrumentId : Optional Splice.Api.Token.HoldingV1.InstrumentId @@ -194,21 +225,21 @@ template ExecutingMessageV1 Some verification -> pure verification None -> abort "executingMessage: missing inbound pool CCVs for token ticket" assertMsg "executingMessage: inbound pool address mismatch" - (poolAddress == RawInstanceAddress.make poolVerification.poolInstanceId poolVerification.poolOwner) - CCIP.Internal.assertMaxCCVListLength "executingMessage: inbound pool CCVs" poolVerification.poolCCVs - let resolvedInboundPoolCCVs = dedup (CCIP.Internal.resolveRequiredCCVsWithDefaults + (poolAddress == Chainlink.InstanceAddress.make poolVerification.poolInstanceId poolVerification.poolOwner) + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "executingMessage: inbound pool CCVs" poolVerification.poolCCVs + let resolvedInboundPoolCCVs = dedup (CCIP.CodecV1.CCVCodec.resolveRequiredCCVsWithDefaults sourceDefaultCCVs poolVerification.poolCCVs) - CCIP.Internal.assertMaxCCVListLength "executingMessage: resolved inbound pool CCVs" resolvedInboundPoolCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "executingMessage: resolved inbound pool CCVs" resolvedInboundPoolCCVs sourcePoolData <- case message.tokenTransfer of Some tokenTransfer -> pure tokenTransfer.extraData None -> abort "executingMessage: missing token transfer for ticket" - let poolOwner = RawInstanceAddress.ownerParty poolAddress - ticketCid <- create CCIP.Tickets.TokenReceiveTicket with + let poolOwner = Chainlink.InstanceAddress.ownerParty poolAddress + ticketCid <- create CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = ccvOwners verifiedCCVs = dedup (map - (\verification -> RawInstanceAddress.make verification.ccvInstanceId verification.ccvOwner) + (\verification -> Chainlink.InstanceAddress.make verification.ccvInstanceId verification.ccvOwner) ccvVerifications) requiredInboundPoolCCVs = resolvedInboundPoolCCVs tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId @@ -222,20 +253,21 @@ template ExecutingMessageV1 messageId = messageId sourceChainSelector = message.sourceChainSelector finality = message.finality.requested + context = Splice.Api.Token.MetadataV1.emptyChoiceContext pure (Some ticketCid) (None, None, None, None, None) -> pure None _ -> abort "executingMessage: inconsistent finalize parameters" - eventCid <- create CCIP.Events.ExecutionStateChanged with + eventCid <- create CCIP.EventsV1.Events.ExecutionStateChanged with ccipOwner = ccipOwner ccvOwners = ccvOwners receiver = receiver - event = CCIP.Events.ExecutionStateChangedEvent with + event = CCIP.EventsV1.Events.ExecutionStateChangedEvent with sourceChainSelector = message.sourceChainSelector sequenceNumber = message.sequenceNumber messageId = messageId - state = CCIP.Internal.SUCCESS + state = CCIP.APIV1.ExecutingMessage.SUCCESS returnData = returnData pure FinalizeExecuteResult with tokenReceiveTicket = tokenReceiveTicket @@ -243,6 +275,6 @@ template ExecutingMessageV1 data FinalizeExecuteResult = FinalizeExecuteResult with - tokenReceiveTicket : Optional (ContractId CCIP.Tickets.TokenReceiveTicket) - executionStateChanged : ContractId CCIP.Events.ExecutionStateChanged - deriving (Eq, Show) + tokenReceiveTicket : Optional (ContractId CCIP.TicketsV1.TokenReceiveTicket) + executionStateChanged : ContractId CCIP.EventsV1.Events.ExecutionStateChanged + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/FeeQuoter.daml b/contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoter.daml similarity index 75% rename from contracts/ccip/core/daml/CCIP/FeeQuoter.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoter.daml index 3652a6166..2e248f448 100644 --- a/contracts/ccip/core/daml/CCIP/FeeQuoter.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoter.daml @@ -1,7 +1,7 @@ -module CCIP.FeeQuoter( - module CCIP.FeeQuoter, - module CCIP.FeeQuoterTypes - ) where +module CCIP.CoreV1.FeeQuoter( + module CCIP.CoreV1.FeeQuoter, + module CCIP.CoreV1.FeeQuoterTypes +) where import DA.Crypto.Text (byteCount) import DA.Foldable qualified as Foldable @@ -10,23 +10,25 @@ import DA.Map qualified as Map import DA.Optional import DA.Set qualified as Set -import Splice.Api.Token.HoldingV1 -import Splice.Api.Token.MetadataV1 (ChoiceContext) +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress -import qualified CCIP.Context -import CCIP.Math qualified -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import Chainlink.InstanceAddress (assertValidInstanceId) -import qualified CCIP.SendingMessageV1 import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) import MCMS.Codec (decodePartyList) -import CCIP.FeeQuoterCodecGen ( + +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.CodecV1.Math +import qualified CCIP.CoreV1.SendingMessage + +import CCIP.CoreV1.FeeQuoterCodecGen ( decodeApplyPriceUpdatersUpdateParamsAt, decodeUpdatePricesParamsAt, decodeRemoveFeeTokensParamsAt, decodeApplyFeeQuoterDestChainConfigUpdatesParamsAt, ) -import CCIP.FeeQuoterTypes ( +import CCIP.CoreV1.FeeQuoterTypes ( FeeQuoterDestChainConfigArgs(..), FeeQuoterDestChainConfig(..), PriceUpdates(..), @@ -38,23 +40,18 @@ import CCIP.FeeQuoterTypes ( ApplyFeeQuoterDestChainConfigUpdatesParams(..), ) -feeQuoterKey : Text -feeQuoterKey = "fee-quoter" -lookupFeeQuoterCid : ChoiceContext -> Update (ContractId FeeQuoter) -lookupFeeQuoterCid ctx = CCIP.Context.getFromContextU ctx feeQuoterKey - -rawInstanceAddress : FeeQuoter -> RawInstanceAddress.RawInstanceAddress -rawInstanceAddress feeQuoter = RawInstanceAddress.make feeQuoter.instanceId feeQuoter.owner +rawInstanceAddress : FeeQuoter -> Chainlink.InstanceAddress.RawInstanceAddress +rawInstanceAddress feeQuoter = Chainlink.InstanceAddress.make feeQuoter.instanceId feeQuoter.ccipOwner gasCostUsdCents : Decimal -> Int -> Numeric 0 gasCostUsdCents usdPerUnitGas gasUnits = - CCIP.SendingMessageV1.gasCostUsdCents usdPerUnitGas gasUnits + CCIP.CoreV1.SendingMessage.gasCostUsdCents usdPerUnitGas gasUnits template FeeQuoter with instanceId : Text - owner : Party + ccipOwner : Party -- | Set of fee tokens that can be used to pay for fees. feeTokens : Set.Set Splice.Api.Token.HoldingV1.InstrumentId @@ -68,9 +65,69 @@ template FeeQuoter -- | List of parties that are authorized to update prices, they'll be observers on the contract. priceUpdaters : [Party] where - signatory owner + signatory ccipOwner observer priceUpdaters - ensure assertValidInstanceId instanceId && unique priceUpdaters + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && unique priceUpdaters + + interface instance CCIP.APIV1.FeeQuoter.IFeeQuoter for FeeQuoter where + view = CCIP.APIV1.FeeQuoter.FeeQuoterView with + ccipOwner = ccipOwner + instanceId = instanceId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + feeQuoter_publicFetchImpl self arg = do + Chainlink.InstanceAddress.assertEqual "FeeQuoter: expected address mismatch" instanceId ccipOwner arg.expectedAddress + pure CCIP.APIV1.FeeQuoter.FeeQuoterView with + ccipOwner = ccipOwner + instanceId = instanceId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + feeQuoter_getTokenPriceImpl self arg = do + price <- exercise (fromInterfaceContractId @FeeQuoter self) GetTokenPrice with + token = arg.token + context = arg.context + caller = arg.caller + pure CCIP.APIV1.FeeQuoter.TimestampedPrice with + price = price.price + timestamp = price.timestamp + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + feeQuoter_getDestinationChainGasPriceImpl self arg = do + price <- exercise (fromInterfaceContractId @FeeQuoter self) GetDestinationChainGasPrice with + destChainSelector = arg.destChainSelector + context = arg.context + caller = arg.caller + pure CCIP.APIV1.FeeQuoter.TimestampedPrice with + price = price.price + timestamp = price.timestamp + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + feeQuoter_getTokenTransferFeeImpl self arg = do + exercise (fromInterfaceContractId @FeeQuoter self) GetTokenTransferFee with + destChainSelector = arg.destChainSelector + token = arg.token + context = arg.context + caller = arg.caller + + feeQuoter_quoteGasForExecImpl self arg = do + result <- exercise (fromInterfaceContractId @FeeQuoter self) QuoteGasForExec with + destChainSelector = arg.destChainSelector + nonCalldataGas = arg.nonCalldataGas + calldataSize = arg.calldataSize + feeToken = arg.feeToken + context = arg.context + caller = arg.caller + pure CCIP.APIV1.FeeQuoter.QuoteGasForExecResult with + totalGas = result.totalGas + gasCostUSDCents = result.gasCostUSDCents + feeTokenPrice = result.feeTokenPrice + premiumMultiplier = result.premiumMultiplier + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + feeQuoter_getFeeTokensImpl self arg = do + exercise (fromInterfaceContractId @FeeQuoter self) GetFeeTokens with + context = arg.context + caller = arg.caller nonconsuming choice Get : FeeQuoter with @@ -85,16 +142,18 @@ template FeeQuoter -- | Get the `tokenPrice` for a given token. nonconsuming choice GetTokenPrice : TimestampedPrice with - instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + token : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do - return (fromSomeNote ("No price found for " <> instrumentId.id) (Map.lookup instrumentId usdPerToken)) + return (fromSomeNote ("No price found for " <> token.id) (Map.lookup token usdPerToken)) -- | Get the gas price for a given destination chain. nonconsuming choice GetDestinationChainGasPrice : TimestampedPrice with destChainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -107,34 +166,34 @@ template FeeQuoter -- addedPriceUpdaters: list of parties to add to the list of authorized price updaters -- removedPriceUpdaters: list of parties to remove from the list of authorized price updaters -- - -- Only callable by the owner. + -- Only callable by the ccipOwner. choice ApplyPriceUpdatersUpdate : ContractId FeeQuoter with addedPriceUpdaters : [Party] removedPriceUpdaters : [Party] - controller owner + controller ccipOwner do let newPriceUpdaters = - filter (/= owner) (dedup ((priceUpdaters \\ removedPriceUpdaters) ++ addedPriceUpdaters)) + filter (/= ccipOwner) (dedup ((priceUpdaters \\ removedPriceUpdaters) ++ addedPriceUpdaters)) create this with priceUpdaters = newPriceUpdaters -- Update the price for given tokens and gas prices for given chains. -- -- Params: -- priceUpdates: The price updates to apply. - -- caller: Listed price updater, or the contract owner (owner need not appear in priceUpdaters). + -- caller: Listed price updater, or the contract ccipOwner (ccipOwner need not appear in priceUpdaters). -- - -- Callable when caller is in priceUpdaters or caller is owner. + -- Callable when caller is in priceUpdaters or caller is ccipOwner. choice UpdatePrices : ContractId FeeQuoter with priceUpdates : PriceUpdates caller : Party controller caller do - -- The caller must be an authorized price updater or the owner. + -- The caller must be an authorized price updater or the ccipOwner. assertMsg - ("Caller is not an authorized price updater or owner: " <> show caller) - (caller `elem` priceUpdaters || caller == owner) + ("Caller is not an authorized price updater or ccipOwner: " <> show caller) + (caller `elem` priceUpdaters || caller == ccipOwner) -- Validate price bounds Foldable.mapA_ (\tpu -> @@ -160,17 +219,17 @@ template FeeQuoter choice AddPriceUpdaters : ContractId FeeQuoter with parties : [Party] - controller owner + controller ccipOwner do create this with priceUpdaters = - filter (/= owner) + filter (/= ccipOwner) (dedup (priceUpdaters ++ parties)) choice RemovePriceUpdaters : ContractId FeeQuoter with parties : [Party] - controller owner + controller ccipOwner do create this with priceUpdaters = filter (`notElem` parties) priceUpdaters @@ -183,6 +242,7 @@ template FeeQuoter with destChainSelector : Numeric 0 token : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -214,6 +274,7 @@ template FeeQuoter nonCalldataGas : Int calldataSize : Int feeToken : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -232,17 +293,19 @@ template FeeQuoter (Set.member feeToken feeTokens) gasPrice <- exercise self GetDestinationChainGasPrice with - destChainSelector - caller + destChainSelector = destChainSelector + context = context + caller = caller feeTokenPrice <- exercise self GetTokenPrice with - instrumentId = feeToken - caller + token = feeToken + context = context + caller = caller -- LINK gets a discounted multiplier (e.g. 90% → 9e9 in E10); other tokens get -- premiumIdentity (1e10 = 100%). let premiumMultiplier = if feeToken == linkTokenInstrumentId - then CCIP.Math.numeric0ToDecimal (destChainConfig.linkFeeMultiplierPercent * CCIP.Math.e10PerPercent) - else CCIP.Math.numeric0ToDecimal CCIP.Math.premiumIdentity + then CCIP.CodecV1.Math.numeric0ToDecimal (destChainConfig.linkFeeMultiplierPercent * CCIP.CodecV1.Math.e10PerPercent) + else CCIP.CodecV1.Math.numeric0ToDecimal CCIP.CodecV1.Math.premiumIdentity let gasCostUSDCents = gasCostUsdCents gasPrice.price totalGas pure QuoteGasForExecResult with @@ -258,6 +321,7 @@ template FeeQuoter -- | Get the list of supported fee tokens. nonconsuming choice GetFeeTokens : [Splice.Api.Token.HoldingV1.InstrumentId] with + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -266,7 +330,7 @@ template FeeQuoter choice RemoveFeeTokens : ContractId FeeQuoter with feeTokensToRemove : [Splice.Api.Token.HoldingV1.InstrumentId] - controller owner + controller ccipOwner do let newFeeTokens = foldl (\acc tk -> Set.delete tk acc) feeTokens feeTokensToRemove let newUsdPerToken = foldl (\acc tk -> Map.delete tk acc) usdPerToken feeTokensToRemove @@ -289,7 +353,7 @@ template FeeQuoter choice ApplyFeeQuoterDestChainConfigUpdates : ContractId FeeQuoter with destChainConfigArgs : [FeeQuoterDestChainConfigArgs] - controller owner + controller ccipOwner do -- destChainSelector must be greater than zero -- defaultTxGasLimit must be set, must be less than maxPerMsgGasLimit @@ -305,11 +369,11 @@ template FeeQuoter interface instance MCMSReceiver for FeeQuoter where view = MCMSReceiverView with - mcmsController = owner + mcmsController = ccipOwner instanceId mcmsEntrypoint functionName operationData contractIds = do - let instAddr = instanceId <> "@" <> partyToText owner + let instAddr = instanceId <> "@" <> partyToText ccipOwner selfCid <- case Map.lookup instAddr contractIds of None -> abort $ "E_SELF_CID_NOT_IN_MAP: " <> instAddr Some cid -> pure (coerceContractId cid : ContractId FeeQuoter) @@ -387,4 +451,4 @@ data QuoteGasForExecResult = QuoteGasForExecResult gasCostUSDCents : Numeric 0 feeTokenPrice : Decimal premiumMultiplier : Decimal - deriving (Eq, Show) + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/FeeQuoterCodecGen.daml b/contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoterCodecGen.daml similarity index 94% rename from contracts/ccip/core/daml/CCIP/FeeQuoterCodecGen.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoterCodecGen.daml index 235a7e5ff..fc1e7e674 100644 --- a/contracts/ccip/core/daml/CCIP/FeeQuoterCodecGen.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoterCodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.FeeQuoterCodecGen where +module CCIP.CoreV1.FeeQuoterCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.FeeQuoterTypes (PriceUpdates(..), TokenPriceUpdate(..), GasPriceUpdate(..), FeeQuoterDestChainConfigArgs(..), FeeQuoterDestChainConfig(..), ApplyPriceUpdatersUpdateParams(..), UpdatePricesParams(..), RemoveFeeTokensParams(..), ApplyFeeQuoterDestChainConfigUpdatesParams(..)) +import CCIP.CoreV1.FeeQuoterTypes (PriceUpdates(..), TokenPriceUpdate(..), GasPriceUpdate(..), FeeQuoterDestChainConfigArgs(..), FeeQuoterDestChainConfig(..), ApplyPriceUpdatersUpdateParams(..), UpdatePricesParams(..), RemoveFeeTokensParams(..), ApplyFeeQuoterDestChainConfigUpdatesParams(..)) import MCMS.Codec ( decodeBoolAt, @@ -23,7 +23,7 @@ import MCMS.Codec ( encodePartyList ) -import CCIP.Codec (decodeInstrumentId, encodeInstrumentId) +import CCIP.CodecV1 (decodeInstrumentId, encodeInstrumentId) -- =============================================== diff --git a/contracts/ccip/core/daml/CCIP/FeeQuoterTypes.daml b/contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoterTypes.daml similarity index 98% rename from contracts/ccip/core/daml/CCIP/FeeQuoterTypes.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoterTypes.daml index d26911da0..a19de8dd7 100644 --- a/contracts/ccip/core/daml/CCIP/FeeQuoterTypes.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/FeeQuoterTypes.daml @@ -1,5 +1,5 @@ -- | Types for FeeQuoter, extracted to avoid circular dependencies -module CCIP.FeeQuoterTypes where +module CCIP.CoreV1.FeeQuoterTypes where import Splice.Api.Token.HoldingV1 @@ -75,4 +75,4 @@ data RemoveFeeTokensParams = RemoveFeeTokensParams data ApplyFeeQuoterDestChainConfigUpdatesParams = ApplyFeeQuoterDestChainConfigUpdatesParams with destChainConfigArgs : [FeeQuoterDestChainConfigArgs] - deriving (Eq, Show) + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/GlobalConfig.daml b/contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfig.daml similarity index 70% rename from contracts/ccip/core/daml/CCIP/GlobalConfig.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfig.daml index a39661ea3..63903b325 100644 --- a/contracts/ccip/core/daml/CCIP/GlobalConfig.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfig.daml @@ -1,17 +1,23 @@ -- | Global configuration for CCIP, shared across all PerPartyRouters. -module CCIP.GlobalConfig - ( module CCIP.GlobalConfig - , module CCIP.GlobalConfigTypes - ) where +module CCIP.CoreV1.GlobalConfig( + module CCIP.CoreV1.GlobalConfig, + module CCIP.CoreV1.GlobalConfigTypes +) where import DA.Crypto.Text (byteCount) import DA.Foldable (forA_) import DA.Map qualified as Map -import Splice.Api.Token.MetadataV1 (ChoiceContext) +import qualified Splice.Api.Token.MetadataV1 -import qualified CCIP.Context -import CCIP.GlobalConfigTypes ( +import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) +import MCMS.Crypto (assertValidHex) + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.GlobalConfig + +import CCIP.CoreV1.GlobalConfigTypes ( DestChainConfig(..), DestChainConfigArgs(..), SourceChainConfig(..), @@ -20,11 +26,7 @@ import CCIP.GlobalConfigTypes ( ApplySourceChainConfigUpdatesParams(..), validateDefaultAndMandatedCCVs, ) -import CCIP.GlobalConfigCodecGen (decodeApplyDestChainConfigUpdatesParamsAt, decodeApplySourceChainConfigUpdatesParamsAt) -import Chainlink.InstanceAddress (assertValidInstanceId) - -import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import MCMS.Crypto (assertValidHex) +import CCIP.CoreV1.GlobalConfigCodecGen (decodeApplyDestChainConfigUpdatesParamsAt, decodeApplySourceChainConfigUpdatesParamsAt) template GlobalConfig with @@ -38,11 +40,56 @@ template GlobalConfig where signatory ccipOwner - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && chainSelector > 0.0 -- Local chain selector must be greater than zero && all (\destChainSelector -> destChainSelector > 0.0 && destChainSelector /= chainSelector) (Map.keys destChainConfigs) -- All destination chain selectors must be greater than zero and not equal to the local chain selector && all (\sourceChainSelector -> sourceChainSelector > 0.0 && sourceChainSelector /= chainSelector) (Map.keys sourceChainConfigs) -- All source chain selectors must be greater than zero and not equal to the local chain selector + interface instance CCIP.APIV1.GlobalConfig.IGlobalConfig for GlobalConfig where + view = CCIP.APIV1.GlobalConfig.GlobalConfigView with + ccipOwner = ccipOwner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Return an empty context for now; can be extended in the future if needed + + globalConfig_publicFetchImpl self arg = do + Chainlink.InstanceAddress.assertEqual "GlobalConfig: expectedAddress mismatch" instanceId ccipOwner arg.expectedAddress + pure CCIP.APIV1.GlobalConfig.GlobalConfigView with + ccipOwner = ccipOwner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Return an empty context for now; can be extended in the future if needed + + globalConfig_getDestChainConfigImpl self arg = do + config <- exercise (fromInterfaceContractId @GlobalConfig self) GetDestChainConfig with + destChainSelector = arg.destChainSelector + caller = arg.caller + case config of + None -> pure None + Some destChainConfig -> pure (Some CCIP.APIV1.GlobalConfig.DestChainConfig with + isEnabled = destChainConfig.isEnabled + addressBytesLength = destChainConfig.addressBytesLength + tokenReceiverAllowed = destChainConfig.tokenReceiverAllowed + baseExecutionGasCost = destChainConfig.baseExecutionGasCost + offRampAddress = destChainConfig.offRampAddress + defaultExecutor = destChainConfig.defaultExecutor + laneMandatedCCVs = destChainConfig.laneMandatedCCVs + defaultCCVs = destChainConfig.defaultCCVs + messageNetworkFeeUSDCents = destChainConfig.messageNetworkFeeUSDCents + tokenNetworkFeeUSDCents = destChainConfig.tokenNetworkFeeUSDCents + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Return an empty context for now; can be extended in the future if needed + ) + + globalConfig_getSourceChainConfigImpl self arg = do + config <- exercise (fromInterfaceContractId @GlobalConfig self) GetSourceChainConfig with + sourceChainSelector = arg.sourceChainSelector + caller = arg.caller + case config of + None -> pure None + Some sourceChainConfig -> pure (Some CCIP.APIV1.GlobalConfig.SourceChainConfig with + isEnabled = sourceChainConfig.isEnabled + onRampAddresses = sourceChainConfig.onRampAddresses + defaultCCVs = sourceChainConfig.defaultCCVs + laneMandatedCCVs = sourceChainConfig.laneMandatedCCVs + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Return an empty context for now; can be extended in the future if needed + ) + nonconsuming choice GetDestChainConfig : Optional DestChainConfig with destChainSelector : Numeric 0 @@ -147,10 +194,4 @@ template GlobalConfig newCid <- exercise selfCid ApplySourceChainConfigUpdates with sourceChainConfigUpdates = sourceChainConfigArgs pure (Map.insert instAddr (coerceContractId newCid) contractIds) - _ -> abort $ "E_UNKNOWN_FUNCTION: " <> functionName - -globalConfigKey : Text -globalConfigKey = "global-config" - -lookupGlobalConfigCid : ChoiceContext -> Update (ContractId GlobalConfig) -lookupGlobalConfigCid ctx = CCIP.Context.getFromContextU ctx globalConfigKey + _ -> abort $ "E_UNKNOWN_FUNCTION: " <> functionName \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/GlobalConfigCodecGen.daml b/contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfigCodecGen.daml similarity index 94% rename from contracts/ccip/core/daml/CCIP/GlobalConfigCodecGen.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfigCodecGen.daml index 89a736e5d..179811238 100644 --- a/contracts/ccip/core/daml/CCIP/GlobalConfigCodecGen.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfigCodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.GlobalConfigCodecGen where +module CCIP.CoreV1.GlobalConfigCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.GlobalConfigTypes (DestChainConfigArgs(..), DestChainConfig(..), SourceChainConfigArgs(..), SourceChainConfig(..), ApplyDestChainConfigUpdatesParams(..), ApplySourceChainConfigUpdatesParams(..)) +import CCIP.CoreV1.GlobalConfigTypes (DestChainConfigArgs(..), DestChainConfig(..), SourceChainConfigArgs(..), SourceChainConfig(..), ApplyDestChainConfigUpdatesParams(..), ApplySourceChainConfigUpdatesParams(..)) import MCMS.Codec ( decodeBoolAt, @@ -23,7 +23,7 @@ import MCMS.Codec ( encodeOptional ) -import CCIP.Codec (decodeRawInstanceAddressAt, decodeRawInstanceAddressList, encodeRawInstanceAddress, encodeRawInstanceAddressList) +import CCIP.CodecV1 (decodeRawInstanceAddressAt, decodeRawInstanceAddressList, encodeRawInstanceAddress, encodeRawInstanceAddressList) -- =============================================== diff --git a/contracts/ccip/core/daml/CCIP/GlobalConfigTypes.daml b/contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfigTypes.daml similarity index 99% rename from contracts/ccip/core/daml/CCIP/GlobalConfigTypes.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfigTypes.daml index cb4e526ec..244046d47 100644 --- a/contracts/ccip/core/daml/CCIP/GlobalConfigTypes.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/GlobalConfigTypes.daml @@ -1,5 +1,5 @@ -- | Types for GlobalConfig, extracted to avoid circular dependencies -module CCIP.GlobalConfigTypes where +module CCIP.CoreV1.GlobalConfigTypes where import DA.Crypto.Text (BytesHex) import DA.List qualified as List @@ -111,4 +111,4 @@ data ApplyDestChainConfigUpdatesParams = ApplyDestChainConfigUpdatesParams data ApplySourceChainConfigUpdatesParams = ApplySourceChainConfigUpdatesParams with sourceChainConfigArgs : [SourceChainConfigArgs] - deriving (Eq, Show) + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/RMNRemote.daml b/contracts/ccip/core/daml/CCIP/CoreV1/RMNRemote.daml similarity index 85% rename from contracts/ccip/core/daml/CCIP/RMNRemote.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/RMNRemote.daml index edf7906a6..b183ebbe0 100644 --- a/contracts/ccip/core/daml/CCIP/RMNRemote.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/RMNRemote.daml @@ -1,6 +1,9 @@ -- | RMN (Risk Management Network) for Canton CCIP. -- Provides emergency stop capability via curse mechanism matching EVM RMNRemote.sol. -module CCIP.RMNRemote where +module CCIP.CoreV1.RMNRemote ( + module CCIP.CoreV1.RMNRemote, + module CCIP.CoreV1.RMNRemoteTypes, +) where import DA.Crypto.Text (BytesHex, byteCount) import DA.Foldable qualified as Foldable @@ -8,10 +11,16 @@ import DA.List (dedup) import DA.Map qualified as Map import DA.Optional (fromSomeNote) -import CCIP.NumericHex qualified as NumericHex -import Chainlink.InstanceAddress (assertValidInstanceId) +import qualified Splice.Api.Token.MetadataV1 + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import CCIP.RMNRemoteCodecGen ( + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.CodecV1.NumericHex + +import CCIP.CoreV1.RMNRemoteCodecGen ( decodeCurseParamsAt, decodeUncurseParamsAt, decodeCurseChainParamsAt, @@ -21,7 +30,7 @@ import CCIP.RMNRemoteCodecGen ( decodeAddCustomObserversParamsAt, decodeRemoveCustomObserversParamsAt, ) -import CCIP.RMNRemoteTypes ( +import CCIP.CoreV1.RMNRemoteTypes ( CurseParams(..), UncurseParams(..), CurseChainParams(..), @@ -41,8 +50,8 @@ chainSelectorToSubject : Numeric 0 -> BytesHex chainSelectorToSubject chainSelector = let subject = fromSomeNote "RMNRemote: invalid chain selector" - (NumericHex.encodeUint64 chainSelector) - in NumericHex.padLeft 32 "0" subject + (CCIP.CodecV1.NumericHex.encodeUint64 chainSelector) + in CCIP.CodecV1.NumericHex.padLeft 32 "0" subject mergeCustomObservers : Party -> Party -> [Party] -> [Party] -> [Party] mergeCustomObservers rmnOwner ccipOwner current additions = @@ -52,6 +61,7 @@ removeCustomObservers : [Party] -> [Party] -> [Party] removeCustomObservers current removals = filter (`notElem` removals) current + -- | RMN contract providing curse capability for emergency stops. -- Separate rmnOwner party allows independent control from ccipOwner. template RMNRemote @@ -64,17 +74,44 @@ template RMNRemote where signatory rmnOwner observer ccipOwner, customObservers - ensure assertValidInstanceId instanceId - - nonconsuming choice Get : RMNRemote - with - caller : Party - controller caller - do pure this - - -- Check if globally cursed (party-as-parameter pattern for open access) + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId + + interface instance CCIP.APIV1.RMNRemote.IRMNRemote for RMNRemote where + view = CCIP.APIV1.RMNRemote.RMNRemoteView with + ccipOwner + rmnOwner + instanceId + + rmnRemote_publicFetchImpl self arg = do + Chainlink.InstanceAddress.assertEqual "RMNRemote: expectedAddress mismatch" instanceId rmnOwner arg.expectedAddress + pure CCIP.APIV1.RMNRemote.RMNRemoteView with + ccipOwner + rmnOwner + instanceId + + rmnRemote_isCursedImpl self arg = do + exercise (fromInterfaceContractId @RMNRemote self) IsCursed + with + context = arg.context + caller = arg.caller + + rmnRemote_isCursedForChainImpl self arg = do + exercise (fromInterfaceContractId @RMNRemote self) IsCursedForChain + with + chainSelector = arg.chainSelector + context = arg.context + caller = arg.caller + + rmnRemote_getCursedSubjectsImpl self arg = do + exercise (fromInterfaceContractId @RMNRemote self) GetCursedSubjects + with + context = arg.context + caller = arg.caller + + -- Check if globally cursed nonconsuming choice IsCursed : Bool with + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do pure (globalCurseSubject `elem` cursedSubjects) @@ -82,8 +119,9 @@ template RMNRemote -- Check if cursed for specific chain (global OR chain-specific) nonconsuming choice IsCursedForChain : Bool with - caller : Party chainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party controller caller do let chainSubject = chainSelectorToSubject chainSelector @@ -97,6 +135,7 @@ template RMNRemote -- Get all cursed subjects nonconsuming choice GetCursedSubjects : [BytesHex] with + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do pure cursedSubjects @@ -293,4 +332,4 @@ template RMNRemote newCid <- exercise selfCid RemoveCustomObservers with parties pure (Map.insert instAddr (coerceContractId newCid) contractIds) - _ -> abort $ "E_UNKNOWN_FUNCTION: " <> functionName + _ -> abort $ "E_UNKNOWN_FUNCTION: " <> functionName \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/RMNRemoteCodecGen.daml b/contracts/ccip/core/daml/CCIP/CoreV1/RMNRemoteCodecGen.daml similarity index 94% rename from contracts/ccip/core/daml/CCIP/RMNRemoteCodecGen.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/RMNRemoteCodecGen.daml index 9ed28793d..a0e75bc86 100644 --- a/contracts/ccip/core/daml/CCIP/RMNRemoteCodecGen.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/RMNRemoteCodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.RMNRemoteCodecGen where +module CCIP.CoreV1.RMNRemoteCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.RMNRemoteTypes (CurseParams(..), UncurseParams(..), CurseChainParams(..), UncurseChainParams(..), CurseMultipleParams(..), UncurseMultipleParams(..), AddCustomObserversParams(..), RemoveCustomObserversParams(..)) +import CCIP.CoreV1.RMNRemoteTypes (CurseParams(..), UncurseParams(..), CurseChainParams(..), UncurseChainParams(..), CurseMultipleParams(..), UncurseMultipleParams(..), AddCustomObserversParams(..), RemoveCustomObserversParams(..)) import MCMS.Codec ( decodeBytesHexAt, diff --git a/contracts/ccip/core/daml/CCIP/RMNRemoteTypes.daml b/contracts/ccip/core/daml/CCIP/CoreV1/RMNRemoteTypes.daml similarity index 96% rename from contracts/ccip/core/daml/CCIP/RMNRemoteTypes.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/RMNRemoteTypes.daml index 16c9c1ced..461f3f62d 100644 --- a/contracts/ccip/core/daml/CCIP/RMNRemoteTypes.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/RMNRemoteTypes.daml @@ -1,6 +1,6 @@ -- | Types module for RMNRemote MCMS parameters -- Separate module to enable auto-generated codec via go-daml -module CCIP.RMNRemoteTypes where +module CCIP.CoreV1.RMNRemoteTypes where import DA.Crypto.Text (BytesHex) @@ -54,4 +54,4 @@ data AddCustomObserversParams = AddCustomObserversParams data RemoveCustomObserversParams = RemoveCustomObserversParams with parties : [Party] - deriving (Eq, Show) + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/SendingMessageV1.daml b/contracts/ccip/core/daml/CCIP/CoreV1/SendingMessage.daml similarity index 75% rename from contracts/ccip/core/daml/CCIP/SendingMessageV1.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/SendingMessage.daml index a5344173f..fdf008487 100644 --- a/contracts/ccip/core/daml/CCIP/SendingMessageV1.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/SendingMessage.daml @@ -3,7 +3,7 @@ -- choice consumes the old contract and creates a new one with appended data. -- The ccipOwner signatory is inherited from the consumed contract, so any -- caller can trigger the mutation. -module CCIP.SendingMessageV1 where +module CCIP.CoreV1.SendingMessage where import DA.Crypto.Text (BytesHex, byteCount, keccak256) import DA.Foldable qualified as Foldable @@ -11,17 +11,20 @@ import DA.List (dedup, unique) import DA.Optional (isNone, isSome, fromSome, fromOptional) import DA.Text qualified as Text -import qualified CCIP.Events -import qualified CCIP.FinalityConfig -import qualified CCIP.Internal -import qualified CCIP.Math -import qualified CCIP.MessageCodecV1 -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.Tickets - import MCMS.Crypto (isValidHex) import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.Math +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.EventsV1.Events +import qualified CCIP.EventsV1.Receipts data CCVFee = CCVFee with @@ -75,12 +78,12 @@ data ExecutionMode data SendingMessageDeps = SendingMessageDeps with - router : RawInstanceAddress.RawInstanceAddress - onRamp : RawInstanceAddress.RawInstanceAddress - globalConfig : RawInstanceAddress.RawInstanceAddress - rmnRemote : RawInstanceAddress.RawInstanceAddress - tokenAdminRegistry : RawInstanceAddress.RawInstanceAddress - feeQuoter : RawInstanceAddress.RawInstanceAddress + router : Chainlink.InstanceAddress.RawInstanceAddress + onRamp : Chainlink.InstanceAddress.RawInstanceAddress + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) data SendingMessageState @@ -124,7 +127,7 @@ validateDestChainAddress address addressBytesLength = -- EVM FeeQuoter.sol line 333: (totalGas * price + (1e16 - 1)) / 1e16. gasCostUsdCents : Decimal -> Int -> Numeric 0 gasCostUsdCents usdPerUnitGas gasUnits = - CCIP.Math.mulDivUp (intToNumeric gasUnits) (CCIP.Math.decimalToNumeric0 usdPerUnitGas) CCIP.Math.usdPerUsdCent + CCIP.CodecV1.Math.mulDivUp (intToNumeric gasUnits) (CCIP.CodecV1.Math.decimalToNumeric0 usdPerUnitGas) CCIP.CodecV1.Math.usdPerUsdCent sumExecutionGasLimit : [CCVFee] -> Optional TokenSendFee -> Int -> Int sumExecutionGasLimit ccvFees tokenSendFee executorDestGasLimit = @@ -138,46 +141,46 @@ sumExecutionGasLimit ccvFees tokenSendFee executorDestGasLimit = assertCCVInstanceId : Text - -> [RawInstanceAddress.RawInstanceAddress] - -> Optional [RawInstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] + -> Optional [Chainlink.InstanceAddress.RawInstanceAddress] -> Text -> Party -> Update () assertCCVInstanceId msg requiredCCVs outboundPoolCCVs ccvInstanceId caller = - let claimed = RawInstanceAddress.make ccvInstanceId caller + let claimed = Chainlink.InstanceAddress.make ccvInstanceId caller allowedCCVs = dedup (requiredCCVs ++ fromOptional [] outboundPoolCCVs) in assertMsg msg (claimed `elem` allowedCCVs) buildMessageArtifacts - : SendingMessageV1 - -> ([RawInstanceAddress.RawInstanceAddress], BytesHex, CCIP.MessageCodecV1.MessageV1, BytesHex, BytesHex) + : SendingMessage + -> ([Chainlink.InstanceAddress.RawInstanceAddress], BytesHex, CCIP.CodecV1.MessageCodecV1.MessageV1, BytesHex, BytesHex) buildMessageArtifacts sm = let allCCVs = dedup (sm.requiredCCVs ++ fromOptional [] sm.outboundPoolCCVs) - ccvAddrs = map RawInstanceAddress.toInstanceAddress allCCVs + ccvAddrs = map Chainlink.InstanceAddress.toInstanceAddress allCCVs executorAddressBytes = case sm.executionMode of Some _ -> sm.executorAddress None -> error "sendingMessage: execution mode not set" finalHash = - CCIP.MessageCodecV1.computeCCVAndExecutorHash ccvAddrs executorAddressBytes + CCIP.CodecV1.MessageCodecV1.computeCCVAndExecutorHash ccvAddrs executorAddressBytes tokenTransferV1Opt = case sm.tokenSendData of None -> None - Some tsd -> Some (CCIP.MessageCodecV1.TokenTransferV1 with - sourcePoolAddress = CCIP.MessageCodecV1.encodeInstanceAddress tsd.poolInstanceId tsd.poolOwner - sourceTokenAddress = CCIP.MessageCodecV1.encodeInstrumentId tsd.instrumentId + Some tsd -> Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + sourcePoolAddress = CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress tsd.poolInstanceId tsd.poolOwner + sourceTokenAddress = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId tsd.instrumentId destTokenAddress = tsd.destTokenAddress tokenReceiver = sm.tokenReceiver amount = tsd.amount extraData = tsd.extraData) - messageV1 = CCIP.MessageCodecV1.MessageV1 with + messageV1 = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sm.sourceChainSelector destChainSelector = sm.destChainSelector sequenceNumber = sm.sequenceNumber executionGasLimit = sm.executionGasLimit ccipReceiveGasLimit = sm.ccipReceiveGasLimit - finality = CCIP.FinalityConfig.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = finalHash onRampAddress = sm.onRampAddress offRampAddress = sm.offRampAddress @@ -186,12 +189,12 @@ buildMessageArtifacts sm = destBlob = sm.executorArgs tokenTransfer = tokenTransferV1Opt messageData = sm.payload - encoded = CCIP.MessageCodecV1.encodeMessageV1 messageV1 + encoded = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 messageV1 msgId = keccak256 encoded in (allCCVs, finalHash, messageV1, encoded, msgId) -template SendingMessageV1 +template SendingMessage with deps : SendingMessageDeps -- User/OnRamp provided fields, populated at PrepareSend @@ -202,9 +205,9 @@ template SendingMessageV1 sequenceNumber : Numeric 0 -- Destination-chain defaults captured at PrepareSend, used to resolve -- pool-required CCV sentinel/default semantics later. - destDefaultCCVs : [RawInstanceAddress.RawInstanceAddress] - requiredCCVs : [RawInstanceAddress.RawInstanceAddress] - requiredExecutor : Optional RawInstanceAddress.RawInstanceAddress + destDefaultCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + requiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + requiredExecutor : Optional Chainlink.InstanceAddress.RawInstanceAddress executorAddress : BytesHex executionMode : Optional ExecutionMode sourceChainSelector : Numeric 0 @@ -227,8 +230,11 @@ template SendingMessageV1 networkFeeUSDCents : Numeric 0 -- Expected token instrument for outbound TAR validation expectedTokenInstrumentId : Optional Splice.Api.Token.HoldingV1.InstrumentId + -- The original input amount of the message, before the pool deducts any fees. + -- Emitted in the CCIPMessageSent event + tokenAmountBeforeTokenPoolFees : Decimal -- Pool-required outbound CCVs, set via TAR authorization - outboundPoolCCVs : Optional [RawInstanceAddress.RawInstanceAddress] + outboundPoolCCVs : Optional [Chainlink.InstanceAddress.RawInstanceAddress] -- Executor arguments, set during PrepareSend and validated by AddExecutorFee. executorArgs : BytesHex -- Executor flat fee, set by AddExecutorFee @@ -262,7 +268,7 @@ template SendingMessageV1 ccvOwners : [Party] -- External CCIP message, populated by BuildMessage. - message : Optional CCIP.MessageCodecV1.MessageV1 + message : Optional CCIP.CodecV1.MessageCodecV1.MessageV1 encodedMessage : BytesHex messageId : BytesHex -- State machine: @@ -285,12 +291,67 @@ template SendingMessageV1 None -> True Some tsd -> isValidHex tsd.destTokenAddress && byteCount tsd.destTokenAddress == destAddressBytesLength) - choice AddCCVFee : ContractId SendingMessageV1 + interface instance CCIP.APIV1.SendingMessage.ISendingMessage for SendingMessage where + view = CCIP.APIV1.SendingMessage.SendingMessageView with + ccipOwner = ccipOwner + destChainSelector = destChainSelector + sender = sender + + -- CCVs + requiredCCVs = requiredCCVs + outboundPoolCCVs = outboundPoolCCVs + + -- deps + router = deps.router + onRamp = deps.onRamp + globalConfig = deps.globalConfig + rmnRemote = deps.rmnRemote + tokenAdminRegistry = deps.tokenAdminRegistry + feeQuoter = deps.feeQuoter + + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + sendingMessage_feeTokenAmountImpl self arg = do + exercise (fromInterfaceContractId @SendingMessage self) FeeTokenAmount with + context = arg.context + caller = arg.caller + + sendingMessage_addCCVFeeImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @SendingMessage self) AddCCVFee + with + ccvInstanceId = arg.ccvInstanceId + feeUSDCents = arg.feeUSDCents + destGasLimit = arg.destGasLimit + destBytesOverhead = arg.destBytesOverhead + context = arg.context + caller = arg.caller + + sendingMessage_addVerifierDataImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @SendingMessage self) AddVerifierData + with + ccvInstanceId = arg.ccvInstanceId + versionTag = arg.versionTag + verifierBlob = arg.verifierBlob + messageSentObservers = arg.messageSentObservers + context = arg.context + caller = arg.caller + + sendingMessage_addExecutorFeeImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @SendingMessage self) AddExecutorFee + with + executorInstanceId = arg.executorInstanceId + executorArgs = arg.executorArgs + feeUSDCents = arg.feeUSDCents + context = arg.context + caller = arg.caller + + choice AddCCVFee : ContractId SendingMessage with ccvInstanceId : Text feeUSDCents : Numeric 0 destGasLimit : Int destBytesOverhead : Int + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -311,39 +372,43 @@ template SendingMessageV1 ccvFees = ccvFees ++ [fee] ccvOwners = dedup (ccvOwners ++ [caller]) - choice AddTokenSendFee : ContractId SendingMessageV1 + choice AddTokenSendFee : ContractId SendingMessage with poolInstanceId : Text poolOwner : Party feeUSDCents : Numeric 0 destGasOverhead : Int destBytesOverhead : Int + context : Splice.Api.Token.MetadataV1.ChoiceContext controller ccipOwner do assertMsg "sendingMessage: AddTokenSendFee only allowed after pool CCVs are resolved" (state == SendingMessageState_Prepared) assertMsg "sendingMessage: AddTokenSendFee only valid for token sends" (isSome expectedTokenInstrumentId) assertMsg "token send fee already set" (isNone tokenSendFee) - let fee = TokenSendFee with - poolInstanceId, poolOwner - feeUSDCents, destGasOverhead, destBytesOverhead - create this with tokenSendFee = Some fee + create this with + tokenSendFee = Some TokenSendFee with + poolInstanceId + poolOwner + feeUSDCents + destGasOverhead + destBytesOverhead -- TAR-authorized outbound pool CCV requirements. - choice SetOutboundPoolCCVs : ContractId SendingMessageV1 + choice SetOutboundPoolCCVs : ContractId SendingMessage with - poolCCVs : [RawInstanceAddress.RawInstanceAddress] + poolCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] controller ccipOwner do assertMsg "sendingMessage: SetOutboundPoolCCVs only allowed while pool CCVs are required" (state == SendingMessageState_RequirePoolCCVs) assertMsg "sendingMessage: outbound pool CCV resolution only valid for token sends" (isSome expectedTokenInstrumentId) assertMsg "setOutboundPoolCCVs: already set" (isNone outboundPoolCCVs) - CCIP.Internal.assertMaxCCVListLength "sendingMessage: outbound pool CCVs" poolCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "sendingMessage: outbound pool CCVs" poolCCVs assertMsg "sendingMessage: outbound pool CCVs cannot contain duplicates" (unique poolCCVs) - let resolvedPoolCCVs = CCIP.Internal.resolveRequiredCCVsWithDefaults + let resolvedPoolCCVs = CCIP.CodecV1.CCVCodec.resolveRequiredCCVsWithDefaults destDefaultCCVs poolCCVs - CCIP.Internal.assertMaxCCVListLength "sendingMessage: resolved outbound pool CCVs" resolvedPoolCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "sendingMessage: resolved outbound pool CCVs" resolvedPoolCCVs create this with outboundPoolCCVs = Some resolvedPoolCCVs @@ -351,11 +416,12 @@ template SendingMessageV1 -- Record the executor-selected flat fee. OnRamp computes execution -- gas/bytes during fee finalization. - choice AddExecutorFee : ContractId SendingMessageV1 + choice AddExecutorFee : ContractId SendingMessage with executorInstanceId : Text executorArgs : BytesHex feeUSDCents : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -368,27 +434,27 @@ template SendingMessageV1 requiredExecutor <- case requiredExecutor of Some executor -> pure executor None -> abort "sendingMessage: required executor missing" - RawInstanceAddress.assertEqual + Chainlink.InstanceAddress.assertEqual "sendingMessage: caller is not the required executor" executorInstanceId caller requiredExecutor assertMsg "sendingMessage: executor address mismatch" - (executorAddress == RawInstanceAddress.toInstanceAddress requiredExecutor) + (executorAddress == Chainlink.InstanceAddress.toInstanceAddress requiredExecutor) let ef = ExecutorFee with executorInstanceId = executorInstanceId executorOwner = caller feeUSDCents = feeUSDCents create this with - executorAddress = RawInstanceAddress.toInstanceAddress requiredExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress requiredExecutor executorArgs = executorArgs executorFee = Some ef -- Finalize the execution receipt metadata. This happens before the -- outbound message is constructed. - choice FinalizeFee : ContractId SendingMessageV1 + choice FinalizeFee : ContractId SendingMessage with feeTokenPrice : Decimal premiumMultiplier : Decimal @@ -415,21 +481,21 @@ template SendingMessageV1 -- fee = floor(cents * usdPerUsdCent * multiplier / feeTokenPrice) -- where usdPerUsdCent (1e8) promotes cents back to E10, and -- multiplier/price are both E10-scaled so the ratio preserves units. - let feeTokenPriceN = CCIP.Math.decimalToNumeric0 feeTokenPrice - let premiumMultiplierN = CCIP.Math.decimalToNumeric0 premiumMultiplier + let feeTokenPriceN = CCIP.CodecV1.Math.decimalToNumeric0 feeTokenPrice + let premiumMultiplierN = CCIP.CodecV1.Math.decimalToNumeric0 premiumMultiplier let promoteUsdCentsToUsd10 feeUSDCents = - CCIP.Math.mulDivDown feeUSDCents CCIP.Math.usdPerUsdCent 1.0 + CCIP.CodecV1.Math.mulDivDown feeUSDCents CCIP.CodecV1.Math.usdPerUsdCent 1.0 -- Applies the premium multiplier (e.g. LINK discount) to a -- USD-cents fee and converts to fee token smallest units. let convertWithPremium feeUSDCents = let feeUsd10 = promoteUsdCentsToUsd10 feeUSDCents - in CCIP.Math.numeric0ToDecimal (CCIP.Math.mulDivDown feeUsd10 premiumMultiplierN feeTokenPriceN) + in CCIP.CodecV1.Math.numeric0ToDecimal (CCIP.CodecV1.Math.mulDivDown feeUsd10 premiumMultiplierN feeTokenPriceN) -- Identity conversion (no premium): used for gas execution cost -- and executor flat fees, matching EVM where the gas term in the -- numerator uses 1e18 (identity) rather than the multiplier. let convertDirect feeUSDCents = let feeUsd10 = promoteUsdCentsToUsd10 feeUSDCents - in CCIP.Math.numeric0ToDecimal (CCIP.Math.mulDivDown feeUsd10 CCIP.Math.premiumIdentity feeTokenPriceN) + in CCIP.CodecV1.Math.numeric0ToDecimal (CCIP.CodecV1.Math.mulDivDown feeUsd10 CCIP.CodecV1.Math.premiumIdentity feeTokenPriceN) let executionCostAmount = if executionMode == Some ExecutionMode_NoExecutor then 0.0 @@ -457,10 +523,10 @@ template SendingMessageV1 networkFeeTokenAmount = networkAmount state = SendingMessageState_FeeFinalized - choice BuildMessage : ContractId SendingMessageV1 + choice BuildMessage : ContractId SendingMessage with - caller : Party - controller caller + context : Splice.Api.Token.MetadataV1.ChoiceContext + controller ccipOwner do assertMsg "sendingMessage: BuildMessage only allowed after fee finalization" (state == SendingMessageState_FeeFinalized) assertMsg "sendingMessage: message already built" (isNone message) @@ -469,7 +535,7 @@ template SendingMessageV1 let (finalCCVs, finalHash, messageV1, encoded, msgId) = buildMessageArtifacts this - CCIP.Internal.assertMaxCCVListLength "sendingMessage: final CCVs" finalCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "sendingMessage: final CCVs" finalCCVs create this with requiredCCVs = finalCCVs ccvAndExecutorHash = finalHash @@ -477,12 +543,13 @@ template SendingMessageV1 encodedMessage = encoded messageId = msgId - choice AddVerifierData : ContractId SendingMessageV1 + choice AddVerifierData : ContractId SendingMessage with ccvInstanceId : Text versionTag : BytesHex verifierBlob : BytesHex messageSentObservers : [Party] + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -509,7 +576,7 @@ template SendingMessageV1 -- Stores token send data. If fees are already finalized, this also -- finalizes the outbound message. - choice AddTokenSend : ContractId SendingMessageV1 + choice AddTokenSend : ContractId SendingMessage with poolInstanceId : Text poolOwner : Party @@ -517,6 +584,7 @@ template SendingMessageV1 amount : BytesHex destTokenAddress : BytesHex extraData : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext controller ccipOwner do assertMsg "sendingMessage: AddTokenSend only allowed after pool CCVs are resolved" (state == SendingMessageState_FeeFinalized) @@ -541,7 +609,7 @@ template SendingMessageV1 let updated = this with tokenSendData = Some tsd let (finalCCVs, finalHash, messageV1, encoded, msgId) = buildMessageArtifacts updated - CCIP.Internal.assertMaxCCVListLength "sendingMessage: final CCVs" finalCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "sendingMessage: final CCVs" finalCCVs create updated with requiredCCVs = finalCCVs ccvAndExecutorHash = finalHash @@ -554,22 +622,24 @@ template SendingMessageV1 messageSender : Party messageSentObservers : [Party] verifierBlobs : [BytesHex] - receipts : [CCIP.Tickets.Receipt] + receipts : [CCIP.EventsV1.Receipts.Receipt] controller ccipOwner do assertMsg "finalizeSend: only allowed after fee finalization" (state == SendingMessageState_FeeFinalized) assertMsg "finalizeSend: message not yet constructed" (isSome message) assertMsg "finalizeSend: sender mismatch" (messageSender == sender) - eventCid <- create CCIP.Events.CCIPMessageSent with + eventCid <- create CCIP.EventsV1.Events.CCIPMessageSent with ccipOwner = ccipOwner ccvOwners = ccvOwners sender = messageSender observers = messageSentObservers - event = CCIP.Events.CCIPMessageSentEvent with + event = CCIP.EventsV1.Events.CCIPMessageSentEvent with destChainSelector = destChainSelector sequenceNumber = sequenceNumber messageId = messageId + feeToken = feeToken + tokenAmountBeforeTokenPoolFees = tokenAmountBeforeTokenPoolFees encodedMessage = encodedMessage verifierBlobs = verifierBlobs receipts = receipts @@ -581,6 +651,7 @@ template SendingMessageV1 -- Requires FinalizeFee to have been called. nonconsuming choice FeeTokenAmount : Decimal with + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -593,5 +664,5 @@ template SendingMessageV1 data FinalizeSendResult = FinalizeSendResult with - ccipMessageSent : ContractId CCIP.Events.CCIPMessageSent - deriving (Eq, Show) + ccipMessageSent : ContractId CCIP.EventsV1.Events.CCIPMessageSent + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/TokenAdminRegistry.daml b/contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistry.daml similarity index 64% rename from contracts/ccip/core/daml/CCIP/TokenAdminRegistry.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistry.daml index 850bd8f17..e9c68ee7c 100644 --- a/contracts/ccip/core/daml/CCIP/TokenAdminRegistry.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistry.daml @@ -1,4 +1,7 @@ -module CCIP.TokenAdminRegistry where +module CCIP.CoreV1.TokenAdminRegistry ( + module CCIP.CoreV1.TokenAdminRegistry, + module CCIP.CoreV1.TokenAdminRegistryTypes, +) where import DA.Crypto.Text (BytesHex, byteCount) import DA.List (dedup) @@ -7,11 +10,20 @@ import DA.Optional (fromSomeNote, isNone) import qualified Splice.Api.Token.HoldingV1 import qualified Splice.Api.Token.BurnMintV1 -import Splice.Api.Token.MetadataV1 (ChoiceContext) +import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 -import qualified CCIP.Context -import CCIP.TokenAdminRegistryCodecGen ( +import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CoreV1.SendingMessage +import qualified CCIP.TicketsV1 + +import CCIP.CoreV1.TokenAdminRegistryCodecGen ( decodeAcceptAdminParamsAt, decodeProposeAdminParamsAt, decodeSetBurnMintFactoryParamsAt, @@ -19,7 +31,7 @@ import CCIP.TokenAdminRegistryCodecGen ( decodeSetTransferFactoryParamsAt, decodeTransferAdminParamsAt, ) -import CCIP.TokenAdminRegistryTypes ( +import CCIP.CoreV1.TokenAdminRegistryTypes ( AcceptAdminParams(..), PoolRegistration(..), ProposeAdminParams(..), @@ -29,34 +41,8 @@ import CCIP.TokenAdminRegistryTypes ( TransferAdminParams(..), ) -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.MessageCodecV1 -import qualified CCIP.SendingMessageV1 -import qualified CCIP.Tickets -import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import Chainlink.InstanceAddress (RawInstanceAddress, assertValidInstanceId) -import Chainlink.InstanceAddress qualified as RawInstanceAddress - -tokenAdminRegistryKey : Text -tokenAdminRegistryKey = "token-admin-registry" - -tokenConfigKey : Text -tokenConfigKey = "token-config" - -lookupTokenAdminRegistryCid : ChoiceContext -> Update (ContractId TokenAdminRegistry) -lookupTokenAdminRegistryCid ctx = - CCIP.Context.getFromContextU ctx tokenAdminRegistryKey - -lookupTokenConfigCid : ChoiceContext -> Update (ContractId TokenConfig) -lookupTokenConfigCid ctx = - CCIP.Context.getFromContextU ctx tokenConfigKey - -lookupOptionalTokenConfigCid : ChoiceContext -> Update (Optional (ContractId TokenConfig)) -lookupOptionalTokenConfigCid ctx = - CCIP.Context.lookupFromContextU ctx tokenConfigKey - tokenConfigInstanceId : Splice.Api.Token.HoldingV1.InstrumentId -> Text -tokenConfigInstanceId = CCIP.MessageCodecV1.encodeInstrumentId +tokenConfigInstanceId = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId optionalPartyToList : Optional Party -> [Party] optionalPartyToList opt = @@ -160,16 +146,16 @@ assertConfiguredBurnMintFactory label config suppliedFactory = assertMsg (label <> ": burn/mint factory mismatch") (suppliedFactory == expectedFactory) -lookupContractIdFromMap : Text -> Map.Map Text (ContractId ()) -> RawInstanceAddress -> Update (ContractId ()) +lookupContractIdFromMap : Text -> Map.Map Text (ContractId ()) -> Chainlink.InstanceAddress.RawInstanceAddress -> Update (ContractId ()) lookupContractIdFromMap label contractIds address = - let addressText = RawInstanceAddress.toText address + let addressText = Chainlink.InstanceAddress.toText address in case Map.lookup addressText contractIds of None -> abort (label <> ": contract id not in map: " <> addressText) Some cid -> pure cid resolveTransferFactoryFromMap : Map.Map Text (ContractId ()) - -> Optional RawInstanceAddress + -> Optional Chainlink.InstanceAddress.RawInstanceAddress -> Update (Optional (ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory)) resolveTransferFactoryFromMap contractIds transferFactoryAddress = case transferFactoryAddress of @@ -180,7 +166,7 @@ resolveTransferFactoryFromMap contractIds transferFactoryAddress = resolveBurnMintFactoryFromMap : Map.Map Text (ContractId ()) - -> Optional RawInstanceAddress + -> Optional Chainlink.InstanceAddress.RawInstanceAddress -> Update (Optional (ContractId Splice.Api.Token.BurnMintV1.BurnMintFactory)) resolveBurnMintFactoryFromMap contractIds burnMintFactoryAddress = case burnMintFactoryAddress of @@ -214,22 +200,196 @@ template TokenConfig signatory registryOwner observer tokenConfigObservers registryOwner isCCIPManaged instrumentId admin pendingAdmin tokenPool ensure - assertValidInstanceId instanceId - && assertValidInstanceId registryInstanceId + Chainlink.InstanceAddress.assertValidInstanceId instanceId + && Chainlink.InstanceAddress.assertValidInstanceId registryInstanceId && index >= 0 && instanceId == tokenConfigInstanceId instrumentId + interface instance CCIP.APIV1.TokenAdminRegistry.ITokenConfig for TokenConfig where + view = CCIP.APIV1.TokenAdminRegistry.TokenConfigView + with + ccipOwner = registryOwner + instanceId = instanceId + instrumentId = instrumentId + tokenPool = case tokenPool of + None -> None + Some pr -> Some CCIP.APIV1.TokenAdminRegistry.PoolRegistration with + poolOwner = pr.poolOwner + poolInstanceId = pr.poolInstanceId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + tokenConfig_publicFetchImpl self _ = do + pure CCIP.APIV1.TokenAdminRegistry.TokenConfigView + with + ccipOwner = registryOwner + instanceId = instanceId + instrumentId = instrumentId + tokenPool = case tokenPool of + None -> None + Some pr -> Some CCIP.APIV1.TokenAdminRegistry.PoolRegistration with + poolOwner = pr.poolOwner + poolInstanceId = pr.poolInstanceId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + tokenConfig_assertConfiguredTransferFactoryImpl self arg = do + config <- fetch (coerceContractId self) + assertConfiguredTransferFactory "TokenConfig: AssertConfiguredTransferFactory" config arg.suppliedFactory + + tokenConfig_assertConfiguredBurnMintFactoryImpl self arg = do + config <- fetch (coerceContractId self) + assertConfiguredBurnMintFactory "TokenConfig: AssertConfiguredBurnMintFactory" config arg.suppliedFactory + template TokenAdminRegistry with instanceId : Text -- owner has to be ccipOwner (ie, the owner of the OffRamp) in order to be able to consume -- send tickets - -- TODO: rename to ccipOwner to be explicit - owner : Party + ccipOwner : Party entryCount : Int where - signatory owner - ensure assertValidInstanceId instanceId && entryCount >= 0 + signatory ccipOwner + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && entryCount >= 0 + + interface instance CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry for TokenAdminRegistry where + view = CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistryView + with + ccipOwner = ccipOwner + instanceId = instanceId + + tokenAdminRegistry_publicFetchImpl self _ = do + pure CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistryView + with + ccipOwner = ccipOwner + instanceId = instanceId + + tokenAdminRegistry_fetchTokenConfigImpl self arg = do + config <- fetch (coerceContractId arg.tokenConfigCid) + assertTokenConfigForInstrument instanceId ccipOwner entryCount arg.instrumentId config + pure CCIP.APIV1.TokenAdminRegistry.TokenConfigView + with + ccipOwner = config.registryOwner + instanceId = config.instanceId + instrumentId = config.instrumentId + tokenPool = case config.tokenPool of + None -> None + Some pr -> Some CCIP.APIV1.TokenAdminRegistry.PoolRegistration with + poolOwner = pr.poolOwner + poolInstanceId = pr.poolInstanceId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + tokenAdminRegistry_setPoolImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) SetPool with + tokenConfigCid = coerceContractId arg.tokenConfigCid + instrumentId = arg.instrumentId + tokenPool = case arg.tokenPool of + None -> None + Some pr -> Some PoolRegistration with + poolOwner = pr.poolOwner + poolInstanceId = pr.poolInstanceId + context = arg.context + caller = arg.caller + + tokenAdminRegistry_setTransferFactoryImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) SetTransferFactory with + tokenConfigCid = coerceContractId arg.tokenConfigCid + instrumentId = arg.instrumentId + transferFactory = arg.transferFactory + context = arg.context + caller = arg.caller + + tokenAdminRegistry_setBurnMintFactoryImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) SetBurnMintFactory with + tokenConfigCid = coerceContractId arg.tokenConfigCid + instrumentId = arg.instrumentId + burnMintFactory = arg.burnMintFactory + context = arg.context + caller = arg.caller + + tokenAdminRegistry_proposeAdministratorImpl self arg = do + result <- exercise (fromInterfaceContractId @TokenAdminRegistry self) ProposeAdministrator with + tokenConfigCid = case arg.tokenConfigCid of + None -> None + Some cid -> Some (coerceContractId cid) + instrumentId = arg.instrumentId + newAdmin = arg.newAdmin + context = arg.context + caller = arg.caller + pure CCIP.APIV1.TokenAdminRegistry.ProposeAdministratorResult with + tokenAdminRegistryCid = coerceContractId result.tokenAdminRegistryCid + tokenConfigCid = coerceContractId result.tokenConfigCid + created = result.created + index = result.index + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + tokenAdminRegistry_acceptAdminRoleImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) AcceptAdminRole with + tokenConfigCid = coerceContractId arg.tokenConfigCid + instrumentId = arg.instrumentId + context = arg.context + caller = arg.caller + + tokenAdminRegistry_transferAdminRoleImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) TransferAdminRole with + tokenConfigCid = coerceContractId arg.tokenConfigCid + instrumentId = arg.instrumentId + newAdmin = arg.newAdmin + context = arg.context + caller = arg.caller + + tokenAdminRegistry_isAdministratorImpl self arg = do + exercise (fromInterfaceContractId @TokenAdminRegistry self) IsAdministrator with + tokenConfigCid = case arg.tokenConfigCid of + None -> None + Some cid -> Some (coerceContractId cid) + instrumentId = arg.instrumentId + administrator = arg.administrator + context = arg.context + caller = arg.caller + + tokenAdminRegistry_setInboundPoolCCVsImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) SetInboundPoolCCVs with + tokenConfigCid = coerceContractId arg.tokenConfigCid + executingMessageCid = coerceContractId arg.executingMessageCid + poolInstanceId = arg.poolInstanceId + poolCCVs = arg.poolCCVs + caller = arg.caller + + tokenAdminRegistry_setOutboundPoolCCVsImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) SetOutboundPoolCCVs with + tokenConfigCid = coerceContractId arg.tokenConfigCid + sendingMessageCid = coerceContractId arg.sendingMessageCid + poolInstanceId = arg.poolInstanceId + poolCCVs = arg.poolCCVs + caller = arg.caller + + tokenAdminRegistry_addTokenSendImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) AddTokenSend with + tokenConfigCid = coerceContractId arg.tokenConfigCid + sendingMessageCid = coerceContractId arg.sendingMessageCid + poolInstanceId = arg.poolInstanceId + instrumentId = arg.instrumentId + amount = arg.amount + destTokenAddress = arg.destTokenAddress + extraData = arg.extraData + caller = arg.caller + + tokenAdminRegistry_addTokenSendFeeImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @TokenAdminRegistry self) AddTokenSendFee with + tokenConfigCid = coerceContractId arg.tokenConfigCid + sendingMessageCid = coerceContractId arg.sendingMessageCid + poolInstanceId = arg.poolInstanceId + feeUSDCents = arg.feeUSDCents + destGasOverhead = arg.destGasOverhead + destBytesOverhead = arg.destBytesOverhead + caller = arg.caller + + tokenAdminRegistry_consumeReceiveTicketImpl self arg = do + exercise (fromInterfaceContractId @TokenAdminRegistry self) ConsumeReceiveTicket with + tokenConfigCid = coerceContractId arg.tokenConfigCid + tokenReceiveTicketCid = coerceContractId arg.tokenReceiveTicketCid + instrumentId = arg.instrumentId + poolInstanceId = arg.poolInstanceId + caller = arg.caller nonconsuming choice Get : TokenAdminRegistry with @@ -241,11 +401,12 @@ template TokenAdminRegistry with tokenConfigCid : ContractId TokenConfig instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config pure config nonconsuming choice SetPool : ContractId TokenConfig @@ -253,11 +414,12 @@ template TokenAdminRegistry tokenConfigCid : ContractId TokenConfig instrumentId : Splice.Api.Token.HoldingV1.InstrumentId tokenPool : Optional PoolRegistration + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config admin <- case config.admin of None -> abort "SetPool: no admin set for instrument" Some admin -> pure admin @@ -270,11 +432,12 @@ template TokenAdminRegistry tokenConfigCid : ContractId TokenConfig instrumentId : Splice.Api.Token.HoldingV1.InstrumentId transferFactory : Optional (ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory) + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config admin <- case config.admin of None -> abort "SetTransferFactory: no admin set for instrument" Some admin -> pure admin @@ -298,11 +461,12 @@ template TokenAdminRegistry tokenConfigCid : ContractId TokenConfig instrumentId : Splice.Api.Token.HoldingV1.InstrumentId burnMintFactory : Optional (ContractId Splice.Api.Token.BurnMintV1.BurnMintFactory) + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config admin <- case config.admin of None -> abort "SetBurnMintFactory: no admin set for instrument" Some admin -> pure admin @@ -325,11 +489,12 @@ template TokenAdminRegistry with tokenConfigCid : ContractId TokenConfig instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config pendingAdmin <- case config.pendingAdmin of None -> abort "AcceptAdminRole: no pending admin to accept" Some pendingAdmin -> pure pendingAdmin @@ -344,11 +509,12 @@ template TokenAdminRegistry tokenConfigCid : ContractId TokenConfig instrumentId : Splice.Api.Token.HoldingV1.InstrumentId newAdmin : Party + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config currentAdmin <- case config.admin of None -> abort "TransferAdminRole: no admin to transfer" Some admin -> pure admin @@ -359,16 +525,17 @@ template TokenAdminRegistry nonconsuming choice IsAdministrator : Bool with - instrumentId : Splice.Api.Token.HoldingV1.InstrumentId tokenConfigCid : Optional (ContractId TokenConfig) + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId administrator : Party + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do configOpt <- case tokenConfigCid of Some cid -> do config <- fetch cid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config pure (Some config) None -> pure None pure (case configOpt of @@ -383,10 +550,11 @@ template TokenAdminRegistry tokenConfigCid : Optional (ContractId TokenConfig) instrumentId : Splice.Api.Token.HoldingV1.InstrumentId newAdmin : Party + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do - let isOwner = caller == owner + let isOwner = caller == ccipOwner isAdmin = caller == instrumentId.admin assertMsg "ProposeAdministrator: caller must be either the registry owner or the token admin" (isOwner || isAdmin) @@ -394,7 +562,7 @@ template TokenAdminRegistry case tokenConfigCid of Some configCid -> do config <- fetch configCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config assertMsg "ProposeAdministrator: managed token config can only be proposed by owner" (not config.isCCIPManaged || isOwner) assertMsg "ProposeAdministrator: admin already set" (isNone config.admin) @@ -414,7 +582,7 @@ template TokenAdminRegistry configCid <- create TokenConfig with instanceId = tokenConfigInstanceId instrumentId registryInstanceId = instanceId - registryOwner = owner + registryOwner = ccipOwner index = newConfigIndex isCCIPManaged = isOwner instrumentId @@ -436,66 +604,66 @@ template TokenAdminRegistry nonconsuming choice ConsumeReceiveTicket : () with tokenConfigCid : ContractId TokenConfig - ticketCid : ContractId CCIP.Tickets.TokenReceiveTicket + tokenReceiveTicketCid : ContractId CCIP.TicketsV1.TokenReceiveTicket instrumentId : Splice.Api.Token.HoldingV1.InstrumentId poolInstanceId : Text caller : Party controller caller do config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config pool <- registeredPoolOrAbort "ConsumeReceiveTicket" config assertRegisteredPoolCaller "ConsumeReceiveTicket" caller poolInstanceId pool - let poolAddress = RawInstanceAddress.make pool.poolInstanceId pool.poolOwner - ticket <- fetch ticketCid + let poolAddress = Chainlink.InstanceAddress.make pool.poolInstanceId pool.poolOwner + ticket <- fetch tokenReceiveTicketCid assertMsg "ConsumeReceiveTicket: instanceId mismatch" (ticket.tokenAdminRegistryInstanceId == instanceId) assertMsg "ConsumeReceiveTicket: owner mismatch" - (ticket.ccipOwner == owner) + (ticket.ccipOwner == ccipOwner) assertMsg "ConsumeReceiveTicket: ticket pool owner must match registered pool owner" (ticket.poolOwner == pool.poolOwner) assertMsg "ConsumeReceiveTicket: ticket pool address must match registered pool" (ticket.poolAddress == poolAddress) assertMsg "ConsumeReceiveTicket: ticket instrument must match requested instrument" (ticket.instrumentId == instrumentId) - exercise ticketCid CCIP.Tickets.Consume + exercise tokenReceiveTicketCid CCIP.TicketsV1.Consume - -- | Record pool's outbound CCV requirements on a SendingMessageV1. + -- | Record pool's outbound CCV requirements on a SendingMessage. -- Validates the caller is the registered pool for the expected token instrument, -- then exercises SetOutboundPoolCCVs (authorized via TAR's signatory = ccipOwner). - nonconsuming choice SetOutboundPoolCCVs : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice SetOutboundPoolCCVs : ContractId CCIP.CoreV1.SendingMessage.SendingMessage with tokenConfigCid : ContractId TokenConfig - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage poolInstanceId : Text - poolCCVs : [RawInstanceAddress] + poolCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] caller : Party controller caller do sm <- fetch sendingMessageCid - assertMsg "TAR outbound: sendingMessage ccipOwner mismatch" (sm.ccipOwner == owner) - RawInstanceAddress.assertEqual "TAR outbound: instance address mismatch" - instanceId owner sm.deps.tokenAdminRegistry + assertMsg "TAR outbound: sendingMessage ccipOwner mismatch" (sm.ccipOwner == ccipOwner) + Chainlink.InstanceAddress.assertEqual "TAR outbound: instance address mismatch" + instanceId ccipOwner sm.deps.tokenAdminRegistry instrumentId <- case sm.expectedTokenInstrumentId of None -> abort "TAR outbound: missing expected token instrument" Some iid -> pure iid config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config pool <- registeredPoolOrAbort "TAR outbound" config assertRegisteredPoolCaller "TAR outbound" caller poolInstanceId pool - exercise sendingMessageCid CCIP.SendingMessageV1.SetOutboundPoolCCVs with + exercise sendingMessageCid CCIP.CoreV1.SendingMessage.SetOutboundPoolCCVs with poolCCVs - -- | Record pool's outbound token-send fee on a SendingMessageV1. + -- | Record pool's outbound token-send fee on a SendingMessage. -- Validates the caller is the registered pool for the expected token instrument, -- then exercises AddTokenSendFee under TAR/ccipOwner authority. - nonconsuming choice AddTokenSendFee : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice AddTokenSendFee : ContractId CCIP.CoreV1.SendingMessage.SendingMessage with tokenConfigCid : ContractId TokenConfig - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage poolInstanceId : Text feeUSDCents : Numeric 0 destGasOverhead : Int @@ -504,33 +672,34 @@ template TokenAdminRegistry controller caller do sm <- fetch sendingMessageCid - assertMsg "TAR outbound fee: sendingMessage ccipOwner mismatch" (sm.ccipOwner == owner) - RawInstanceAddress.assertEqual "TAR outbound fee: instance address mismatch" - instanceId owner sm.deps.tokenAdminRegistry + assertMsg "TAR outbound fee: sendingMessage ccipOwner mismatch" (sm.ccipOwner == ccipOwner) + Chainlink.InstanceAddress.assertEqual "TAR outbound fee: instance address mismatch" + instanceId ccipOwner sm.deps.tokenAdminRegistry instrumentId <- case sm.expectedTokenInstrumentId of None -> abort "TAR outbound fee: missing expected token instrument" Some iid -> pure iid config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config pool <- registeredPoolOrAbort "TAR outbound fee" config assertRegisteredPoolCaller "TAR outbound fee" caller poolInstanceId pool - exercise sendingMessageCid CCIP.SendingMessageV1.AddTokenSendFee with + exercise sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSendFee with poolInstanceId = poolInstanceId poolOwner = caller feeUSDCents = feeUSDCents destGasOverhead = destGasOverhead destBytesOverhead = destBytesOverhead + context = Splice.Api.Token.MetadataV1.emptyChoiceContext - -- | Record pool's outbound token send data on a SendingMessageV1. + -- | Record pool's outbound token send data on a SendingMessage. -- Validates the caller is the registered pool for the expected token instrument, -- then exercises AddTokenSend under TAR/ccipOwner authority. - nonconsuming choice AddTokenSend : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice AddTokenSend : ContractId CCIP.CoreV1.SendingMessage.SendingMessage with tokenConfigCid : ContractId TokenConfig - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage poolInstanceId : Text instrumentId : Splice.Api.Token.HoldingV1.InstrumentId amount : BytesHex @@ -540,9 +709,9 @@ template TokenAdminRegistry controller caller do sm <- fetch sendingMessageCid - assertMsg "TAR outbound send: sendingMessage ccipOwner mismatch" (sm.ccipOwner == owner) - RawInstanceAddress.assertEqual "TAR outbound send: instance address mismatch" - instanceId owner sm.deps.tokenAdminRegistry + assertMsg "TAR outbound send: sendingMessage ccipOwner mismatch" (sm.ccipOwner == ccipOwner) + Chainlink.InstanceAddress.assertEqual "TAR outbound send: instance address mismatch" + instanceId ccipOwner sm.deps.tokenAdminRegistry expectedInstrumentId <- case sm.expectedTokenInstrumentId of None -> abort "TAR outbound send: missing expected token instrument" @@ -551,63 +720,64 @@ template TokenAdminRegistry (instrumentId == expectedInstrumentId) config <- fetch tokenConfigCid - assertTokenConfigForInstrument instanceId owner entryCount instrumentId config + assertTokenConfigForInstrument instanceId ccipOwner entryCount instrumentId config pool <- registeredPoolOrAbort "TAR outbound send" config assertRegisteredPoolCaller "TAR outbound send" caller poolInstanceId pool assertMsg "TAR outbound send: token amount must be 32 bytes" (byteCount amount == 32) - exercise sendingMessageCid CCIP.SendingMessageV1.AddTokenSend with + exercise sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSend with poolInstanceId = poolInstanceId poolOwner = caller instrumentId = instrumentId amount = amount destTokenAddress = destTokenAddress extraData = extraData + context = Splice.Api.Token.MetadataV1.emptyChoiceContext - -- | Record pool's inbound CCV requirements on an ExecutingMessageV1. + -- | Record pool's inbound CCV requirements on an ExecutingMessage. -- Validates the caller is the registered pool for the token in the message, -- then exercises SetInboundPoolCCVs (authorized via TAR's signatory = ccipOwner). - nonconsuming choice SetInboundPoolCCVs : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + nonconsuming choice SetInboundPoolCCVs : ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage with tokenConfigCid : ContractId TokenConfig - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + executingMessageCid : ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage poolInstanceId : Text - poolCCVs : [RawInstanceAddress] + poolCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] caller : Party controller caller do execMsg <- fetch executingMessageCid - assertMsg "TAR: executingMessage ccipOwner mismatch" (execMsg.ccipOwner == owner) - RawInstanceAddress.assertEqual "TAR: instance address mismatch" - instanceId owner execMsg.deps.tokenAdminRegistry + assertMsg "TAR: executingMessage ccipOwner mismatch" (execMsg.ccipOwner == ccipOwner) + Chainlink.InstanceAddress.assertEqual "TAR: instance address mismatch" + instanceId ccipOwner execMsg.deps.tokenAdminRegistry let tt = fromSomeNote "SetInboundPoolCCVs: no token transfer in message" execMsg.message.tokenTransfer config <- fetch tokenConfigCid - assertTokenConfigForTokenAddress instanceId owner entryCount tt.destTokenAddress config + assertTokenConfigForTokenAddress instanceId ccipOwner entryCount tt.destTokenAddress config pool <- registeredPoolOrAbort "SetInboundPoolCCVs" config assertRegisteredPoolCaller "SetInboundPoolCCVs" caller poolInstanceId pool - exercise executingMessageCid CCIP.ExecutingMessageV1.SetInboundPoolCCVs with + exercise executingMessageCid CCIP.CoreV1.ExecutingMessage.SetInboundPoolCCVs with poolInstanceId = pool.poolInstanceId poolOwner = pool.poolOwner poolCCVs -- | Resolve token-side finalization data for an inbound token transfer and - -- exercise ExecutingMessageV1.FinalizeExecute under TAR's signatory context. + -- exercise ExecutingMessage.FinalizeExecute under TAR's signatory context. -- OffRamp remains the authority that decides execution is valid and complete. - nonconsuming choice FinalizeExecute : CCIP.ExecutingMessageV1.FinalizeExecuteResult + nonconsuming choice FinalizeExecute : CCIP.CoreV1.ExecutingMessage.FinalizeExecuteResult with tokenConfigCid : ContractId TokenConfig - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + executingMessageCid : ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage ticketReceiver : Party returnData : BytesHex - controller owner + controller ccipOwner do execMsg <- fetch executingMessageCid - assertMsg "TAR finalize: executingMessage ccipOwner mismatch" (execMsg.ccipOwner == owner) - RawInstanceAddress.assertEqual "TAR finalize: instance address mismatch" - instanceId owner execMsg.deps.tokenAdminRegistry + assertMsg "TAR finalize: executingMessage ccipOwner mismatch" (execMsg.ccipOwner == ccipOwner) + Chainlink.InstanceAddress.assertEqual "TAR finalize: instance address mismatch" + instanceId ccipOwner execMsg.deps.tokenAdminRegistry resolvedTokenReceiver <- case execMsg.tokenReceiver of None -> abort "TAR finalize: expected token transfer" @@ -618,16 +788,16 @@ template TokenAdminRegistry execMsg.message.tokenTransfer config <- fetch tokenConfigCid - assertTokenConfigForTokenAddress instanceId owner entryCount tt.destTokenAddress config + assertTokenConfigForTokenAddress instanceId ccipOwner entryCount tt.destTokenAddress config pool <- registeredPoolOrAbort "TAR finalize" config - let poolAddress = RawInstanceAddress.make pool.poolInstanceId pool.poolOwner + let poolAddress = Chainlink.InstanceAddress.make pool.poolInstanceId pool.poolOwner poolVerification <- case execMsg.inboundPoolVerification of None -> abort "TAR finalize: missing inbound pool verification" Some verification -> pure verification assertMsg "TAR finalize: registered pool changed since inbound verification" - (RawInstanceAddress.make poolVerification.poolInstanceId poolVerification.poolOwner == poolAddress) + (Chainlink.InstanceAddress.make poolVerification.poolInstanceId poolVerification.poolOwner == poolAddress) - exercise executingMessageCid CCIP.ExecutingMessageV1.FinalizeExecute with + exercise executingMessageCid CCIP.CoreV1.ExecutingMessage.FinalizeExecute with tokenAdminRegistryInstanceId = instanceId maybePoolAddress = Some poolAddress maybeTicketReceiver = Some ticketReceiver @@ -638,17 +808,17 @@ template TokenAdminRegistry interface instance MCMSReceiver for TokenAdminRegistry where view = MCMSReceiverView with - mcmsController = owner + mcmsController = ccipOwner instanceId mcmsEntrypoint functionName operationData contractIds = do - let instAddr = instanceId <> "@" <> partyToText owner + let instAddr = instanceId <> "@" <> partyToText ccipOwner selfTarCid <- case Map.lookup instAddr contractIds of None -> abort $ "E_SELF_CID_NOT_IN_MAP: " <> instAddr Some cid -> pure (coerceContractId cid : ContractId TokenAdminRegistry) let tokenConfigInstAddr instrumentId = - RawInstanceAddress.makeText (tokenConfigInstanceId instrumentId) owner + Chainlink.InstanceAddress.makeText (tokenConfigInstanceId instrumentId) ccipOwner case functionName of "SetPool" -> do @@ -665,7 +835,8 @@ template TokenAdminRegistry tokenConfigCid instrumentId tokenPool - caller = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner pure (Map.insert configAddr (coerceContractId newConfigCid) contractIds) "SetTransferFactory" -> do @@ -683,7 +854,8 @@ template TokenAdminRegistry tokenConfigCid instrumentId transferFactory - caller = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner pure (Map.insert configAddr (coerceContractId newConfigCid) contractIds) "SetBurnMintFactory" -> do @@ -701,7 +873,8 @@ template TokenAdminRegistry tokenConfigCid instrumentId burnMintFactory - caller = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner pure (Map.insert configAddr (coerceContractId newConfigCid) contractIds) "ProposeAdministrator" -> do @@ -718,7 +891,8 @@ template TokenAdminRegistry tokenConfigCid = existingTokenConfigCid instrumentId newAdmin - caller = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner let contractIdsWithTar = Map.insert instAddr (coerceContractId result.tokenAdminRegistryCid) contractIds pure (Map.insert configAddr (coerceContractId result.tokenConfigCid) contractIdsWithTar) @@ -737,7 +911,8 @@ template TokenAdminRegistry tokenConfigCid instrumentId newAdmin - caller = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner pure (Map.insert configAddr (coerceContractId newConfigCid) contractIds) "AcceptAdminRole" -> do @@ -753,7 +928,8 @@ template TokenAdminRegistry newConfigCid <- exercise selfTarCid AcceptAdminRole with tokenConfigCid instrumentId - caller = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner pure (Map.insert configAddr (coerceContractId newConfigCid) contractIds) - _ -> abort $ "E_UNKNOWN_FUNCTION: " <> functionName + _ -> abort $ "E_UNKNOWN_FUNCTION: " <> functionName \ No newline at end of file diff --git a/contracts/ccip/core/daml/CCIP/TokenAdminRegistryCodecGen.daml b/contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistryCodecGen.daml similarity index 92% rename from contracts/ccip/core/daml/CCIP/TokenAdminRegistryCodecGen.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistryCodecGen.daml index e240fc3cf..4885506d9 100644 --- a/contracts/ccip/core/daml/CCIP/TokenAdminRegistryCodecGen.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistryCodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.TokenAdminRegistryCodecGen where +module CCIP.CoreV1.TokenAdminRegistryCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.TokenAdminRegistryTypes (PoolRegistration(..), SetPoolParams(..), SetTransferFactoryParams(..), SetBurnMintFactoryParams(..), ProposeAdminParams(..), TransferAdminParams(..), AcceptAdminParams(..)) +import CCIP.CoreV1.TokenAdminRegistryTypes (PoolRegistration(..), SetPoolParams(..), SetTransferFactoryParams(..), SetBurnMintFactoryParams(..), ProposeAdminParams(..), TransferAdminParams(..), AcceptAdminParams(..)) import MCMS.Codec ( decodeOptional, @@ -15,7 +15,7 @@ import MCMS.Codec ( encodeText ) -import CCIP.Codec (decodeInstrumentId, decodeRawInstanceAddressAt, encodeInstrumentId, encodeRawInstanceAddress) +import CCIP.CodecV1 (decodeInstrumentId, decodeRawInstanceAddressAt, encodeInstrumentId, encodeRawInstanceAddress) -- =============================================== diff --git a/contracts/ccip/core/daml/CCIP/TokenAdminRegistryTypes.daml b/contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistryTypes.daml similarity index 89% rename from contracts/ccip/core/daml/CCIP/TokenAdminRegistryTypes.daml rename to contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistryTypes.daml index ed7b01d63..a943228b1 100644 --- a/contracts/ccip/core/daml/CCIP/TokenAdminRegistryTypes.daml +++ b/contracts/ccip/core/daml/CCIP/CoreV1/TokenAdminRegistryTypes.daml @@ -1,6 +1,6 @@ -- | Types module for TokenAdminRegistry -- Separate module to enable auto-generated codec via go-daml -module CCIP.TokenAdminRegistryTypes +module CCIP.CoreV1.TokenAdminRegistryTypes ( PoolRegistration(..) , SetPoolParams(..) , SetTransferFactoryParams(..) @@ -11,7 +11,8 @@ module CCIP.TokenAdminRegistryTypes ) where import qualified Splice.Api.Token.HoldingV1 -import Chainlink.InstanceAddress (RawInstanceAddress) + +import qualified Chainlink.InstanceAddress -- | Registered pool identity for a token instrument. data PoolRegistration = PoolRegistration @@ -39,7 +40,7 @@ data SetPoolParams = SetPoolParams data SetTransferFactoryParams = SetTransferFactoryParams with instrumentId : Splice.Api.Token.HoldingV1.InstrumentId - transferFactoryAddress : Optional RawInstanceAddress + transferFactoryAddress : Optional Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) -- | Params for SetBurnMintFactory choice. @@ -50,7 +51,7 @@ data SetTransferFactoryParams = SetTransferFactoryParams data SetBurnMintFactoryParams = SetBurnMintFactoryParams with instrumentId : Splice.Api.Token.HoldingV1.InstrumentId - burnMintFactoryAddress : Optional RawInstanceAddress + burnMintFactoryAddress : Optional Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) -- | Params for ProposeAdmin choice @@ -71,4 +72,4 @@ data TransferAdminParams = TransferAdminParams data AcceptAdminParams = AcceptAdminParams with instrumentId : Splice.Api.Token.HoldingV1.InstrumentId - deriving (Eq, Show) + deriving (Eq, Show) \ No newline at end of file diff --git a/contracts/ccip/events/daml.yaml b/contracts/ccip/events/daml.yaml new file mode 100644 index 000000000..c9a9c590c --- /dev/null +++ b/contracts/ccip/events/daml.yaml @@ -0,0 +1,20 @@ +sdk-version: 3.4.11 +name: ccip-events +source: daml +version: 2.0.0 +build-options: + - "-Wno-crypto-text-is-alpha" + - "-Werror=unused-dependency" +data-dependencies: + - ../../dependencies/splice/splice-api-token-metadata-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../client-api/.daml/dist/ccip-client-api-2.0.0.dar +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/core/daml/CCIP/Events.daml b/contracts/ccip/events/daml/CCIP/EventsV1/Events.daml similarity index 65% rename from contracts/ccip/core/daml/CCIP/Events.daml rename to contracts/ccip/events/daml/CCIP/EventsV1/Events.daml index 53560ebaf..39a7f4cdb 100644 --- a/contracts/ccip/core/daml/CCIP/Events.daml +++ b/contracts/ccip/events/daml/CCIP/EventsV1/Events.daml @@ -1,15 +1,19 @@ -module CCIP.Events where +module CCIP.EventsV1.Events where import DA.Crypto.Text (BytesHex) import DA.List (dedup) -import qualified CCIP.FinalityConfig -import qualified CCIP.Internal -import qualified CCIP.Tickets import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 + import qualified Chainlink.InstanceAddress +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.ClientV1 +import qualified CCIP.EventsV1.Receipts + template CCIPMessageSent with ccipOwner : Party @@ -21,14 +25,22 @@ template CCIPMessageSent signatory dedup (ccipOwner :: ccvOwners) observer sender, observers + interface instance CCIP.ClientV1.ICCIPMessageSent for CCIPMessageSent where + view = CCIP.ClientV1.CCIPMessageSentView with + ccipOwner = ccipOwner + messageId = event.messageId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + data CCIPMessageSentEvent = CCIPMessageSentEvent with destChainSelector : Numeric 0 sequenceNumber : Numeric 0 messageId : BytesHex + feeToken : Splice.Api.Token.HoldingV1.InstrumentId + tokenAmountBeforeTokenPoolFees : Decimal encodedMessage : BytesHex verifierBlobs : [BytesHex] - receipts : [CCIP.Tickets.Receipt] + receipts : [CCIP.EventsV1.Receipts.Receipt] deriving (Eq, Show) template ExecutionStateChanged @@ -41,12 +53,19 @@ template ExecutionStateChanged signatory dedup (ccipOwner :: ccvOwners) observer receiver + interface instance CCIP.ClientV1.IExecutionStateChanged for ExecutionStateChanged where + view = CCIP.ClientV1.ExecutionStateChangedView with + ccipOwner = ccipOwner + messageId = event.messageId + state = event.state + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + data ExecutionStateChangedEvent = ExecutionStateChangedEvent with sourceChainSelector : Numeric 0 sequenceNumber : Numeric 0 messageId : BytesHex - state : CCIP.Internal.MessageExecutionState + state : CCIP.APIV1.ExecutingMessage.MessageExecutionState returnData : BytesHex deriving (Eq, Show) @@ -57,7 +76,7 @@ template TokenReceiveTicketClaimed poolOwner : Party receiver : Party tokenReceiver : Party - tokenReceiveTicketCid : ContractId CCIP.Tickets.TokenReceiveTicket + tokenReceiveTicketCid : ContractId CCIP.APIV1.ExecutingMessage.ITokenReceiveTicket event : TokenReceiveTicketClaimedEvent where signatory poolOwner @@ -74,7 +93,7 @@ data TokenReceiveTicketClaimedEvent = TokenReceiveTicketClaimedEvent sourcePoolData : BytesHex messageId : BytesHex sourceChainSelector : Numeric 0 - finality : CCIP.FinalityConfig.FinalityConfig + finality : CCIP.CodecV1.FinalityConfig.FinalityConfig output : TokenReceiveTicketClaimed_Output deriving (Eq, Show) diff --git a/contracts/ccip/events/daml/CCIP/EventsV1/Receipts.daml b/contracts/ccip/events/daml/CCIP/EventsV1/Receipts.daml new file mode 100644 index 000000000..804a7b9d0 --- /dev/null +++ b/contracts/ccip/events/daml/CCIP/EventsV1/Receipts.daml @@ -0,0 +1,25 @@ +-- | Ticket contracts for cross-participant CCIP communication. +module CCIP.EventsV1.Receipts where + +import DA.Crypto.Text (BytesHex) + +-- | Issuer type for receipts. +data IssuerType + = IssuerType_CCV -- Cross-chain verifier + | IssuerType_Pool -- Token pool + | IssuerType_Executor -- Executor + | IssuerType_Network -- Network/protocol fee + deriving (Eq, Show) + +-- | Fee/gas accounting for a single entity (CCV, pool, executor, or network). +data Receipt = Receipt + with + issuerType : IssuerType -- Type of issuer + issuerAddress : BytesHex -- 32-byte instance address + versionTag : Optional BytesHex -- 4-byte version tag for CCVs, None for pools/network + destGasLimit : Int -- Gas allocated for dest chain execution + destBytesOverhead : Int -- Data availability overhead in bytes + feeTokenAmount : Numeric 0 -- Fee amount in fee token units + extraArgs : BytesHex -- Entity-specific arguments + deriving (Eq, Show) + diff --git a/contracts/ccip/executor/daml.yaml b/contracts/ccip/executor/daml.yaml index a41402576..d1a48f327 100644 --- a/contracts/ccip/executor/daml.yaml +++ b/contracts/ccip/executor/daml.yaml @@ -10,10 +10,11 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar - - ../core/.daml/dist/ccip-core-2.0.0.dar - - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar diff --git a/contracts/ccip/executor/daml/CCIP/Executor.daml b/contracts/ccip/executor/daml/CCIP/ExecutorV1.daml similarity index 73% rename from contracts/ccip/executor/daml/CCIP/Executor.daml rename to contracts/ccip/executor/daml/CCIP/ExecutorV1.daml index 7ad054037..6fd2fbb6e 100644 --- a/contracts/ccip/executor/daml/CCIP/Executor.daml +++ b/contracts/ccip/executor/daml/CCIP/ExecutorV1.daml @@ -1,4 +1,7 @@ -module CCIP.Executor where +module CCIP.ExecutorV1 ( + module CCIP.ExecutorV1, + module CCIP.ExecutorV1.ExecutorTypes, +) where import DA.Crypto.Text (BytesHex, byteCount) import DA.Foldable (forA_) @@ -7,18 +10,19 @@ import DA.List (dedup) import DA.Optional (fromOptional, fromSomeNote) import qualified DA.Map as Map -import Splice.Api.Token.MetadataV1 (ChoiceContext) +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import Chainlink.InstanceAddress (RawInstanceAddress, assertValidInstanceId) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.FinalityConfig -import qualified CCIP.Internal -import qualified CCIP.Interfaces.Executor -import qualified CCIP.SendingMessageV1 -import CCIP.ExecutorTypes (RemoteChainConfig(..), RemoteChainConfigArgs(..), DynamicConfig(..), ApplyDestChainUpdatesParams(..), SetDynamicConfigParams(..), ApplyAllowedCCVUpdatesParams(..)) -import CCIP.ExecutorCodecGen (decodeApplyDestChainUpdatesParamsAt, decodeSetDynamicConfigParamsAt, decodeApplyAllowedCCVUpdatesParamsAt) +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.InterfacesV1.Executor + +import CCIP.ExecutorV1.ExecutorTypes (RemoteChainConfig(..), RemoteChainConfigArgs(..), DynamicConfig(..), ApplyDestChainUpdatesParams(..), SetDynamicConfigParams(..), ApplyAllowedCCVUpdatesParams(..)) +import CCIP.ExecutorV1.ExecutorCodecGen (decodeApplyDestChainUpdatesParamsAt, decodeSetDynamicConfigParamsAt, decodeApplyAllowedCCVUpdatesParamsAt) template Executor with @@ -26,26 +30,27 @@ template Executor owner : Party maxCCVsPerMsg : Int dynamicConfig : DynamicConfig - allowedCCVs : [RawInstanceAddress] + allowedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] remoteChainConfigs : Map.Map (Numeric 0) RemoteChainConfig where signatory owner - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && maxCCVsPerMsg > 0 - && maxCCVsPerMsg <= CCIP.Internal.maxCCVsPerMessage - && CCIP.FinalityConfig.isValidFinalityConfig dynamicConfig.allowedFinalityConfig + && maxCCVsPerMsg <= CCIP.CodecV1.CCVCodec.maxCCVsPerMessage + && CCIP.CodecV1.FinalityConfig.isValidFinalityConfig dynamicConfig.allowedFinalityConfig - interface instance CCIP.Interfaces.Executor.IExecutor for Executor where - view = CCIP.Interfaces.Executor.ExecutorView with + interface instance CCIP.InterfacesV1.Executor.IExecutor for Executor where + view = CCIP.InterfacesV1.Executor.ExecutorView with instanceId = instanceId owner = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext executor_calculateFeeImpl self arg = do exercise (fromInterfaceContractId @Executor self) CalculateFee with expectedExecutor = arg.expectedExecutor sendingMessageCid = arg.sendingMessageCid executorArgs = arg.executorArgs - extraContext = arg.extraContext + context = arg.context caller = arg.caller executor_getFeeImpl self arg = do @@ -53,6 +58,7 @@ template Executor expectedExecutor = arg.expectedExecutor destChainSelector = arg.destChainSelector requiredCCVs = arg.requiredCCVs + context = arg.context caller = arg.caller choice ApplyDestChainUpdates : ContractId Executor @@ -75,13 +81,13 @@ template Executor controller owner do assertMsg "SetDynamicConfig: BlockDepth finality must be positive" - (CCIP.FinalityConfig.isValidFinalityConfig newDynamicConfig.allowedFinalityConfig) + (CCIP.CodecV1.FinalityConfig.isValidFinalityConfig newDynamicConfig.allowedFinalityConfig) create this with dynamicConfig = newDynamicConfig choice ApplyAllowedCCVUpdates : ContractId Executor with - ccvsToRemove : [RawInstanceAddress] - ccvsToAdd : [RawInstanceAddress] + ccvsToRemove : [Chainlink.InstanceAddress.RawInstanceAddress] + ccvsToAdd : [Chainlink.InstanceAddress.RawInstanceAddress] ccvAllowlistEnabled : Bool controller owner do @@ -109,7 +115,7 @@ template Executor do pure dynamicConfig - nonconsuming choice GetAllowedCCVs : [RawInstanceAddress] + nonconsuming choice GetAllowedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] with caller : Party controller caller @@ -123,7 +129,7 @@ template Executor do pure maxCCVsPerMsg - nonconsuming choice GetAllowedFinalityConfig : CCIP.FinalityConfig.FinalityConfig + nonconsuming choice GetAllowedFinalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig with caller : Party controller caller @@ -131,25 +137,25 @@ template Executor pure dynamicConfig.allowedFinalityConfig -- Calculates the executor flat fee and validates the message. - nonconsuming choice CalculateFee : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice CalculateFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - expectedExecutor : RawInstanceAddress - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + expectedExecutor : Chainlink.InstanceAddress.RawInstanceAddress + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage executorArgs : BytesHex - extraContext : ChoiceContext + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do - RawInstanceAddress.assertEqual "executor: expected executor mismatch" + Chainlink.InstanceAddress.assertEqual "executor: expected executor mismatch" instanceId owner expectedExecutor - sm <- fetch sendingMessageCid + sendingMsg <- fetch sendingMessageCid + let sendingMsgView = view sendingMsg - let remoteCfg = fromSomeNote "executor: unsupported destination chain" - (Map.lookup sm.destChainSelector remoteChainConfigs) + let remoteCfg = fromSomeNote "executor: unsupported destination chain" (Map.lookup sendingMsgView.destChainSelector remoteChainConfigs) assertMsg "executor: destination chain disabled" remoteCfg.enabled - let canonicalCCVs = dedup (sm.requiredCCVs ++ fromOptional [] sm.outboundPoolCCVs) + let canonicalCCVs = dedup (sendingMsgView.requiredCCVs ++ fromOptional [] sendingMsgView.outboundPoolCCVs) if dynamicConfig.ccvAllowlistEnabled then Foldable.forA_ canonicalCCVs (\ccv -> @@ -160,22 +166,24 @@ template Executor assertMsg "executor: too many CCVs in message" (length canonicalCCVs <= maxCCVsPerMsg) - exercise sendingMessageCid CCIP.SendingMessageV1.AddExecutorFee with + exercise sendingMessageCid CCIP.APIV1.SendingMessage.SendingMessage_AddExecutorFee with executorInstanceId = instanceId executorArgs = executorArgs feeUSDCents = remoteCfg.feeUSDCents + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner -- Quote-only fee path for executor. - nonconsuming choice GetFee : CCIP.Interfaces.Executor.ExecutorFeeQuote + nonconsuming choice GetFee : CCIP.InterfacesV1.Executor.ExecutorFeeQuote with - expectedExecutor : RawInstanceAddress + expectedExecutor : Chainlink.InstanceAddress.RawInstanceAddress destChainSelector : Numeric 0 - requiredCCVs : [RawInstanceAddress] + requiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do - RawInstanceAddress.assertEqual "executor: expected executor mismatch" + Chainlink.InstanceAddress.assertEqual "executor: expected executor mismatch" instanceId owner expectedExecutor let remoteCfg = fromSomeNote "executor: unsupported destination chain" @@ -193,10 +201,11 @@ template Executor assertMsg "executor: too many CCVs in message" (length canonicalCCVs <= maxCCVsPerMsg) - pure CCIP.Interfaces.Executor.ExecutorFeeQuote with + pure CCIP.InterfacesV1.Executor.ExecutorFeeQuote with executorInstanceId = instanceId executorOwner = owner feeUSDCents = remoteCfg.feeUSDCents + context = Splice.Api.Token.MetadataV1.emptyChoiceContext interface instance MCMSReceiver for Executor where view = MCMSReceiverView with diff --git a/contracts/ccip/executor/daml/CCIP/ExecutorCodecGen.daml b/contracts/ccip/executor/daml/CCIP/ExecutorV1/ExecutorCodecGen.daml similarity index 86% rename from contracts/ccip/executor/daml/CCIP/ExecutorCodecGen.daml rename to contracts/ccip/executor/daml/CCIP/ExecutorV1/ExecutorCodecGen.daml index 2fd374916..fee653e51 100644 --- a/contracts/ccip/executor/daml/CCIP/ExecutorCodecGen.daml +++ b/contracts/ccip/executor/daml/CCIP/ExecutorV1/ExecutorCodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.ExecutorCodecGen where +module CCIP.ExecutorV1.ExecutorCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.ExecutorTypes (RemoteChainConfig(..), RemoteChainConfigArgs(..), DynamicConfig(..), ApplyDestChainUpdatesParams(..), SetDynamicConfigParams(..), ApplyAllowedCCVUpdatesParams(..)) +import CCIP.ExecutorV1.ExecutorTypes (RemoteChainConfig(..), RemoteChainConfigArgs(..), DynamicConfig(..), ApplyDestChainUpdatesParams(..), SetDynamicConfigParams(..), ApplyAllowedCCVUpdatesParams(..)) import MCMS.Codec ( decodeBoolAt, @@ -19,7 +19,7 @@ import MCMS.Codec ( encodeParty ) -import CCIP.Codec (decodeRawInstanceAddressList, decodeRequestedFinalityAt, encodeRawInstanceAddressList, encodeRequestedFinality) +import CCIP.CodecV1 (decodeRawInstanceAddressAt, decodeRequestedFinalityAt, encodeRawInstanceAddress, encodeRequestedFinality) -- =============================================== @@ -108,14 +108,14 @@ decodeSetDynamicConfigParamsAt encoded offset = do encodeApplyAllowedCCVUpdatesParams : ApplyAllowedCCVUpdatesParams -> BytesHex encodeApplyAllowedCCVUpdatesParams params = - encodeRawInstanceAddressList params.ccvsToRemove - <> encodeRawInstanceAddressList params.ccvsToAdd + encodeList params.ccvsToRemove encodeRawInstanceAddress + <> encodeList params.ccvsToAdd encodeRawInstanceAddress <> encodeBool params.ccvAllowlistEnabled decodeApplyAllowedCCVUpdatesParamsAt : BytesHex -> Int -> Optional (ApplyAllowedCCVUpdatesParams, Int) decodeApplyAllowedCCVUpdatesParamsAt encoded offset = do - (ccvsToRemove, offset) <- decodeRawInstanceAddressList encoded offset - (ccvsToAdd, offset) <- decodeRawInstanceAddressList encoded offset + (ccvsToRemove, offset) <- decodeList encoded offset decodeRawInstanceAddressAt + (ccvsToAdd, offset) <- decodeList encoded offset decodeRawInstanceAddressAt (ccvAllowlistEnabled, offset) <- decodeBoolAt encoded offset Some (ApplyAllowedCCVUpdatesParams{..}, offset) diff --git a/contracts/ccip/executor/daml/CCIP/ExecutorTypes.daml b/contracts/ccip/executor/daml/CCIP/ExecutorV1/ExecutorTypes.daml similarity index 72% rename from contracts/ccip/executor/daml/CCIP/ExecutorTypes.daml rename to contracts/ccip/executor/daml/CCIP/ExecutorV1/ExecutorTypes.daml index 1a6b12084..17e37703f 100644 --- a/contracts/ccip/executor/daml/CCIP/ExecutorTypes.daml +++ b/contracts/ccip/executor/daml/CCIP/ExecutorV1/ExecutorTypes.daml @@ -1,7 +1,8 @@ -module CCIP.ExecutorTypes where +module CCIP.ExecutorV1.ExecutorTypes where -import qualified CCIP.FinalityConfig -import Chainlink.InstanceAddress (RawInstanceAddress) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CodecV1.FinalityConfig data RemoteChainConfig = RemoteChainConfig with @@ -18,7 +19,7 @@ data RemoteChainConfigArgs = RemoteChainConfigArgs data DynamicConfig = DynamicConfig with feeAggregator : Optional Party - allowedFinalityConfig : CCIP.FinalityConfig.FinalityConfig + allowedFinalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig ccvAllowlistEnabled : Bool deriving (Eq, Show) @@ -35,7 +36,7 @@ data SetDynamicConfigParams = SetDynamicConfigParams data ApplyAllowedCCVUpdatesParams = ApplyAllowedCCVUpdatesParams with - ccvsToRemove : [RawInstanceAddress] - ccvsToAdd : [RawInstanceAddress] + ccvsToRemove : [Chainlink.InstanceAddress.RawInstanceAddress] + ccvsToAdd : [Chainlink.InstanceAddress.RawInstanceAddress] ccvAllowlistEnabled : Bool deriving (Eq, Show) diff --git a/contracts/ccip/extension-api/daml.yaml b/contracts/ccip/extension-api/daml.yaml index 23bf6d039..56a4f907d 100644 --- a/contracts/ccip/extension-api/daml.yaml +++ b/contracts/ccip/extension-api/daml.yaml @@ -8,11 +8,9 @@ build-options: data-dependencies: - ../../dependencies/splice/splice-api-token-metadata-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar - - ../core/.daml/dist/ccip-core-2.0.0.dar diff --git a/contracts/ccip/extension-api/daml/CCIP/Interfaces/Executor.daml b/contracts/ccip/extension-api/daml/CCIP/Interfaces/Executor.daml deleted file mode 100644 index 2c5e24be1..000000000 --- a/contracts/ccip/extension-api/daml/CCIP/Interfaces/Executor.daml +++ /dev/null @@ -1,61 +0,0 @@ -module CCIP.Interfaces.Executor where - -import DA.Crypto.Text (BytesHex) - -import Splice.Api.Token.MetadataV1 (ChoiceContext) - -import qualified CCIP.SendingMessageV1 -import Chainlink.InstanceAddress (RawInstanceAddress) -import Chainlink.InstanceAddress qualified as RawInstanceAddress - -interface IExecutor where - viewtype ExecutorView - - executor_calculateFeeImpl : - ContractId IExecutor -> - Executor_CalculateFee -> - Update (ContractId CCIP.SendingMessageV1.SendingMessageV1) - executor_getFeeImpl : - ContractId IExecutor -> - Executor_GetFee -> - Update ExecutorFeeQuote - - nonconsuming choice Executor_CalculateFee : ContractId CCIP.SendingMessageV1.SendingMessageV1 - with - expectedExecutor : RawInstanceAddress - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 - executorArgs : BytesHex - extraContext : ChoiceContext - caller : Party - controller caller - do - let executorView = view this - RawInstanceAddress.assertEqual "executor: expected executor mismatch" - executorView.instanceId executorView.owner expectedExecutor - executor_calculateFeeImpl this self arg - - nonconsuming choice Executor_GetFee : ExecutorFeeQuote - with - expectedExecutor : RawInstanceAddress - destChainSelector : Numeric 0 - requiredCCVs : [RawInstanceAddress] - caller : Party - controller caller - do - let executorView = view this - RawInstanceAddress.assertEqual "executor: expected executor mismatch" - executorView.instanceId executorView.owner expectedExecutor - executor_getFeeImpl this self arg - -data ExecutorView = ExecutorView - with - instanceId : Text - owner : Party - deriving (Eq, Show) - -data ExecutorFeeQuote = ExecutorFeeQuote - with - executorInstanceId : Text - executorOwner : Party - feeUSDCents : Numeric 0 - deriving (Eq, Show) diff --git a/contracts/ccip/extension-api/daml/CCIP/Interfaces/CrossChainVerifier.daml b/contracts/ccip/extension-api/daml/CCIP/InterfacesV1/CrossChainVerifier.daml similarity index 59% rename from contracts/ccip/extension-api/daml/CCIP/Interfaces/CrossChainVerifier.daml rename to contracts/ccip/extension-api/daml/CCIP/InterfacesV1/CrossChainVerifier.daml index 20869cd10..f2890c9e3 100644 --- a/contracts/ccip/extension-api/daml/CCIP/Interfaces/CrossChainVerifier.daml +++ b/contracts/ccip/extension-api/daml/CCIP/InterfacesV1/CrossChainVerifier.daml @@ -1,41 +1,37 @@ -module CCIP.Interfaces.CrossChainVerifier where +module CCIP.InterfacesV1.CrossChainVerifier where import DA.Crypto.Text (BytesHex) -import Splice.Api.Token.MetadataV1 (ChoiceContext) +import qualified Splice.Api.Token.MetadataV1 -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.Internal -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 - -useDefaultCCVs = CCIP.Internal.useDefaultCCVs +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.SendingMessage interface ICrossChainVerifier where viewtype CrossChainVerifierView - crossChainVerifier_verifyMessageImpl : ContractId ICrossChainVerifier -> CrossChainVerifier_VerifyMessage -> Update (ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1) - crossChainVerifier_calculateFeeImpl : ContractId ICrossChainVerifier -> CrossChainVerifier_CalculateFee -> Update (ContractId CCIP.SendingMessageV1.SendingMessageV1) + crossChainVerifier_verifyMessageImpl : ContractId ICrossChainVerifier -> CrossChainVerifier_VerifyMessage -> Update (ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage) + crossChainVerifier_calculateFeeImpl : ContractId ICrossChainVerifier -> CrossChainVerifier_CalculateFee -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) crossChainVerifier_getFeeImpl : ContractId ICrossChainVerifier -> CrossChainVerifier_GetFee -> Update CrossChainVerifierFeeQuote - crossChainVerifier_forwardToVerifierImpl : ContractId ICrossChainVerifier -> CrossChainVerifier_ForwardToVerifier -> Update (ContractId CCIP.SendingMessageV1.SendingMessageV1) + crossChainVerifier_forwardToVerifierImpl : ContractId ICrossChainVerifier -> CrossChainVerifier_ForwardToVerifier -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) -- Verify an inbound message and append a CCV verification to ExecutingMessageV1. - nonconsuming choice CrossChainVerifier_VerifyMessage : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + nonconsuming choice CrossChainVerifier_VerifyMessage : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage with - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : ChoiceContext - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + executingMessageCid : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage verifierResults : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do crossChainVerifier_verifyMessageImpl this self arg -- Calculate fee for outbound message (USD cents only). - nonconsuming choice CrossChainVerifier_CalculateFee - : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice CrossChainVerifier_CalculateFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 - extraContext : ChoiceContext + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do crossChainVerifier_calculateFeeImpl this self arg @@ -44,19 +40,19 @@ interface ICrossChainVerifier where nonconsuming choice CrossChainVerifier_GetFee : CrossChainVerifierFeeQuote with destChainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do crossChainVerifier_getFeeImpl this self arg -- Forward message for verification and append verifier data to -- SendingMessageV1. - nonconsuming choice CrossChainVerifier_ForwardToVerifier - : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice CrossChainVerifier_ForwardToVerifier : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage verifierArgs : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do crossChainVerifier_forwardToVerifierImpl this self arg @@ -67,6 +63,7 @@ data CrossChainVerifierView = CrossChainVerifierView owner : Party ccipOwner : Party storageLocations : [Text] + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) data CrossChainVerifierFeeQuote = CrossChainVerifierFeeQuote @@ -76,4 +73,5 @@ data CrossChainVerifierFeeQuote = CrossChainVerifierFeeQuote feeUSDCents : Numeric 0 gasForVerification : Int payloadSizeBytes : Int + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) diff --git a/contracts/ccip/extension-api/daml/CCIP/InterfacesV1/Executor.daml b/contracts/ccip/extension-api/daml/CCIP/InterfacesV1/Executor.daml new file mode 100644 index 000000000..77b013197 --- /dev/null +++ b/contracts/ccip/extension-api/daml/CCIP/InterfacesV1/Executor.daml @@ -0,0 +1,56 @@ +module CCIP.InterfacesV1.Executor where + +import DA.Crypto.Text (BytesHex) + +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.SendingMessage + +interface IExecutor where + viewtype ExecutorView + + executor_calculateFeeImpl : ContractId IExecutor -> Executor_CalculateFee -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) + executor_getFeeImpl : ContractId IExecutor -> Executor_GetFee -> Update ExecutorFeeQuote + + nonconsuming choice Executor_CalculateFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + with + expectedExecutor : Chainlink.InstanceAddress.RawInstanceAddress + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + executorArgs : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do + let executorView = view this + Chainlink.InstanceAddress.assertEqual "executor: expected executor mismatch" executorView.instanceId executorView.owner expectedExecutor + executor_calculateFeeImpl this self arg + + nonconsuming choice Executor_GetFee : ExecutorFeeQuote + with + expectedExecutor : Chainlink.InstanceAddress.RawInstanceAddress + destChainSelector : Numeric 0 + requiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + context : Splice.Api.Token.MetadataV1.ChoiceContext + caller : Party + controller caller + do + let executorView = view this + Chainlink.InstanceAddress.assertEqual "executor: expected executor mismatch" executorView.instanceId executorView.owner expectedExecutor + executor_getFeeImpl this self arg + +data ExecutorView = ExecutorView + with + instanceId : Text + owner : Party + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) + +data ExecutorFeeQuote = ExecutorFeeQuote + with + executorInstanceId : Text + executorOwner : Party + feeUSDCents : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext + deriving (Eq, Show) diff --git a/contracts/ccip/extension-api/daml/CCIP/Interfaces/TokenPool.daml b/contracts/ccip/extension-api/daml/CCIP/InterfacesV1/TokenPool.daml similarity index 58% rename from contracts/ccip/extension-api/daml/CCIP/Interfaces/TokenPool.daml rename to contracts/ccip/extension-api/daml/CCIP/InterfacesV1/TokenPool.daml index ea918965b..acf009d6f 100644 --- a/contracts/ccip/extension-api/daml/CCIP/Interfaces/TokenPool.daml +++ b/contracts/ccip/extension-api/daml/CCIP/InterfacesV1/TokenPool.daml @@ -1,4 +1,4 @@ -module CCIP.Interfaces.TokenPool where +module CCIP.InterfacesV1.TokenPool where import DA.Crypto.Text (BytesHex) @@ -6,15 +6,13 @@ import qualified Splice.Api.Token.HoldingV1 import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.FeeQuoter -import qualified CCIP.FinalityConfig -import Chainlink.InstanceAddress (RawInstanceAddress) -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 -import qualified CCIP.Tickets -import qualified CCIP.Events -import qualified CCIP.TokenAdminRegistry +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.APIV1.TokenAdminRegistry -- | Direction of token transfer for CCV requirement lookup. data TransferDirection = Outbound | Inbound @@ -23,46 +21,47 @@ data TransferDirection = Outbound | Inbound interface ITokenPool where viewtype TokenPoolView - tokenPool_getRequiredCCVsImpl : ContractId ITokenPool -> TokenPool_GetRequiredCCVs -> Update [RawInstanceAddress] - tokenPool_verifyInboundMessageImpl : ContractId ITokenPool -> TokenPool_VerifyInboundMessage -> Update (ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1) - tokenPool_verifyOutboundCCVsImpl : ContractId ITokenPool -> TokenPool_VerifyOutboundCCVs -> Update (ContractId CCIP.SendingMessageV1.SendingMessageV1) + tokenPool_getRequiredCCVsImpl : ContractId ITokenPool -> TokenPool_GetRequiredCCVs -> Update [Chainlink.InstanceAddress.RawInstanceAddress] + tokenPool_verifyInboundMessageImpl : ContractId ITokenPool -> TokenPool_VerifyInboundMessage -> Update (ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage) + tokenPool_verifyOutboundCCVsImpl : ContractId ITokenPool -> TokenPool_VerifyOutboundCCVs -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) tokenPool_releaseFromTicketImpl : ContractId ITokenPool -> TokenPool_ReleaseFromTicket -> Update ReleaseOrMintResult tokenPool_lockOrBurnImpl : ContractId ITokenPool -> TokenPool_LockOrBurn -> Update LockOrBurnResult - tokenPool_calculateFeeImpl : ContractId ITokenPool -> TokenPool_CalculateFee -> Update (ContractId CCIP.SendingMessageV1.SendingMessageV1) + tokenPool_calculateFeeImpl : ContractId ITokenPool -> TokenPool_CalculateFee -> Update (ContractId CCIP.APIV1.SendingMessage.ISendingMessage) tokenPool_getFeeImpl : ContractId ITokenPool -> TokenPool_GetFee -> Update TokenPoolFeeQuote -- Get required CCV raw instance addresses for a transfer based on direction, amount, finality, etc. - nonconsuming choice TokenPool_GetRequiredCCVs : [RawInstanceAddress] + nonconsuming choice TokenPool_GetRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] with remoteChainSelector : Numeric 0 sourceAmount : BytesHex - finality : CCIP.FinalityConfig.FinalityConfig + finality : BytesHex extraData : BytesHex direction : TransferDirection + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do tokenPool_getRequiredCCVsImpl this self arg -- Validate inbound token transfer message and record pool CCV requirements on ExecutingMessageV1 via TAR. -- Validates source pool address against allowed remote pools and records inbound CCVs. - nonconsuming choice TokenPool_VerifyInboundMessage : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + nonconsuming choice TokenPool_VerifyInboundMessage : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + executingMessageCid : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do tokenPool_verifyInboundMessageImpl this self arg -- Verify outbound CCVs and record pool-required CCVs on SendingMessageV1 via TAR. - nonconsuming choice TokenPool_VerifyOutboundCCVs : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice TokenPool_VerifyOutboundCCVs : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage amount : Decimal + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do tokenPool_verifyOutboundCCVsImpl this self arg @@ -71,11 +70,11 @@ interface ITokenPool where -- The pool should consume the ticket via ConsumeReceiveTicket. nonconsuming choice TokenPool_ReleaseFromTicket : ReleaseOrMintResult with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - tokenReceiveTicketCid : ContractId CCIP.Tickets.TokenReceiveTicket + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + tokenReceiveTicketCid : ContractId CCIP.APIV1.ExecutingMessage.ITokenReceiveTicket + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do tokenPool_releaseFromTicketImpl this self arg @@ -85,28 +84,27 @@ interface ITokenPool where -- through TAR after pool-registration validation. nonconsuming choice TokenPool_LockOrBurn : LockOrBurnResult with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage senderInputCids : [ContractId Splice.Api.Token.HoldingV1.Holding] amount : Decimal + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do tokenPool_lockOrBurnImpl this self arg -- Calculate fee for outbound token transfer, which it records on -- SendingMessageV1 through TAR after pool-registration validation. - nonconsuming choice TokenPool_CalculateFee - : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice TokenPool_CalculateFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + feeQuoterCid : ContractId CCIP.APIV1.FeeQuoter.IFeeQuoter tokenInstrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do tokenPool_calculateFeeImpl this self arg @@ -114,9 +112,10 @@ interface ITokenPool where -- Quote-only fee path for outbound token transfers. nonconsuming choice TokenPool_GetFee : TokenPoolFeeQuote with - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter + feeQuoterCid : ContractId CCIP.APIV1.FeeQuoter.IFeeQuoter destChainSelector : Numeric 0 tokenInstrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do tokenPool_getFeeImpl this self arg @@ -127,13 +126,15 @@ data TokenPoolView = TokenPoolView owner : Party ccipOwner : Party instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) data ReleaseOrMintResult = ReleaseOrMintResult with output : ReleaseOrMintResult_Output poolChangeCids : [ContractId Splice.Api.Token.HoldingV1.Holding] - claimedEventCid : ContractId CCIP.Events.TokenReceiveTicketClaimed + claimedEventCid : ContractId () + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) data ReleaseOrMintResult_Output @@ -147,7 +148,8 @@ data LockOrBurnResult = LockOrBurnResult with poolChangeCids : [ContractId Splice.Api.Token.HoldingV1.Holding] senderChangeCids : [ContractId Splice.Api.Token.HoldingV1.Holding] - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) data TokenPoolFeeQuote = TokenPoolFeeQuote @@ -159,4 +161,5 @@ data TokenPoolFeeQuote = TokenPoolFeeQuote destBytesOverhead : Int tokenFeeBps : Numeric 0 isEnabled : Bool + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) diff --git a/contracts/ccip/factory/daml.yaml b/contracts/ccip/factory/daml.yaml index 722e994cb..bfc667b90 100644 --- a/contracts/ccip/factory/daml.yaml +++ b/contracts/ccip/factory/daml.yaml @@ -10,6 +10,13 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../tickets/.daml/dist/ccip-tickets-2.0.0.dar + - ../utils/.daml/dist/ccip-utils-2.0.0.dar + - ../events/.daml/dist/ccip-events-2.0.0.dar + - ../rate-limiter/.daml/dist/ccip-rate-limiter-2.0.0.dar + - ../client-api/.daml/dist/ccip-client-api-2.0.0.dar dependencies: - daml-prim - daml-stdlib diff --git a/contracts/ccip/factory/daml/CCIP/Factory.daml b/contracts/ccip/factory/daml/CCIP/FactoryV1.daml similarity index 84% rename from contracts/ccip/factory/daml/CCIP/Factory.daml rename to contracts/ccip/factory/daml/CCIP/FactoryV1.daml index 06f62159a..193e62a15 100644 --- a/contracts/ccip/factory/daml/CCIP/Factory.daml +++ b/contracts/ccip/factory/daml/CCIP/FactoryV1.daml @@ -1,10 +1,13 @@ -module CCIP.Factory where +module CCIP.FactoryV1 where import DA.Map qualified as Map import DA.Set qualified as Set import DA.Crypto.Text (BytesHex, byteCount) import DA.Optional (isNone) +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) import MCMS.Codec ( decodeTextAt @@ -20,39 +23,29 @@ import MCMS.Codec , decodeUint8 , extractBytes ) -import CCIP.Codec - ( decodeRawInstanceAddressAt - , decodeInstrumentId - , decodeRequestedFinalityAt - ) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import Chainlink.InstanceAddress (assertValidInstanceId) -import qualified Splice.Api.Token.HoldingV1 -import qualified Splice.Api.Token.MetadataV1 +import qualified Chainlink.InstanceAddress + import qualified Link.Token -import qualified CCIP.GlobalConfig -import qualified CCIP.FeeQuoter -import qualified CCIP.TokenAdminRegistry -import qualified CCIP.OnRamp -import qualified CCIP.OnRampTypes as CCIP.OnRamp -import qualified CCIP.OffRamp -import qualified CCIP.OffRampTypes as CCIP.OffRamp -import qualified CCIP.PerPartyRouter -import qualified CCIP.PerPartyRouterTypes as CCIP.PerPartyRouter -import qualified CCIP.LockReleaseTokenPool -import qualified CCIP.BurnMintTokenPool -import qualified CCIP.CommitteeVerifier -import qualified CCIP.RMNRemote -import qualified CCIP.Executor -import qualified CCIP.ExecutorTypes -import qualified CCIP.RateLimiter -import qualified CCIP.FinalityConfig -import CCIP.ContextCodec (decodeChoiceContextAt) -import CCIP.LockReleaseTokenPoolCodecGen (decodeTransferTimeoutAt) -import qualified CCIP.BurnMintTokenPoolCodecGen -import CCIP.LockReleaseTokenPoolTypes (TransferTimeout(..)) +import qualified CCIP.BurnMintTokenPoolV1 +import qualified CCIP.BurnMintTokenPoolV1CodecGen +import qualified CCIP.CodecV1.FinalityConfig +import CCIP.CodecV1 (decodeRawInstanceAddressAt, decodeInstrumentId, decodeRequestedFinalityAt) +import qualified CCIP.CommitteeVerifierV1 +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.ExecutorV1 +import qualified CCIP.LockReleaseTokenPoolV1 +import CCIP.LockReleaseTokenPoolV1CodecGen (decodeTransferTimeoutAt) +import CCIP.LockReleaseTokenPoolV1Types (TransferTimeout(..)) +import qualified CCIP.RuntimeV1.OffRamp +import qualified CCIP.RuntimeV1.OnRamp +import qualified CCIP.RuntimeV1.PerPartyRouter +import qualified CCIP.RateLimiterV1 +import qualified CCIP.UtilsV1.Context -- | Stable contract for CCIP system deployment orchestration. -- @@ -78,7 +71,7 @@ template CCIPFactory where signatory owner observer mcmsParty - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId interface instance MCMSReceiver for CCIPFactory where view = MCMSReceiverView with @@ -86,7 +79,7 @@ template CCIPFactory instanceId mcmsEntrypoint functionName operationData contractIds = do - let selfAddress = RawInstanceAddress.makeText instanceId owner + let selfAddress = Chainlink.InstanceAddress.makeText instanceId owner selfCid <- case Map.lookup selfAddress contractIds of None -> abort $ "E_SELF_CID_NOT_IN_MAP: " <> selfAddress Some cid -> pure (coerceContractId cid : ContractId CCIPFactory) @@ -102,7 +95,7 @@ template CCIPFactory params <- requireDecoded "DeployGlobalConfig" (decodeDeployGlobalConfigParams operationData) deployResult <- exercise selfCid DeployGlobalConfig with contract = mkGlobalConfigContract owner params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -110,7 +103,7 @@ template CCIPFactory params <- requireDecoded "DeployFeeQuoter" (decodeDeployFeeQuoterParams operationData) deployResult <- exercise selfCid DeployFeeQuoter with contract = mkFeeQuoterContract owner params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -118,7 +111,7 @@ template CCIPFactory params <- requireDecoded "DeployLinkToken" (decodeDeployLinkTokenParams operationData) deployResult <- exercise selfCid DeployLinkToken with contract = mkLinkTokenContract owner params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -126,7 +119,7 @@ template CCIPFactory params <- requireDecoded "DeployTokenAdminRegistry" (decodeDeployTokenAdminRegistryParams operationData) deployResult <- exercise selfCid DeployTokenAdminRegistry with contract = mkTokenAdminRegistryContract owner params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -134,7 +127,7 @@ template CCIPFactory params <- requireDecoded "DeployOnRamp" (decodeDeployOnRampParams operationData) deployResult <- exercise selfCid DeployOnRamp with contract = mkOnRampContract owner params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -142,7 +135,7 @@ template CCIPFactory params <- requireDecoded "DeployOffRamp" (decodeDeployOffRampParams operationData) deployResult <- exercise selfCid DeployOffRamp with contract = mkOffRampContract owner params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -150,7 +143,7 @@ template CCIPFactory params <- requireDecoded "DeployPerPartyRouterFactory" (decodeDeployPerPartyRouterFactoryParams operationData) deployResult <- exercise selfCid DeployPerPartyRouterFactory with contract = mkPerPartyRouterFactoryContract owner params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -158,7 +151,7 @@ template CCIPFactory params <- requireDecoded "DeployRMNRemote" (decodeDeployRMNRemoteParams operationData) deployResult <- exercise selfCid DeployRMNRemote with contract = mkRMNRemoteContract params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -166,7 +159,7 @@ template CCIPFactory params <- requireDecoded "DeployCommitteeVerifier" (decodeDeployCommitteeVerifierParams operationData) deployResult <- exercise selfCid DeployCommitteeVerifier with contract = mkCommitteeVerifierContract params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -174,7 +167,7 @@ template CCIPFactory params <- requireDecoded "DeployExecutor" (decodeDeployExecutorParams operationData) deployResult <- exercise selfCid DeployExecutor with contract = mkExecutorContract params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -182,7 +175,7 @@ template CCIPFactory params <- requireDecoded "DeployLockReleaseTokenPool" (decodeDeployLockReleaseTokenPoolParams operationData) deployResult <- exercise selfCid DeployLockReleaseTokenPool with contract = mkLockReleaseTokenPoolContract params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -190,7 +183,7 @@ template CCIPFactory params <- requireDecoded "DeployBurnMintTokenPool" (decodeDeployBurnMintTokenPoolParams operationData) deployResult <- exercise selfCid DeployBurnMintTokenPool with contract = mkBurnMintTokenPoolContract params - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -199,7 +192,7 @@ template CCIPFactory rateLimiterContract <- mkRateLimiterContract params deployResult <- exercise selfCid DeployRateLimiter with contract = rateLimiterContract - let deployedAddress = RawInstanceAddress.makeText params.instanceId owner + let deployedAddress = Chainlink.InstanceAddress.makeText params.instanceId owner pure (Map.insert deployedAddress (coerceContractId deployResult.deployedCid) (Map.insert selfAddress (coerceContractId deployResult.factoryCid) contractIds)) @@ -231,7 +224,7 @@ template CCIPFactory choice DeployGlobalConfig : DeployResult with - contract : CCIP.GlobalConfig.GlobalConfig + contract : CCIP.CoreV1.GlobalConfig.GlobalConfig controller owner do assertFactoryIsMCMSControlled this @@ -249,7 +242,7 @@ template CCIPFactory choice DeployFeeQuoter : DeployResult with - contract : CCIP.FeeQuoter.FeeQuoter + contract : CCIP.CoreV1.FeeQuoter.FeeQuoter controller owner do assertFactoryIsMCMSControlled this @@ -286,7 +279,7 @@ template CCIPFactory choice DeployTokenAdminRegistry : DeployResult with - contract : CCIP.TokenAdminRegistry.TokenAdminRegistry + contract : CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry controller owner do assertFactoryIsMCMSControlled this @@ -304,7 +297,7 @@ template CCIPFactory choice DeployOnRamp : DeployResult with - contract : CCIP.OnRamp.OnRamp + contract : CCIP.RuntimeV1.OnRamp.OnRamp controller owner do assertFactoryIsMCMSControlled this @@ -322,7 +315,7 @@ template CCIPFactory choice DeployOffRamp : DeployResult with - contract : CCIP.OffRamp.OffRamp + contract : CCIP.RuntimeV1.OffRamp.OffRamp controller owner do assertFactoryIsMCMSControlled this @@ -340,7 +333,7 @@ template CCIPFactory choice DeployPerPartyRouterFactory : DeployResult with - contract : CCIP.PerPartyRouter.PerPartyRouterFactory + contract : CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory controller owner do assertFactoryIsMCMSControlled this @@ -360,7 +353,7 @@ template CCIPFactory choice DeployRMNRemote : DeployResult with - contract : CCIP.RMNRemote.RMNRemote + contract : CCIP.CoreV1.RMNRemote.RMNRemote controller owner do assertFactoryIsMCMSControlled this @@ -378,7 +371,7 @@ template CCIPFactory choice DeployCommitteeVerifier : DeployResult with - contract : CCIP.CommitteeVerifier.CommitteeVerifier + contract : CCIP.CommitteeVerifierV1.CommitteeVerifier controller owner do assertFactoryIsMCMSControlled this @@ -397,7 +390,7 @@ template CCIPFactory choice DeployExecutor : DeployResult with - contract : CCIP.Executor.Executor + contract : CCIP.ExecutorV1.Executor controller owner do assertFactoryIsMCMSControlled this @@ -416,7 +409,7 @@ template CCIPFactory choice DeployLockReleaseTokenPool : DeployResult with - contract : CCIP.LockReleaseTokenPool.LockReleaseTokenPool + contract : CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool controller owner do assertFactoryIsMCMSControlled this @@ -435,7 +428,7 @@ template CCIPFactory choice DeployBurnMintTokenPool : DeployResult with - contract : CCIP.BurnMintTokenPool.BurnMintTokenPool + contract : CCIP.BurnMintTokenPoolV1.BurnMintTokenPool controller owner do assertFactoryIsMCMSControlled this @@ -454,7 +447,7 @@ template CCIPFactory choice DeployRateLimiter : DeployResult with - contract : CCIP.RateLimiter.RateLimiter + contract : CCIP.RateLimiterV1.RateLimiter controller owner do assertFactoryIsMCMSControlled this @@ -513,31 +506,30 @@ data DeployTokenAdminRegistryParams = DeployTokenAdminRegistryParams data DeployOnRampParams = DeployOnRampParams with instanceId : Text - globalConfig : RawInstanceAddress.RawInstanceAddress - rmnRemote : RawInstanceAddress.RawInstanceAddress - tokenAdminRegistry : RawInstanceAddress.RawInstanceAddress - feeQuoter : RawInstanceAddress.RawInstanceAddress - ccvRegistry : RawInstanceAddress.RawInstanceAddress + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress maxUSDCentsPerMsg : Numeric 0 deriving (Eq, Show) data DeployOffRampParams = DeployOffRampParams with instanceId : Text - globalConfig : RawInstanceAddress.RawInstanceAddress - rmnRemote : RawInstanceAddress.RawInstanceAddress - tokenAdminRegistry : RawInstanceAddress.RawInstanceAddress + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) data DeployPerPartyRouterFactoryParams = DeployPerPartyRouterFactoryParams with instanceId : Text - onRamp : RawInstanceAddress.RawInstanceAddress - offRamp : RawInstanceAddress.RawInstanceAddress - globalConfig : RawInstanceAddress.RawInstanceAddress - tokenAdminRegistry : RawInstanceAddress.RawInstanceAddress - feeQuoter : RawInstanceAddress.RawInstanceAddress - rmnRemote : RawInstanceAddress.RawInstanceAddress + onRamp : Chainlink.InstanceAddress.RawInstanceAddress + offRamp : Chainlink.InstanceAddress.RawInstanceAddress + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) data DeployRMNRemoteParams = DeployRMNRemoteParams @@ -557,7 +549,7 @@ data DeployCommitteeVerifierParams = DeployCommitteeVerifierParams versionTag : BytesHex allowListAdmin : Optional Party messageSentObservers : [Party] - rmnRemote : RawInstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress storageLocations : [Text] storageLocationsAdmin : Party pendingStorageLocationsAdmin : Party @@ -568,7 +560,7 @@ data DeployExecutorParams = DeployExecutorParams instanceId : Text owner : Party maxCCVsPerMsg : Int - allowedFinalityConfig : CCIP.FinalityConfig.FinalityConfig + allowedFinalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig ccvAllowlistEnabled : Bool deriving (Eq, Show) @@ -580,9 +572,9 @@ data DeployLockReleaseTokenPoolParams = DeployLockReleaseTokenPoolParams instrumentId : Splice.Api.Token.HoldingV1.InstrumentId decimals : Int rateLimitAdmin : Optional Party - tokenAdminRegistry : RawInstanceAddress.RawInstanceAddress - feeQuoter : RawInstanceAddress.RawInstanceAddress - rmnRemote : RawInstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress poolReceiveContext : Splice.Api.Token.MetadataV1.ChoiceContext transferTimeout : TransferTimeout deriving (Eq, Show) @@ -595,11 +587,11 @@ data DeployBurnMintTokenPoolParams = DeployBurnMintTokenPoolParams instrumentId : Splice.Api.Token.HoldingV1.InstrumentId decimals : Int rateLimitAdmin : Optional Party - tokenAdminRegistry : RawInstanceAddress.RawInstanceAddress - feeQuoter : RawInstanceAddress.RawInstanceAddress - rmnRemote : RawInstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress poolReceiveContext : Splice.Api.Token.MetadataV1.ChoiceContext - transferTimeout : CCIP.BurnMintTokenPool.TransferTimeout + transferTimeout : CCIP.BurnMintTokenPoolV1.TransferTimeout deriving (Eq, Show) data DeployRateLimiterParams = DeployRateLimiterParams @@ -608,8 +600,8 @@ data DeployRateLimiterParams = DeployRateLimiterParams poolInstanceId : Text poolOwner : Party remoteChainSelector : Numeric 0 - direction : CCIP.RateLimiter.RateLimitDirection - mode : CCIP.RateLimiter.RateLimitMode + direction : CCIP.RateLimiterV1.RateLimitDirection + mode : CCIP.RateLimiterV1.RateLimitMode isEnabled : Bool capacity : Numeric 0 rate : Numeric 0 @@ -621,18 +613,18 @@ requireDecoded functionName decoded = None -> abort ("E_INVALID_PARAMS: " <> functionName) Some value -> pure value -mkGlobalConfigContract : Party -> DeployGlobalConfigParams -> CCIP.GlobalConfig.GlobalConfig -mkGlobalConfigContract ccipOwner params = CCIP.GlobalConfig.GlobalConfig with +mkGlobalConfigContract : Party -> DeployGlobalConfigParams -> CCIP.CoreV1.GlobalConfig.GlobalConfig +mkGlobalConfigContract ccipOwner params = CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = params.instanceId ccipOwner chainSelector = params.chainSelector destChainConfigs = Map.empty sourceChainConfigs = Map.empty -mkFeeQuoterContract : Party -> DeployFeeQuoterParams -> CCIP.FeeQuoter.FeeQuoter -mkFeeQuoterContract owner params = CCIP.FeeQuoter.FeeQuoter with +mkFeeQuoterContract : Party -> DeployFeeQuoterParams -> CCIP.CoreV1.FeeQuoter.FeeQuoter +mkFeeQuoterContract owner params = CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = params.instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -648,38 +640,37 @@ mkLinkTokenContract owner params = Link.Token.LinkRegistry with instanceId = params.instanceId registryMeta = Splice.Api.Token.MetadataV1.emptyMetadata -mkTokenAdminRegistryContract : Party -> DeployTokenAdminRegistryParams -> CCIP.TokenAdminRegistry.TokenAdminRegistry -mkTokenAdminRegistryContract owner params = CCIP.TokenAdminRegistry.TokenAdminRegistry with +mkTokenAdminRegistryContract : Party -> DeployTokenAdminRegistryParams -> CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry +mkTokenAdminRegistryContract ccipOwner params = CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = params.instanceId - owner + ccipOwner = ccipOwner entryCount = 0 -mkOnRampContract : Party -> DeployOnRampParams -> CCIP.OnRamp.OnRamp -mkOnRampContract ccipOwner params = CCIP.OnRamp.OnRamp with +mkOnRampContract : Party -> DeployOnRampParams -> CCIP.RuntimeV1.OnRamp.OnRamp +mkOnRampContract ccipOwner params = CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = params.instanceId ccipOwner maxUSDCentsPerMsg = params.maxUSDCentsPerMsg - deps = CCIP.OnRamp.OnRampDeps with + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with globalConfig = params.globalConfig rmnRemote = params.rmnRemote tokenAdminRegistry = params.tokenAdminRegistry feeQuoter = params.feeQuoter - ccvRegistry = params.ccvRegistry -mkOffRampContract : Party -> DeployOffRampParams -> CCIP.OffRamp.OffRamp -mkOffRampContract ccipOwner params = CCIP.OffRamp.OffRamp with +mkOffRampContract : Party -> DeployOffRampParams -> CCIP.RuntimeV1.OffRamp.OffRamp +mkOffRampContract ccipOwner params = CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = params.instanceId ccipOwner - deps = CCIP.OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = params.globalConfig rmnRemote = params.rmnRemote tokenAdminRegistry = params.tokenAdminRegistry -mkPerPartyRouterFactoryContract : Party -> DeployPerPartyRouterFactoryParams -> CCIP.PerPartyRouter.PerPartyRouterFactory -mkPerPartyRouterFactoryContract ccipOwner params = CCIP.PerPartyRouter.PerPartyRouterFactory with +mkPerPartyRouterFactoryContract : Party -> DeployPerPartyRouterFactoryParams -> CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory +mkPerPartyRouterFactoryContract ccipOwner params = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = params.instanceId ccipOwner - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with onRamp = params.onRamp offRamp = params.offRamp globalConfig = params.globalConfig @@ -688,16 +679,16 @@ mkPerPartyRouterFactoryContract ccipOwner params = CCIP.PerPartyRouter.PerPartyR rmnRemote = params.rmnRemote registeredRouters = Map.empty -mkRMNRemoteContract : DeployRMNRemoteParams -> CCIP.RMNRemote.RMNRemote -mkRMNRemoteContract params = CCIP.RMNRemote.RMNRemote with +mkRMNRemoteContract : DeployRMNRemoteParams -> CCIP.CoreV1.RMNRemote.RMNRemote +mkRMNRemoteContract params = CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = params.instanceId rmnOwner = params.rmnOwner ccipOwner = params.ccipOwner customObservers = params.customObservers cursedSubjects = params.cursedSubjects -mkCommitteeVerifierContract : DeployCommitteeVerifierParams -> CCIP.CommitteeVerifier.CommitteeVerifier -mkCommitteeVerifierContract params = CCIP.CommitteeVerifier.CommitteeVerifier with +mkCommitteeVerifierContract : DeployCommitteeVerifierParams -> CCIP.CommitteeVerifierV1.CommitteeVerifier +mkCommitteeVerifierContract params = CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = params.instanceId owner = params.owner ccipOwner = params.ccipOwner @@ -709,23 +700,23 @@ mkCommitteeVerifierContract params = CCIP.CommitteeVerifier.CommitteeVerifier wi pendingStorageLocationsAdmin = params.pendingStorageLocationsAdmin remoteChainConfigs = Map.empty signerConfigs = Map.empty - deps = CCIP.CommitteeVerifier.CommitteeVerifierDeps with + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = params.rmnRemote -mkExecutorContract : DeployExecutorParams -> CCIP.Executor.Executor -mkExecutorContract params = CCIP.Executor.Executor with +mkExecutorContract : DeployExecutorParams -> CCIP.ExecutorV1.Executor +mkExecutorContract params = CCIP.ExecutorV1.Executor with instanceId = params.instanceId owner = params.owner maxCCVsPerMsg = params.maxCCVsPerMsg - dynamicConfig = CCIP.ExecutorTypes.DynamicConfig with + dynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None allowedFinalityConfig = params.allowedFinalityConfig ccvAllowlistEnabled = params.ccvAllowlistEnabled allowedCCVs = [] remoteChainConfigs = Map.empty -mkLockReleaseTokenPoolContract : DeployLockReleaseTokenPoolParams -> CCIP.LockReleaseTokenPool.LockReleaseTokenPool -mkLockReleaseTokenPoolContract params = CCIP.LockReleaseTokenPool.LockReleaseTokenPool with +mkLockReleaseTokenPoolContract : DeployLockReleaseTokenPoolParams -> CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool +mkLockReleaseTokenPoolContract params = CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with instanceId = params.instanceId poolOwner = params.poolOwner ccipOwner = params.ccipOwner @@ -736,13 +727,13 @@ mkLockReleaseTokenPoolContract params = CCIP.LockReleaseTokenPool.LockReleaseTok tokenTransferFeeConfigs = Map.empty poolReceiveContext = params.poolReceiveContext transferTimeout = params.transferTimeout - deps = CCIP.LockReleaseTokenPool.LockReleaseTokenPoolDeps with + deps = CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPoolDeps with tokenAdminRegistry = params.tokenAdminRegistry rmnRemote = params.rmnRemote feeQuoter = params.feeQuoter -mkBurnMintTokenPoolContract : DeployBurnMintTokenPoolParams -> CCIP.BurnMintTokenPool.BurnMintTokenPool -mkBurnMintTokenPoolContract params = CCIP.BurnMintTokenPool.BurnMintTokenPool with +mkBurnMintTokenPoolContract : DeployBurnMintTokenPoolParams -> CCIP.BurnMintTokenPoolV1.BurnMintTokenPool +mkBurnMintTokenPoolContract params = CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = params.instanceId poolOwner = params.poolOwner ccipOwner = params.ccipOwner @@ -753,15 +744,15 @@ mkBurnMintTokenPoolContract params = CCIP.BurnMintTokenPool.BurnMintTokenPool wi tokenTransferFeeConfigs = Map.empty poolReceiveContext = params.poolReceiveContext transferTimeout = params.transferTimeout - deps = CCIP.BurnMintTokenPool.BurnMintTokenPoolDeps with + deps = CCIP.BurnMintTokenPoolV1.BurnMintTokenPoolDeps with tokenAdminRegistry = params.tokenAdminRegistry rmnRemote = params.rmnRemote feeQuoter = params.feeQuoter -mkRateLimiterContract : DeployRateLimiterParams -> Update CCIP.RateLimiter.RateLimiter +mkRateLimiterContract : DeployRateLimiterParams -> Update CCIP.RateLimiterV1.RateLimiter mkRateLimiterContract params = do now <- getTime - pure (CCIP.RateLimiter.RateLimiter with + pure (CCIP.RateLimiterV1.RateLimiter with instanceId = params.instanceId poolInstanceId = params.poolInstanceId poolOwner = params.poolOwner @@ -819,8 +810,7 @@ decodeDeployOnRampParams encoded = do (rmnRemote, offset3) <- decodeRawInstanceAddressAt encoded offset2 (tokenAdminRegistry, offset4) <- decodeRawInstanceAddressAt encoded offset3 (feeQuoter, offset5) <- decodeRawInstanceAddressAt encoded offset4 - (ccvRegistry, offset6) <- decodeRawInstanceAddressAt encoded offset5 - (maxUSDCentsPerMsg, finalOffset) <- decodeNumeric0At encoded offset6 + (maxUSDCentsPerMsg, finalOffset) <- decodeNumeric0At encoded offset5 assertOffset finalOffset (byteCount encoded) Some DeployOnRampParams with instanceId @@ -828,7 +818,6 @@ decodeDeployOnRampParams encoded = do rmnRemote tokenAdminRegistry feeQuoter - ccvRegistry maxUSDCentsPerMsg decodeDeployOffRampParams : BytesHex -> Optional DeployOffRampParams @@ -929,7 +918,7 @@ decodeDeployLockReleaseTokenPoolParams encoded = do (tokenAdminRegistry, offset7) <- decodeRawInstanceAddressAt encoded offset6 (feeQuoter, offset8) <- decodeRawInstanceAddressAt encoded offset7 (rmnRemote, offset9) <- decodeRawInstanceAddressAt encoded offset8 - (poolReceiveContext, offset10) <- decodeChoiceContextAt encoded offset9 + (poolReceiveContext, offset10) <- CCIP.UtilsV1.Context.decodeChoiceContextAt encoded offset9 (transferTimeout, finalOffset) <- decodeTransferTimeoutAt encoded offset10 assertOffset finalOffset (byteCount encoded) Some DeployLockReleaseTokenPoolParams with @@ -956,8 +945,8 @@ decodeDeployBurnMintTokenPoolParams encoded = do (tokenAdminRegistry, offset7) <- decodeRawInstanceAddressAt encoded offset6 (feeQuoter, offset8) <- decodeRawInstanceAddressAt encoded offset7 (rmnRemote, offset9) <- decodeRawInstanceAddressAt encoded offset8 - (poolReceiveContext, offset10) <- decodeChoiceContextAt encoded offset9 - (transferTimeout, finalOffset) <- CCIP.BurnMintTokenPoolCodecGen.decodeTransferTimeoutAt encoded offset10 + (poolReceiveContext, offset10) <- CCIP.UtilsV1.Context.decodeChoiceContextAt encoded offset9 + (transferTimeout, finalOffset) <- CCIP.BurnMintTokenPoolV1CodecGen.decodeTransferTimeoutAt encoded offset10 assertOffset finalOffset (byteCount encoded) Some DeployBurnMintTokenPoolParams with instanceId @@ -972,22 +961,22 @@ decodeDeployBurnMintTokenPoolParams encoded = do poolReceiveContext transferTimeout -decodeRateLimitDirectionAt : BytesHex -> Int -> Optional (CCIP.RateLimiter.RateLimitDirection, Int) +decodeRateLimitDirectionAt : BytesHex -> Int -> Optional (CCIP.RateLimiterV1.RateLimitDirection, Int) decodeRateLimitDirectionAt encoded offset = do directionHex <- extractBytes encoded offset 1 direction <- decodeUint8 directionHex case direction of - 0 -> Some (CCIP.RateLimiter.RateLimitDirection_Outbound, offset + 1) - 1 -> Some (CCIP.RateLimiter.RateLimitDirection_Inbound, offset + 1) + 0 -> Some (CCIP.RateLimiterV1.RateLimitDirection_Outbound, offset + 1) + 1 -> Some (CCIP.RateLimiterV1.RateLimitDirection_Inbound, offset + 1) _ -> None -decodeRateLimitModeAt : BytesHex -> Int -> Optional (CCIP.RateLimiter.RateLimitMode, Int) +decodeRateLimitModeAt : BytesHex -> Int -> Optional (CCIP.RateLimiterV1.RateLimitMode, Int) decodeRateLimitModeAt encoded offset = do modeHex <- extractBytes encoded offset 1 mode <- decodeUint8 modeHex case mode of - 0 -> Some (CCIP.RateLimiter.RateLimitMode_DefaultFinality, offset + 1) - 1 -> Some (CCIP.RateLimiter.RateLimitMode_CustomFinality, offset + 1) + 0 -> Some (CCIP.RateLimiterV1.RateLimitMode_DefaultFinality, offset + 1) + 1 -> Some (CCIP.RateLimiterV1.RateLimitMode_CustomFinality, offset + 1) _ -> None decodeDeployRateLimiterParams : BytesHex -> Optional DeployRateLimiterParams diff --git a/contracts/ccip/pools/burn-mint-token-pool/daml.yaml b/contracts/ccip/pools/burn-mint-token-pool/daml.yaml index d67696198..45664d4f7 100644 --- a/contracts/ccip/pools/burn-mint-token-pool/daml.yaml +++ b/contracts/ccip/pools/burn-mint-token-pool/daml.yaml @@ -10,10 +10,15 @@ data-dependencies: - ../../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../../api/.daml/dist/ccip-api-2.0.0.dar + - ../../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar + - ../../events/.daml/dist/ccip-events-2.0.0.dar + - ../../tickets/.daml/dist/ccip-tickets-2.0.0.dar + - ../../utils/.daml/dist/ccip-utils-2.0.0.dar + - ../../rate-limiter/.daml/dist/ccip-rate-limiter-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../../mcms/api/.daml/dist/mcms-api-1.0.0.dar - - ../../core/.daml/dist/ccip-core-2.0.0.dar - - ../../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar diff --git a/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPool.daml b/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1.daml similarity index 74% rename from contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPool.daml rename to contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1.daml index 751ff81f8..bb84efe53 100644 --- a/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPool.daml +++ b/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1.daml @@ -1,13 +1,13 @@ --- | Lock/release token pool for CCIP token transfers. +-- | Burn/mint token pool for CCIP token transfers. -- -- Supports Splice token standard patterns where TransferFactory implementations -- may look up preapproval from extraArgs.context (e.g., Amulet's ExternalPartyAmuletRules -- uses "transfer-preapproval" key). The pool stores a poolReceiveContext that gets -- merged into extraArgs for inbound transfers, enabling direct transfers without -- pending state when the pool has preapproval. -module CCIP.BurnMintTokenPool ( - module CCIP.BurnMintTokenPool - , module CCIP.BurnMintTokenPoolTypes +module CCIP.BurnMintTokenPoolV1 ( + module CCIP.BurnMintTokenPoolV1 + , module CCIP.BurnMintTokenPoolV1Types ) where import DA.Action (foldlA) @@ -21,8 +21,30 @@ import DA.Date (date, Month(Dec)) import DA.Time (time) import DA.Foldable (forA_) +import qualified Splice.Api.Token.BurnMintV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import CCIP.BurnMintTokenPoolCodecGen ( + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CodecV1.Math +import qualified CCIP.CodecV1.Uint256 +import qualified CCIP.EventsV1.Events +import qualified CCIP.InterfacesV1.TokenPool +import qualified CCIP.RateLimiterV1 +import qualified CCIP.TicketsV1 +import qualified CCIP.UtilsV1.Context + +import CCIP.BurnMintTokenPoolV1CodecGen ( decodeSetDynamicConfigParamsAt, decodeApplyChainUpdatesParamsAt, decodeApplyTokenTransferFeeConfigUpdatesParamsAt, @@ -33,8 +55,7 @@ import CCIP.BurnMintTokenPoolCodecGen ( decodeAddPoolReceiveContextContractValueParamsAt, decodeRemovePoolReceiveContextValueParamsAt, ) -import CCIP.ContextCodec (decodeAnyValueAt) -import CCIP.BurnMintTokenPoolTypes ( +import CCIP.BurnMintTokenPoolV1Types ( TokenTransferFeeConfig(..), RemoteChainConfig(..), ChainUpdate(..), @@ -52,27 +73,6 @@ import CCIP.BurnMintTokenPoolTypes ( RemovePoolReceiveContextValueParams(..), ) -import qualified Splice.Api.Token.BurnMintV1 -import qualified Splice.Api.Token.HoldingV1 -import qualified Splice.Api.Token.MetadataV1 - -import qualified CCIP.Context -import qualified CCIP.Events -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.FinalityConfig -import qualified CCIP.FeeQuoter -import qualified CCIP.Interfaces.TokenPool -import qualified CCIP.MessageCodecV1 -import qualified CCIP.Math -import qualified CCIP.Uint256 -import qualified CCIP.RateLimiter -import Chainlink.InstanceAddress (RawInstanceAddress, assertValidInstanceId) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 -import qualified CCIP.Tickets -import qualified CCIP.TokenAdminRegistry - -- | Far-future time used as "never expires" for pending transfers. -- Matches Splice's maxTime pattern: https://github.com/hyperledger-labs/splice/blob/139ee12335f61851d7cbf540a4b56c80622c911f/daml/splice-amulet/daml/Splice/Expiry.daml#L125 maxTime : Time @@ -82,25 +82,25 @@ burnMintFactoryContextKey : Text burnMintFactoryContextKey = "burn-mint-factory" lookupBurnMintFactory : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (ContractId Splice.Api.Token.BurnMintV1.BurnMintFactory) -lookupBurnMintFactory ctx = CCIP.Context.getFromContextU ctx burnMintFactoryContextKey +lookupBurnMintFactory ctx = CCIP.UtilsV1.Context.getFromContextU ctx burnMintFactoryContextKey burnMintFactoryExtraArgsContextValuesContextKey : Text burnMintFactoryExtraArgsContextValuesContextKey = "burn-mint-factory-extra-args-values" lookupBurnMintFactoryExtraArgsContextValues : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (TextMap.TextMap Splice.Api.Token.MetadataV1.AnyValue) -lookupBurnMintFactoryExtraArgsContextValues ctx = fromOptional TextMap.empty <$> CCIP.Context.lookupFromContextU ctx burnMintFactoryExtraArgsContextValuesContextKey +lookupBurnMintFactoryExtraArgsContextValues ctx = fromOptional TextMap.empty <$> CCIP.UtilsV1.Context.lookupFromContextU ctx burnMintFactoryExtraArgsContextValuesContextKey burnMintFactoryExtraArgsMetaValuesContextKey : Text burnMintFactoryExtraArgsMetaValuesContextKey = "burn-mint-factory-extra-args-meta-values" lookupBurnMintFactoryExtraArgsMetaValues : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (TextMap.TextMap Text) -lookupBurnMintFactoryExtraArgsMetaValues ctx = fromOptional TextMap.empty <$> CCIP.Context.lookupFromContextU ctx burnMintFactoryExtraArgsMetaValuesContextKey +lookupBurnMintFactoryExtraArgsMetaValues ctx = fromOptional TextMap.empty <$> CCIP.UtilsV1.Context.lookupFromContextU ctx burnMintFactoryExtraArgsMetaValuesContextKey data BurnMintTokenPoolDeps = BurnMintTokenPoolDeps with - tokenAdminRegistry : RawInstanceAddress - rmnRemote : RawInstanceAddress - feeQuoter : RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) parseSourcePoolDecimals : Int -> BytesHex -> Int @@ -110,7 +110,7 @@ parseSourcePoolDecimals localDecimals sourcePoolData = else let decoded = fromSomeNote "ReleaseFromTicket: invalid source pool decimals" - (CCIP.MessageCodecV1.decodeUint256 sourcePoolData) + (CCIP.CodecV1.MessageCodecV1.decodeUint256 sourcePoolData) in if decoded < 0.0 || decoded > 255.0 then error "ReleaseFromTicket: invalid source pool decimals" @@ -118,7 +118,7 @@ parseSourcePoolDecimals localDecimals sourcePoolData = calculateLocalAmount : Numeric 0 -> Int -> Int -> Numeric 0 calculateLocalAmount remoteAmount remoteDecimals localDecimals = - CCIP.Math.calculateLocalAmountChecked + CCIP.CodecV1.Math.calculateLocalAmountChecked "BurnMintTokenPool.calculateLocalAmount" remoteAmount remoteDecimals @@ -215,7 +215,7 @@ validateLockOrBurnOutputs caller poolOwner instrumentId senderChangeAmount feeHo pure ([senderChangeCid], [poolFeeCid]) _ -> abort "LockOrBurn: burn/mint output shape mismatch" -remoteChainRateLimiterAddresses : Map.Map (Numeric 0) RemoteChainConfig -> [RawInstanceAddress.RawInstanceAddress] +remoteChainRateLimiterAddresses : Map.Map (Numeric 0) RemoteChainConfig -> [Chainlink.InstanceAddress.RawInstanceAddress] remoteChainRateLimiterAddresses configs = concatMap (\(_, cfg) -> @@ -229,12 +229,12 @@ assertPoolConfiguredRateLimiter : Text -> Party -> Map.Map (Numeric 0) RemoteChainConfig - -> ContractId CCIP.RateLimiter.RateLimiter + -> ContractId CCIP.RateLimiterV1.RateLimiter -> Update () assertPoolConfiguredRateLimiter poolInstanceId poolOwner remoteChainConfigs rateLimiterCid = do rl <- fetch rateLimiterCid assertMsg "SetRateLimitConfig: rate limiter not configured on pool" - (CCIP.RateLimiter.rawInstanceAddress rl `elem` remoteChainRateLimiterAddresses remoteChainConfigs) + (CCIP.RateLimiterV1.rawInstanceAddress rl `elem` remoteChainRateLimiterAddresses remoteChainConfigs) assertMsg "SetRateLimitConfig: pool instance mismatch" (rl.poolInstanceId == poolInstanceId) assertMsg "SetRateLimitConfig: pool owner mismatch" (rl.poolOwner == poolOwner) @@ -242,13 +242,13 @@ assertRateLimiter : Text -> Text -> Numeric 0 - -> CCIP.RateLimiter.RateLimitDirection - -> CCIP.RateLimiter.RateLimitMode - -> RawInstanceAddress.RawInstanceAddress - -> CCIP.RateLimiter.RateLimiter + -> CCIP.RateLimiterV1.RateLimitDirection + -> CCIP.RateLimiterV1.RateLimitMode + -> Chainlink.InstanceAddress.RawInstanceAddress + -> CCIP.RateLimiterV1.RateLimiter -> Update () assertRateLimiter prefix poolInstanceId remoteChainSelector direction mode expected limiter = do - RawInstanceAddress.assertEqual (prefix <> ": instance address mismatch") + Chainlink.InstanceAddress.assertEqual (prefix <> ": instance address mismatch") limiter.instanceId limiter.poolOwner expected @@ -265,11 +265,11 @@ bpsDenominator : Numeric 0 bpsDenominator = 10000.0 calculateFeeFromBps : Numeric 0 -> Numeric 0 -> Numeric 0 -calculateFeeFromBps amount feeBps = CCIP.Math.mulDivDown amount feeBps bpsDenominator +calculateFeeFromBps amount feeBps = CCIP.CodecV1.Math.mulDivDown amount feeBps bpsDenominator -customFinalityRateLimiterRequired : CCIP.FinalityConfig.FinalityConfig -> Bool +customFinalityRateLimiterRequired : CCIP.CodecV1.FinalityConfig.FinalityConfig -> Bool customFinalityRateLimiterRequired finalityConfig = - CCIP.FinalityConfig.customFinalityRateLimiterRequired finalityConfig + CCIP.CodecV1.FinalityConfig.customFinalityRateLimiterRequired finalityConfig -- | Burn/mint token pool with dynamic CCV requirements per chain. template BurnMintTokenPool @@ -304,11 +304,11 @@ template BurnMintTokenPool signatory poolOwner observer optional [] pure rateLimitAdmin - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && instrumentId.admin == poolOwner - && CCIP.Math.isValidTokenDecimals decimals + && CCIP.CodecV1.Math.isValidTokenDecimals decimals && all - (\cfg -> CCIP.FinalityConfig.isValidFinalityConfig cfg.finalityConfig) + (\cfg -> CCIP.CodecV1.FinalityConfig.isValidFinalityConfig cfg.finalityConfig) (Map.values remoteChainConfigs) && all (\cfg -> @@ -318,20 +318,23 @@ template BurnMintTokenPool ) (Map.values tokenTransferFeeConfigs) - interface instance CCIP.Interfaces.TokenPool.ITokenPool for BurnMintTokenPool where - view = CCIP.Interfaces.TokenPool.TokenPoolView with + interface instance CCIP.InterfacesV1.TokenPool.ITokenPool for BurnMintTokenPool where + view = CCIP.InterfacesV1.TokenPool.TokenPoolView with owner = poolOwner ccipOwner = ccipOwner instrumentId = instrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext tokenPool_getRequiredCCVsImpl self arg = do + let finality = fromSomeNote "Invalid finality" (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality arg.finality) exercise (fromInterfaceContractId @BurnMintTokenPool self) GetRequiredCCVs with remoteChainSelector = arg.remoteChainSelector sourceAmount = arg.sourceAmount - finality = arg.finality + finality = finality.requested extraData = arg.extraData direction = arg.direction + context = arg.context caller = arg.caller tokenPool_verifyInboundMessageImpl self arg = do @@ -339,8 +342,8 @@ template BurnMintTokenPool with tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid - extraContext = arg.extraContext executingMessageCid = arg.executingMessageCid + context = arg.context caller = arg.caller tokenPool_verifyOutboundCCVsImpl self arg = do @@ -348,9 +351,9 @@ template BurnMintTokenPool with tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid - extraContext = arg.extraContext sendingMessageCid = arg.sendingMessageCid amount = arg.amount + context = arg.context caller = arg.caller tokenPool_releaseFromTicketImpl self arg = do @@ -359,8 +362,8 @@ template BurnMintTokenPool tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid rmnRemoteCid = arg.rmnRemoteCid - extraContext = arg.extraContext tokenReceiveTicketCid = arg.tokenReceiveTicketCid + context = arg.context caller = arg.caller tokenPool_lockOrBurnImpl self arg = do @@ -369,10 +372,10 @@ template BurnMintTokenPool tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid rmnRemoteCid = arg.rmnRemoteCid - extraContext = arg.extraContext sendingMessageCid = arg.sendingMessageCid senderInputCids = arg.senderInputCids amount = arg.amount + context = arg.context caller = arg.caller tokenPool_calculateFeeImpl self arg = do @@ -380,10 +383,10 @@ template BurnMintTokenPool with tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid - extraContext = arg.extraContext sendingMessageCid = arg.sendingMessageCid feeQuoterCid = arg.feeQuoterCid tokenInstrumentId = arg.tokenInstrumentId + context = arg.context caller = arg.caller tokenPool_getFeeImpl self arg = do @@ -392,6 +395,7 @@ template BurnMintTokenPool feeQuoterCid = arg.feeQuoterCid destChainSelector = arg.destChainSelector tokenInstrumentId = arg.tokenInstrumentId + context = arg.context caller = arg.caller -- Sets the dynamic configuration for the pool. @@ -443,9 +447,9 @@ template BurnMintTokenPool assertMsg "ApplyChainUpdates: remote token address cannot be empty" (remoteTokenAddress /= "") -- If the chain already exists, the update should first remove it. assertMsg ("ApplyChainUpdates: chain already exists: " <> show remoteChainSelector) (not (Map.member remoteChainSelector remoteChainConfigsRemoved)) - assertMsg "ApplyChainUpdates: BlockDepth finality must be positive" (CCIP.FinalityConfig.isValidFinalityConfig finalityConfig) + assertMsg "ApplyChainUpdates: BlockDepth finality must be positive" (CCIP.CodecV1.FinalityConfig.isValidFinalityConfig finalityConfig) -- Validate rate limiters - CCIP.RateLimiter.assertDistinctRateLimiters "ApplyChainUpdates" + CCIP.RateLimiterV1.assertDistinctRateLimiters "ApplyChainUpdates" inboundRateLimiter outboundRateLimiter (if customFinalityRateLimiterRequired finalityConfig @@ -516,10 +520,10 @@ template BurnMintTokenPool -- Tunes capacity/rate/isEnabled on a rate limiter already referenced by this pool's remote chain config. -- Callable by poolOwner or rateLimitAdmin directly; poolOwner signatory authority propagates to the nested RateLimiter.SetConfig exercise. - nonconsuming choice SetRateLimitConfig : ContractId CCIP.RateLimiter.RateLimiter + nonconsuming choice SetRateLimitConfig : ContractId CCIP.RateLimiterV1.RateLimiter with caller : Party - rateLimiterCid : ContractId CCIP.RateLimiter.RateLimiter + rateLimiterCid : ContractId CCIP.RateLimiterV1.RateLimiter newIsEnabled : Bool newCapacity : Numeric 0 newRate : Numeric 0 @@ -528,7 +532,7 @@ template BurnMintTokenPool assertMsg "SetRateLimitConfig: unauthorized caller" (caller == poolOwner || rateLimitAdmin == Some caller) assertPoolConfiguredRateLimiter instanceId poolOwner remoteChainConfigs rateLimiterCid - exercise rateLimiterCid CCIP.RateLimiter.SetConfig with + exercise rateLimiterCid CCIP.RateLimiterV1.SetConfig with newIsEnabled newCapacity newRate @@ -546,7 +550,7 @@ template BurnMintTokenPool cfg <- case Map.lookup arg.remoteChainSelector remoteChainConfigs of None -> abort ("SetRateLimiterReferences: unsupported chain selector: " <> show arg.remoteChainSelector) Some cfg -> pure cfg - CCIP.RateLimiter.assertDistinctRateLimiters "SetRateLimitConfig" + CCIP.RateLimiterV1.assertDistinctRateLimiters "SetRateLimitConfig" arg.inboundRateLimiter arg.outboundRateLimiter (if customFinalityRateLimiterRequired cfg.finalityConfig @@ -617,51 +621,56 @@ template BurnMintTokenPool do create this with transferTimeout = newTransferTimeout -- Get required CCV raw instance addresses based on chain and direction. - nonconsuming choice GetRequiredCCVs : [RawInstanceAddress] + nonconsuming choice GetRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] with remoteChainSelector : Numeric 0 sourceAmount : BytesHex - finality : CCIP.FinalityConfig.FinalityConfig + finality : CCIP.CodecV1.FinalityConfig.FinalityConfig extraData : BytesHex - direction : CCIP.Interfaces.TokenPool.TransferDirection + direction : CCIP.InterfacesV1.TokenPool.TransferDirection + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do case Map.lookup remoteChainSelector remoteChainConfigs of None -> abort "pool: unsupported remote chain selector" Some config -> case direction of - CCIP.Interfaces.TokenPool.Inbound -> pure config.inboundCCVs - CCIP.Interfaces.TokenPool.Outbound -> pure config.outboundCCVs + CCIP.InterfacesV1.TokenPool.Inbound -> pure config.inboundCCVs + CCIP.InterfacesV1.TokenPool.Outbound -> pure config.outboundCCVs -- Validate inbound token transfer message and record pool CCV requirements. -- Validates that the message has a token transfer targeting this pool's instrument, -- validates the source pool address against the allowed remote pools for the source chain, -- looks up per-chain CCV requirements, and records them on the executing message. -- OffRamp performs the actual CCV coverage check. - nonconsuming choice VerifyInboundMessage : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + nonconsuming choice VerifyInboundMessage : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + executingMessageCid : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do execMsg <- fetch executingMessageCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + let execMsgView = view execMsg + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry assertMsg "pool: executing message tokenAdminRegistry mismatch" - (execMsg.deps.tokenAdminRegistry == deps.tokenAdminRegistry) + (execMsgView.tokenAdminRegistry == deps.tokenAdminRegistry) assertMsg "pool: executing message rmnRemote mismatch" - (execMsg.deps.rmnRemote == deps.rmnRemote) - let message = execMsg.message + (execMsgView.rmnRemote == deps.rmnRemote) + let message = execMsgView.message tt <- case message.tokenTransfer of None -> abort "pool: no token transfer in message" Some t -> pure t - let expectedAddr = CCIP.MessageCodecV1.encodeInstrumentId instrumentId + let expectedAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId instrumentId assertMsg "pool: destTokenAddress does not match pool instrumentId" (tt.destTokenAddress == expectedAddr) @@ -669,7 +678,7 @@ template BurnMintTokenPool None -> abort "pool: unsupported source chain" Some cfg -> pure cfg assertMsg "pool: message finality not allowed by pool finality config" - (CCIP.FinalityConfig.requestedFinalityAllowed message.finality.requested remoteChainCfg.finalityConfig) + (CCIP.CodecV1.FinalityConfig.requestedFinalityAllowed message.finality.requested remoteChainCfg.finalityConfig) assertMsg "pool: invalid sourcePoolAddress" (tt.sourcePoolAddress `elem` remoteChainCfg.remotePools) @@ -678,91 +687,107 @@ template BurnMintTokenPool (tt.sourceTokenAddress == remoteChainCfg.remoteTokenAddress) exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.SetInboundPoolCCVs with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_SetInboundPoolCCVs with tokenConfigCid = tokenConfigCid executingMessageCid poolInstanceId = instanceId poolCCVs = remoteChainCfg.inboundCCVs + context = context caller = poolOwner -- Declare outbound CCV requirements on SendingMessageV1 via TAR. -- Looks up per-chain CCV requirements and records them on the sending message. - nonconsuming choice VerifyOutboundCCVs : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice VerifyOutboundCCVs : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage amount : Decimal + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do assertMsg "pool: amount must be positive" (amount > 0.0) - sm <- fetch sendingMessageCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + sendingMsg <- fetch sendingMessageCid + let sendingMsgView = view sendingMsg + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry assertMsg "pool: sending message ccipOwner mismatch" - (sm.ccipOwner == tokenAdminRegistry.owner) + (sendingMsgView.ccipOwner == tokenAdminRegistryView.ccipOwner) assertMsg "pool: sending message tokenAdminRegistry mismatch" - (sm.deps.tokenAdminRegistry == deps.tokenAdminRegistry) + (sendingMsgView.tokenAdminRegistry == deps.tokenAdminRegistry) assertMsg "pool: sending message rmnRemote mismatch" - (sm.deps.rmnRemote == deps.rmnRemote) + (sendingMsgView.rmnRemote == deps.rmnRemote) - poolCCVs <- case Map.lookup sm.destChainSelector remoteChainConfigs of + poolCCVs <- case Map.lookup sendingMsgView.destChainSelector remoteChainConfigs of None -> abort "pool: unsupported dest chain" Some cfg -> pure cfg.outboundCCVs exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.SetOutboundPoolCCVs with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_SetOutboundPoolCCVs with tokenConfigCid = tokenConfigCid sendingMessageCid = sendingMessageCid poolInstanceId = instanceId poolCCVs = poolCCVs + context = context caller = poolOwner -- Release tokens by consuming a TokenReceiveTicket via TokenAdminRegistry. -- The TAR validates the ticket was issued by the correct registry instance, -- the pool is the registered pool for the instrument, and archives the ticket -- atomically. If any check fails, the entire transaction rolls back. - nonconsuming choice ReleaseFromTicket : CCIP.Interfaces.TokenPool.ReleaseOrMintResult + nonconsuming choice ReleaseFromTicket : CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - tokenReceiveTicketCid : ContractId CCIP.Tickets.TokenReceiveTicket + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + tokenReceiveTicketCid : ContractId CCIP.APIV1.ExecutingMessage.ITokenReceiveTicket + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do - ticket <- fetch tokenReceiveTicketCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "ReleaseFromTicket: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry - config <- exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.GetTokenConfigByCid with + let tokenReceiveTicketImplementation = coerceContractId @_ @CCIP.TicketsV1.TokenReceiveTicket tokenReceiveTicketCid + + ticket <- fetch tokenReceiveTicketImplementation + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "ReleaseFromTicket: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry + _ <- exercise tokenAdminRegistryCid + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_FetchTokenConfig with tokenConfigCid instrumentId = instrumentId + context = context caller = poolOwner assertMsg "ReleaseFromTicket: ticket tokenAdminRegistry instance mismatch" - (ticket.tokenAdminRegistryInstanceId == tokenAdminRegistry.instanceId) + (ticket.tokenAdminRegistryInstanceId == tokenAdminRegistryView.instanceId) assertMsg "ReleaseFromTicket: ticket ccipOwner mismatch" - (ticket.ccipOwner == tokenAdminRegistry.owner) - rmnRemote <- exercise rmnRemoteCid CCIP.RMNRemote.Get with caller - RawInstanceAddress.assertEqual "ReleaseFromTicket: rmn mismatch" - rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote + (ticket.ccipOwner == tokenAdminRegistryView.ccipOwner) + rmnRemoteView <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_PublicFetch with + expectedAddress = deps.rmnRemote + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "ReleaseFromTicket: rmn mismatch" + rmnRemoteView.instanceId rmnRemoteView.rmnOwner deps.rmnRemote assertMsg "ReleaseFromTicket: ticket instrument must match pool instrument" (ticket.instrumentId == instrumentId) - let poolAddress = RawInstanceAddress.make instanceId poolOwner + let poolAddress = Chainlink.InstanceAddress.make instanceId poolOwner assertMsg "ReleaseFromTicket: ticket pool owner mismatch" (ticket.poolOwner == poolOwner) assertMsg "ReleaseFromTicket: ticket pool address mismatch" (ticket.poolAddress == poolAddress) - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with - caller = poolOwner + isCursed <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_IsCursedForChain with chainSelector = ticket.sourceChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = poolOwner assertMsg "ReleaseFromTicket: source chain is cursed" (not isCursed) assertMsg "ReleaseFromTicket: caller must be tokenReceiver" @@ -773,7 +798,7 @@ template BurnMintTokenPool let ticketSignatories = signatory ticket Foldable.forA_ ticket.verifiedCCVs $ \verifiedCCV -> assertMsg ("ReleaseFromTicket: verified CCV owner is not a ticket signatory " <> show verifiedCCV) - (RawInstanceAddress.ownerParty verifiedCCV `elem` ticketSignatories) + (Chainlink.InstanceAddress.ownerParty verifiedCCV `elem` ticketSignatories) -- Also check that the pool's owner is a signatory on the ticket assertMsg "ReleaseFromTicket: pool owner is not a ticket signatory" @@ -791,26 +816,26 @@ template BurnMintTokenPool (requiredCCV `elem` ticket.verifiedCCVs) let useCustomFinalityRateLimiter = - ticket.finality /= CCIP.FinalityConfig.WaitForFinality - && CCIP.FinalityConfig.customFinalityRateLimiterRequired remoteChainCfg.finalityConfig + ticket.finality /= CCIP.CodecV1.FinalityConfig.WaitForFinality + && CCIP.CodecV1.FinalityConfig.customFinalityRateLimiterRequired remoteChainCfg.finalityConfig let expectedRateLimitMode = if useCustomFinalityRateLimiter - then CCIP.RateLimiter.RateLimitMode_CustomFinality - else CCIP.RateLimiter.RateLimitMode_DefaultFinality + then CCIP.RateLimiterV1.RateLimitMode_CustomFinality + else CCIP.RateLimiterV1.RateLimitMode_DefaultFinality let expectedRateLimiter = if useCustomFinalityRateLimiter then remoteChainCfg.inboundCustomBlockConfirmationsRateLimiter else remoteChainCfg.inboundRateLimiter - rateLimiterCid <- CCIP.RateLimiter.lookupRateLimiterCid extraContext + rateLimiterCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RateLimiterV1.rateLimiterContextKey rateLimiter <- fetch rateLimiterCid assertRateLimiter "ReleaseFromTicket: rateLimiter" instanceId ticket.sourceChainSelector - CCIP.RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound expectedRateLimitMode expectedRateLimiter rateLimiter let sourceDecimals = parseSourcePoolDecimals decimals ticket.sourcePoolData - conversion <- case CCIP.Uint256.calculateLocalAmountFromUint256Checked + conversion <- case CCIP.CodecV1.Uint256.calculateLocalAmountFromUint256Checked "ReleaseFromTicket" ticket.amount sourceDecimals @@ -820,28 +845,29 @@ template BurnMintTokenPool assertMsg "ReleaseFromTicket: local amount rounds down to zero" (conversion.localAmount > 0.0) let localAmount = conversion.localAmount - _ <- exercise rateLimiterCid CCIP.RateLimiter.ConsumeCapacity with + _ <- exercise rateLimiterCid CCIP.RateLimiterV1.ConsumeCapacity with requested = localAmount -- Consume ticket via TAR after validating the disclosed TAR identity. exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.ConsumeReceiveTicket with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_ConsumeReceiveTicket with tokenConfigCid = tokenConfigCid - ticketCid = tokenReceiveTicketCid + tokenReceiveTicketCid = tokenReceiveTicketCid instrumentId = instrumentId poolInstanceId = instanceId + context = context caller = poolOwner - -- Get inputs from extraContext - burnMintFactory <- lookupBurnMintFactory extraContext - CCIP.TokenAdminRegistry.assertConfiguredBurnMintFactory - "ReleaseFromTicket" - config - burnMintFactory - extraArgsContextValues <- lookupBurnMintFactoryExtraArgsContextValues extraContext - extraArgsMetaValues <- lookupBurnMintFactoryExtraArgsMetaValues extraContext + -- Get inputs from context + burnMintFactory <- lookupBurnMintFactory context + _ <- exercise tokenConfigCid CCIP.APIV1.TokenAdminRegistry.TokenConfig_AssertConfiguredBurnMintFactory with + suppliedFactory = burnMintFactory + context = context + caller = poolOwner + extraArgsContextValues <- lookupBurnMintFactoryExtraArgsContextValues context + extraArgsMetaValues <- lookupBurnMintFactoryExtraArgsMetaValues context - let amountDecimal = CCIP.Math.numeric0ToDecimal localAmount + let amountDecimal = CCIP.CodecV1.Math.numeric0ToDecimal localAmount burnMintResult <- exercise burnMintFactory Splice.Api.Token.BurnMintV1.BurnMintFactory_BurnMint with expectedAdmin = instrumentId.admin @@ -866,18 +892,18 @@ template BurnMintTokenPool amountDecimal burnMintResult.outputCids let receiverCids = [receiverCid] - let output = CCIP.Interfaces.TokenPool.ReleaseOrMintResult_Completed with + let output = CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed with receiverHoldingCids = receiverCids - let claimedOutput = CCIP.Events.TokenReceiveTicketClaimed_Completed with + let claimedOutput = CCIP.EventsV1.Events.TokenReceiveTicketClaimed_Completed with receiverHoldingCids = receiverCids - claimedEventCid <- create CCIP.Events.TokenReceiveTicketClaimed with + claimedEventCid <- create CCIP.EventsV1.Events.TokenReceiveTicketClaimed with ccipOwner = ticket.ccipOwner ccvOwners = ticket.ccvOwners poolOwner = ticket.poolOwner receiver = ticket.receiver tokenReceiver = ticket.tokenReceiver - tokenReceiveTicketCid - event = CCIP.Events.TokenReceiveTicketClaimedEvent with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketImplementation + event = CCIP.EventsV1.Events.TokenReceiveTicketClaimedEvent with verifiedCCVs = ticket.verifiedCCVs tokenAdminRegistryInstanceId = ticket.tokenAdminRegistryInstanceId poolAddress = ticket.poolAddress @@ -889,44 +915,51 @@ template BurnMintTokenPool sourceChainSelector = ticket.sourceChainSelector finality = ticket.finality output = claimedOutput - pure CCIP.Interfaces.TokenPool.ReleaseOrMintResult with + pure CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult with output poolChangeCids = [] - claimedEventCid + claimedEventCid = coerceContractId claimedEventCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Calculate fee for outbound token transfer (USD cents only). -- Reads destChainSelector from SendingMessageV1, looks up per-chain -- fee config, appends fee directly to SendingMessageV1. - nonconsuming choice CalculateFee - : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice CalculateFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + feeQuoterCid : ContractId CCIP.APIV1.FeeQuoter.IFeeQuoter tokenInstrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do sendingMsg <- fetch sendingMessageCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + let sendingMsgView = view sendingMsg + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry assertMsg "pool: sending message ccipOwner mismatch" - (sendingMsg.ccipOwner == tokenAdminRegistry.owner) + (sendingMsgView.ccipOwner == tokenAdminRegistryView.ccipOwner) assertMsg "pool: sending message tokenAdminRegistry mismatch" - (sendingMsg.deps.tokenAdminRegistry == deps.tokenAdminRegistry) + (sendingMsgView.tokenAdminRegistry == deps.tokenAdminRegistry) assertMsg "pool: tokenInstrumentId mismatch" (tokenInstrumentId == instrumentId) - feeQuoter <- exercise feeQuoterCid CCIP.FeeQuoter.Get with caller - RawInstanceAddress.assertEqual "pool: feeQuoter mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + feeQuoterView <- exercise feeQuoterCid CCIP.APIV1.FeeQuoter.FeeQuoter_PublicFetch with + expectedAddress = deps.feeQuoter + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "pool: feeQuoter mismatch" + feeQuoterView.instanceId feeQuoterView.ccipOwner deps.feeQuoter assertMsg "pool: sending message feeQuoter mismatch" - (sendingMsg.deps.feeQuoter == deps.feeQuoter) + (sendingMsgView.feeQuoter == deps.feeQuoter) -- Check if fee config is enabled for the destination chain. -- If no config is set/it's disabled, use the FeeQuoter defaults. If enabled, use the specified fee parameters. - (feeUSDCents, destGasOverhead, destBytesOverhead) <- case Map.lookup sendingMsg.destChainSelector tokenTransferFeeConfigs of + (feeUSDCents, destGasOverhead, destBytesOverhead) <- case Map.lookup sendingMsgView.destChainSelector tokenTransferFeeConfigs of Some feeConfig | feeConfig.isEnabled -> pure ( feeConfig.feeUSDCents @@ -934,41 +967,47 @@ template BurnMintTokenPool , feeConfig.destBytesOverhead ) _ -> - exercise feeQuoterCid CCIP.FeeQuoter.GetTokenTransferFee with - destChainSelector = sendingMsg.destChainSelector + exercise feeQuoterCid CCIP.APIV1.FeeQuoter.FeeQuoter_GetTokenTransferFee with + destChainSelector = sendingMsgView.destChainSelector token = tokenInstrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.AddTokenSendFee with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_AddTokenSendFee with tokenConfigCid = tokenConfigCid sendingMessageCid = sendingMessageCid poolInstanceId = instanceId feeUSDCents = feeUSDCents destGasOverhead = destGasOverhead destBytesOverhead = destBytesOverhead + context = context caller = poolOwner -- Quote fee for outbound token transfer (USD cents only). nonconsuming choice GetFee - : CCIP.Interfaces.TokenPool.TokenPoolFeeQuote + : CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote with - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter + feeQuoterCid : ContractId CCIP.APIV1.FeeQuoter.IFeeQuoter destChainSelector : Numeric 0 tokenInstrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do assertMsg "pool: tokenInstrumentId mismatch" (tokenInstrumentId == instrumentId) - feeQuoter <- exercise feeQuoterCid CCIP.FeeQuoter.Get with caller - RawInstanceAddress.assertEqual "pool: feeQuoter mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + feeQuoterView <- exercise feeQuoterCid CCIP.APIV1.FeeQuoter.FeeQuoter_PublicFetch with + expectedAddress = deps.feeQuoter + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "pool: feeQuoter mismatch" + feeQuoterView.instanceId feeQuoterView.ccipOwner deps.feeQuoter case Map.lookup destChainSelector tokenTransferFeeConfigs of Some feeConfig | feeConfig.isEnabled -> - pure CCIP.Interfaces.TokenPool.TokenPoolFeeQuote with + pure CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote with poolInstanceId = instanceId poolOwner = poolOwner feeUSDCents = feeConfig.feeUSDCents @@ -976,13 +1015,15 @@ template BurnMintTokenPool destBytesOverhead = feeConfig.destBytesOverhead tokenFeeBps = feeConfig.feeBps isEnabled = True + context = Splice.Api.Token.MetadataV1.emptyChoiceContext _ -> do (feeUSDCents, destGasOverhead, destBytesOverhead) <- exercise feeQuoterCid - CCIP.FeeQuoter.GetTokenTransferFee with + CCIP.APIV1.FeeQuoter.FeeQuoter_GetTokenTransferFee with destChainSelector = destChainSelector token = tokenInstrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner - pure CCIP.Interfaces.TokenPool.TokenPoolFeeQuote with + pure CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote with poolInstanceId = instanceId poolOwner = poolOwner feeUSDCents = feeUSDCents @@ -990,84 +1031,95 @@ template BurnMintTokenPool destBytesOverhead = destBytesOverhead tokenFeeBps = 0.0 isEnabled = False + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Lock tokens for outbound transfer and append token send data. -- Reads from SendingMessageV1 instead of taking separate params. -- Requires ccvAndExecutorHash to be finalized by the executor step before this runs. - nonconsuming choice LockOrBurn : CCIP.Interfaces.TokenPool.LockOrBurnResult + nonconsuming choice LockOrBurn : CCIP.InterfacesV1.TokenPool.LockOrBurnResult with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage senderInputCids : [ContractId Splice.Api.Token.HoldingV1.Holding] amount : Decimal + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do assertMsg "pool: amount must be positive" (amount > 0.0) - let amountNumeric0 = CCIP.Math.decimalToNumeric0 amount + let amountNumeric0 = CCIP.CodecV1.Math.decimalToNumeric0 amount sendingMsg <- fetch sendingMessageCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "LockOrBurn: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry - config <- exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.GetTokenConfigByCid with + let sendingMsgView = view sendingMsg + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch + with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "LockOrBurn: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry + _ <- exercise tokenAdminRegistryCid + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_FetchTokenConfig with tokenConfigCid instrumentId + context = context caller = poolOwner assertMsg "LockOrBurn: sending message ccipOwner mismatch" - (sendingMsg.ccipOwner == tokenAdminRegistry.owner) + (sendingMsgView.ccipOwner == tokenAdminRegistryView.ccipOwner) assertMsg "LockOrBurn: sending message tokenAdminRegistry mismatch" - (sendingMsg.deps.tokenAdminRegistry == deps.tokenAdminRegistry) - rmnRemote <- exercise rmnRemoteCid CCIP.RMNRemote.Get with caller - RawInstanceAddress.assertEqual "LockOrBurn: rmn mismatch" - rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote + (sendingMsgView.tokenAdminRegistry == deps.tokenAdminRegistry) + rmnRemoteView <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_PublicFetch with + expectedAddress = deps.rmnRemote + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "LockOrBurn: rmn mismatch" + rmnRemoteView.instanceId rmnRemoteView.rmnOwner deps.rmnRemote assertMsg "LockOrBurn: sending message rmn mismatch" - (sendingMsg.deps.rmnRemote == deps.rmnRemote) + (sendingMsgView.rmnRemote == deps.rmnRemote) - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with + isCursed <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_IsCursedForChain with + chainSelector = sendingMsgView.destChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner - chainSelector = sendingMsg.destChainSelector assertMsg "LockOrBurn: dest chain is cursed" (not isCursed) - remoteChainCfg <- case Map.lookup sendingMsg.destChainSelector remoteChainConfigs of + remoteChainCfg <- case Map.lookup sendingMsgView.destChainSelector remoteChainConfigs of None -> abort "pool: unsupported dest chain" Some cfg -> pure cfg let destTokenAddr = remoteChainCfg.remoteTokenAddress - let destPoolData = CCIP.MessageCodecV1.encodeUint256 (intToNumeric decimals) - let tokenFeeBps = case Map.lookup sendingMsg.destChainSelector tokenTransferFeeConfigs of + let destPoolData = CCIP.CodecV1.MessageCodecV1.encodeUint256 (intToNumeric decimals) + let tokenFeeBps = case Map.lookup sendingMsgView.destChainSelector tokenTransferFeeConfigs of Some feeCfg | feeCfg.isEnabled -> feeCfg.feeBps _ -> 0.0 let feeAmount = calculateFeeFromBps amountNumeric0 tokenFeeBps let amountAfterFeeBps = amountNumeric0 - feeAmount let expectedRateLimiter = remoteChainCfg.outboundRateLimiter - rateLimiterCid <- CCIP.RateLimiter.lookupRateLimiterCid extraContext + rateLimiterCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RateLimiterV1.rateLimiterContextKey rateLimiter <- fetch rateLimiterCid assertRateLimiter "LockOrBurn: rateLimiter" instanceId - sendingMsg.destChainSelector - CCIP.RateLimiter.RateLimitDirection_Outbound - CCIP.RateLimiter.RateLimitMode_DefaultFinality + sendingMsgView.destChainSelector + CCIP.RateLimiterV1.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality expectedRateLimiter rateLimiter - _ <- exercise rateLimiterCid CCIP.RateLimiter.ConsumeCapacity with + _ <- exercise rateLimiterCid CCIP.RateLimiterV1.ConsumeCapacity with requested = amountAfterFeeBps - -- Get inputs from extraContext - burnMintFactory <- lookupBurnMintFactory extraContext - CCIP.TokenAdminRegistry.assertConfiguredBurnMintFactory - "LockOrBurn" - config - burnMintFactory - extraArgsContextValues <- lookupBurnMintFactoryExtraArgsContextValues extraContext - extraArgsMetaValues <- lookupBurnMintFactoryExtraArgsMetaValues extraContext + -- Get inputs from context + burnMintFactory <- lookupBurnMintFactory context + _ <- exercise tokenConfigCid CCIP.APIV1.TokenAdminRegistry.TokenConfig_AssertConfiguredBurnMintFactory with + suppliedFactory = burnMintFactory + context = context + caller = poolOwner + extraArgsContextValues <- lookupBurnMintFactoryExtraArgsContextValues context + extraArgsMetaValues <- lookupBurnMintFactoryExtraArgsMetaValues context inputTotal <- sumCheckedHoldingAmounts "LockOrBurn: sender input holdings" @@ -1078,9 +1130,9 @@ template BurnMintTokenPool (inputTotal >= amount) let amountAfterFeeBpsBytes = fromSomeNote "LockOrBurn: amountAfterFeeBps does not fit uint256" - (CCIP.Uint256.numeric0ToUint256Bytes amountAfterFeeBps) + (CCIP.CodecV1.Uint256.numeric0ToUint256Bytes amountAfterFeeBps) let senderChangeAmount = inputTotal - amount - let feeHoldingAmount = CCIP.Math.numeric0ToDecimal feeAmount + let feeHoldingAmount = CCIP.CodecV1.Math.numeric0ToDecimal feeAmount let outputs = (if senderChangeAmount > 0.0 then [Splice.Api.Token.BurnMintV1.BurnMintOutput with @@ -1117,7 +1169,7 @@ template BurnMintTokenPool burnMintResult.outputCids let extraData = fromOptional "" destPoolData newSendingMessageCid <- exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.AddTokenSend with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_AddTokenSend with tokenConfigCid = tokenConfigCid sendingMessageCid = sendingMessageCid poolInstanceId = instanceId @@ -1125,12 +1177,14 @@ template BurnMintTokenPool amount = amountAfterFeeBpsBytes destTokenAddress = destTokenAddr extraData = extraData + context = context caller = poolOwner - pure CCIP.Interfaces.TokenPool.LockOrBurnResult with + pure CCIP.InterfacesV1.TokenPool.LockOrBurnResult with poolChangeCids = poolChangeCids senderChangeCids = senderChangeCids - sendingMessageCid = newSendingMessageCid + sendingMessageCid = coerceContractId newSendingMessageCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext interface instance MCMSReceiver for BurnMintTokenPool where view = MCMSReceiverView with @@ -1186,10 +1240,10 @@ template BurnMintTokenPool pool <- fetch selfCid assertMsg "E_RATE_LIMITER_NOT_ON_POOL" (rateLimiterInstanceAddress `elem` remoteChainRateLimiterAddresses pool.remoteChainConfigs) - let limiterAddr = RawInstanceAddress.toText rateLimiterInstanceAddress + let limiterAddr = Chainlink.InstanceAddress.toText rateLimiterInstanceAddress rateLimiterCid <- case Map.lookup limiterAddr contractIds of None -> abort ("E_RATE_LIMITER_NOT_IN_MAP: " <> limiterAddr) - Some c -> pure (coerceContractId c : ContractId CCIP.RateLimiter.RateLimiter) + Some c -> pure (coerceContractId c : ContractId CCIP.RateLimiterV1.RateLimiter) updatedLimiterCid <- exercise selfCid SetRateLimitConfig with caller rateLimiterCid @@ -1202,7 +1256,7 @@ template BurnMintTokenPool None -> abort "E_INVALID_PARAMS: AddPoolReceiveContextNonContractValue" Some (AddPoolReceiveContextNonContractValueParams{..}, finalOffset) -> do assertMsg "E_TRAILING_BYTES: AddPoolReceiveContextNonContractValue" (finalOffset == byteCount operationData) - (value, innerOff) <- case decodeAnyValueAt valuePayload 0 of + (value, innerOff) <- case CCIP.UtilsV1.Context.decodeAnyValueAt valuePayload 0 of None -> abort "E_INVALID_PARAMS: AddPoolReceiveContextNonContractValue:valuePayload" Some p -> pure p assertMsg "E_TRAILING_BYTES: AddPoolReceiveContextNonContractValue:valuePayload" (innerOff == byteCount valuePayload) @@ -1213,7 +1267,7 @@ template BurnMintTokenPool None -> abort "E_INVALID_PARAMS: AddPoolReceiveContextContractValue" Some (AddPoolReceiveContextContractValueParams{..}, finalOffset) -> do assertMsg "E_TRAILING_BYTES: AddPoolReceiveContextContractValue" (finalOffset == byteCount operationData) - let refAddr = RawInstanceAddress.toText referentInstanceAddress + let refAddr = Chainlink.InstanceAddress.toText referentInstanceAddress referred <- case Map.lookup refAddr contractIds of None -> abort ("E_REFERENT_CONTRACT_NOT_IN_MAP: " <> refAddr) Some c -> pure c diff --git a/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolCodecGen.daml b/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1CodecGen.daml similarity index 91% rename from contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolCodecGen.daml rename to contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1CodecGen.daml index 18779cda9..2133f3c73 100644 --- a/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolCodecGen.daml +++ b/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1CodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.LockReleaseTokenPoolCodecGen where +module CCIP.BurnMintTokenPoolV1CodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.LockReleaseTokenPoolTypes (ChainUpdate(..), RemoteChainConfig(..), TokenTransferFeeConfigArgs(..), TokenTransferFeeConfig(..), RateLimitConfigArgs(..), SetDynamicConfigParams(..), ApplyChainUpdatesParams(..), ApplyTokenTransferFeeConfigUpdatesParams(..), SetRateLimiterReferencesParams(..), SetRateLimitConfigParams(..), SetTransferTimeoutParams(..), AddPoolReceiveContextNonContractValueParams(..), AddPoolReceiveContextContractValueParams(..), RemovePoolReceiveContextValueParams(..), TransferTimeout(..)) +import CCIP.BurnMintTokenPoolV1Types (ChainUpdate(..), RemoteChainConfig(..), TokenTransferFeeConfigArgs(..), TokenTransferFeeConfig(..), RateLimitConfigArgs(..), SetDynamicConfigParams(..), ApplyChainUpdatesParams(..), ApplyTokenTransferFeeConfigUpdatesParams(..), SetRateLimiterReferencesParams(..), SetRateLimitConfigParams(..), SetTransferTimeoutParams(..), AddPoolReceiveContextNonContractValueParams(..), AddPoolReceiveContextContractValueParams(..), RemovePoolReceiveContextValueParams(..), TransferTimeout(..)) import MCMS.Codec ( decodeBoolAt, @@ -29,7 +29,7 @@ import MCMS.Codec ( extractBytes ) -import CCIP.Codec (decodeRawInstanceAddressAt, decodeRawInstanceAddressList, decodeRequestedFinalityAt, encodeRawInstanceAddress, encodeRawInstanceAddressList, encodeRequestedFinality) +import CCIP.CodecV1 (decodeRawInstanceAddressAt, decodeRequestedFinalityAt, encodeRawInstanceAddress, encodeRequestedFinality) -- =============================================== @@ -41,8 +41,8 @@ encodeChainUpdate params = encodeNumeric0 params.remoteChainSelector <> encodeBytesHexList params.remotePools <> encodeBytesHex params.remoteTokenAddress - <> encodeRawInstanceAddressList params.inboundCCVs - <> encodeRawInstanceAddressList params.outboundCCVs + <> encodeList params.inboundCCVs encodeRawInstanceAddress + <> encodeList params.outboundCCVs encodeRawInstanceAddress <> encodeRequestedFinality params.finalityConfig <> encodeRawInstanceAddress params.inboundRateLimiter <> encodeRawInstanceAddress params.inboundCustomBlockConfirmationsRateLimiter @@ -53,8 +53,8 @@ decodeChainUpdateAt encoded offset = do (remoteChainSelector, offset) <- decodeNumeric0At encoded offset (remotePools, offset) <- decodeBytesHexList encoded offset (remoteTokenAddress, offset) <- decodeBytesHexAt encoded offset - (inboundCCVs, offset) <- decodeRawInstanceAddressList encoded offset - (outboundCCVs, offset) <- decodeRawInstanceAddressList encoded offset + (inboundCCVs, offset) <- decodeList encoded offset decodeRawInstanceAddressAt + (outboundCCVs, offset) <- decodeList encoded offset decodeRawInstanceAddressAt (finalityConfig, offset) <- decodeRequestedFinalityAt encoded offset (inboundRateLimiter, offset) <- decodeRawInstanceAddressAt encoded offset (inboundCustomBlockConfirmationsRateLimiter, offset) <- decodeRawInstanceAddressAt encoded offset @@ -70,8 +70,8 @@ encodeRemoteChainConfig : RemoteChainConfig -> BytesHex encodeRemoteChainConfig params = encodeBytesHexList params.remotePools <> encodeBytesHex params.remoteTokenAddress - <> encodeRawInstanceAddressList params.inboundCCVs - <> encodeRawInstanceAddressList params.outboundCCVs + <> encodeList params.inboundCCVs encodeRawInstanceAddress + <> encodeList params.outboundCCVs encodeRawInstanceAddress <> encodeRequestedFinality params.finalityConfig <> encodeRawInstanceAddress params.inboundRateLimiter <> encodeRawInstanceAddress params.inboundCustomBlockConfirmationsRateLimiter @@ -81,8 +81,8 @@ decodeRemoteChainConfigAt : BytesHex -> Int -> Optional (RemoteChainConfig, Int) decodeRemoteChainConfigAt encoded offset = do (remotePools, offset) <- decodeBytesHexList encoded offset (remoteTokenAddress, offset) <- decodeBytesHexAt encoded offset - (inboundCCVs, offset) <- decodeRawInstanceAddressList encoded offset - (outboundCCVs, offset) <- decodeRawInstanceAddressList encoded offset + (inboundCCVs, offset) <- decodeList encoded offset decodeRawInstanceAddressAt + (outboundCCVs, offset) <- decodeList encoded offset decodeRawInstanceAddressAt (finalityConfig, offset) <- decodeRequestedFinalityAt encoded offset (inboundRateLimiter, offset) <- decodeRawInstanceAddressAt encoded offset (inboundCustomBlockConfirmationsRateLimiter, offset) <- decodeRawInstanceAddressAt encoded offset diff --git a/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolTypes.daml b/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1Types.daml similarity index 63% rename from contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolTypes.daml rename to contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1Types.daml index 8c3599369..c5165c65a 100644 --- a/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolTypes.daml +++ b/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolV1Types.daml @@ -1,34 +1,35 @@ -- | Types for BurnMintTokenPool, extracted to avoid circular dependencies -module CCIP.BurnMintTokenPoolTypes where +module CCIP.BurnMintTokenPoolV1Types where import DA.Crypto.Text (BytesHex) -import qualified CCIP.FinalityConfig -import Chainlink.InstanceAddress (RawInstanceAddress) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CodecV1.FinalityConfig data ChainUpdate = ChainUpdate with - remoteChainSelector : Numeric 0 -- Chain selector for this config update - remotePools : [BytesHex] -- Allowed remote pool addresses for this chain - remoteTokenAddress : BytesHex -- The token address on the remote chain - inboundCCVs : [RawInstanceAddress] -- Required CCVs for incoming transfers - outboundCCVs : [RawInstanceAddress] -- Required CCVs for outgoing transfers - finalityConfig : CCIP.FinalityConfig.FinalityConfig -- Allowed finality policy, "WaitForFinality" means finalized-only - inboundRateLimiter : RawInstanceAddress -- Required rate limiter for incoming transfers - inboundCustomBlockConfirmationsRateLimiter : RawInstanceAddress -- Required rate limiter for FTF incoming transfers - outboundRateLimiter : RawInstanceAddress -- Required rate limiter for outgoing transfers + remoteChainSelector : Numeric 0 -- Chain selector for this config update + remotePools : [BytesHex] -- Allowed remote pool addresses for this chain + remoteTokenAddress : BytesHex -- The token address on the remote chain + inboundCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs for incoming transfers + outboundCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs for outgoing transfers + finalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig -- Allowed finality policy, "WaitForFinality" means finalized-only + inboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for incoming transfers + inboundCustomBlockConfirmationsRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for FTF incoming transfers + outboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for outgoing transfers deriving (Eq, Show) data RemoteChainConfig = RemoteChainConfig with - remotePools : [BytesHex] -- Allowed remote pool addresses for this chain - remoteTokenAddress : BytesHex -- The token address on the remote chain - inboundCCVs : [RawInstanceAddress] -- Required CCVs for incoming transfers - outboundCCVs : [RawInstanceAddress] -- Required CCVs for outgoing transfers - finalityConfig : CCIP.FinalityConfig.FinalityConfig -- Allowed finality policy, "WaitForFinality" means finalized-only - inboundRateLimiter : RawInstanceAddress -- Required rate limiter for incoming transfers - inboundCustomBlockConfirmationsRateLimiter : RawInstanceAddress -- Required rate limiter for FTF incoming transfers - outboundRateLimiter : RawInstanceAddress -- Required rate limiter for outgoing transfers + remotePools : [BytesHex] -- Allowed remote pool addresses for this chain + remoteTokenAddress : BytesHex -- The token address on the remote chain + inboundCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs for incoming transfers + outboundCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs for outgoing transfers + finalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig -- Allowed finality policy, "WaitForFinality" means finalized-only + inboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for incoming transfers + inboundCustomBlockConfirmationsRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for FTF incoming transfers + outboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for outgoing transfers deriving (Eq, Show) data TokenTransferFeeConfigArgs = TokenTransferFeeConfigArgs @@ -53,9 +54,9 @@ data TokenTransferFeeConfig = TokenTransferFeeConfig data RateLimitConfigArgs = RateLimitConfigArgs with remoteChainSelector : Numeric 0 - inboundRateLimiter : RawInstanceAddress - inboundCustomBlockConfirmationsRateLimiter : RawInstanceAddress - outboundRateLimiter : RawInstanceAddress + inboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress + inboundCustomBlockConfirmationsRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress + outboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) -- | Transfer timeout configuration for pending TransferInstructions. @@ -99,12 +100,12 @@ data SetRateLimiterReferencesParams = SetRateLimiterReferencesParams deriving (Eq, Show) -- | Params for SetRateLimitConfig (tune capacity/rate/isEnabled; MCMS entrypoint). --- | rateLimiterInstanceAddress: full RawInstanceAddress (instanceId@owner), not bare instanceId. +-- | rateLimiterInstanceAddress: full Chainlink.InstanceAddress.RawInstanceAddress (instanceId@owner), not bare instanceId. -- | Resolved against MCMS contractIds map key; pool choice receives the resulting ContractId. data SetRateLimitConfigParams = SetRateLimitConfigParams with caller : Party - rateLimiterInstanceAddress : RawInstanceAddress + rateLimiterInstanceAddress : Chainlink.InstanceAddress.RawInstanceAddress newIsEnabled : Bool newCapacity : Numeric 0 newRate : Numeric 0 @@ -128,7 +129,7 @@ data AddPoolReceiveContextNonContractValueParams = AddPoolReceiveContextNonContr data AddPoolReceiveContextContractValueParams = AddPoolReceiveContextContractValueParams with contextKey : Text - referentInstanceAddress : RawInstanceAddress + referentInstanceAddress : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) -- | MCMS params: remove one ChoiceContext entry by key. diff --git a/contracts/ccip/pools/lock-release-token-pool/daml.yaml b/contracts/ccip/pools/lock-release-token-pool/daml.yaml index dabf92f13..5a9eb0f57 100644 --- a/contracts/ccip/pools/lock-release-token-pool/daml.yaml +++ b/contracts/ccip/pools/lock-release-token-pool/daml.yaml @@ -10,10 +10,15 @@ data-dependencies: - ../../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../../api/.daml/dist/ccip-api-2.0.0.dar + - ../../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar + - ../../events/.daml/dist/ccip-events-2.0.0.dar + - ../../tickets/.daml/dist/ccip-tickets-2.0.0.dar + - ../../utils/.daml/dist/ccip-utils-2.0.0.dar + - ../../rate-limiter/.daml/dist/ccip-rate-limiter-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../../mcms/api/.daml/dist/mcms-api-1.0.0.dar - - ../../core/.daml/dist/ccip-core-2.0.0.dar - - ../../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar diff --git a/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPool.daml b/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1.daml similarity index 74% rename from contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPool.daml rename to contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1.daml index e2f9ce35d..91f9476ce 100644 --- a/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPool.daml +++ b/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1.daml @@ -5,9 +5,9 @@ -- uses "transfer-preapproval" key). The pool stores a poolReceiveContext that gets -- merged into extraArgs for inbound transfers, enabling direct transfers without -- pending state when the pool has preapproval. -module CCIP.LockReleaseTokenPool ( - module CCIP.LockReleaseTokenPool - , module CCIP.LockReleaseTokenPoolTypes +module CCIP.LockReleaseTokenPoolV1 ( + module CCIP.LockReleaseTokenPoolV1 + , module CCIP.LockReleaseTokenPoolV1Types ) where import DA.Action (foldlA) @@ -21,8 +21,30 @@ import DA.Date (date, Month(Dec)) import DA.Time (time, addRelTime, hours) import DA.Foldable (forA_) +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 +import qualified Splice.Api.Token.TransferInstructionV1 + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import CCIP.LockReleaseTokenPoolCodecGen ( + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.Math +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CodecV1.Uint256 +import qualified CCIP.EventsV1.Events +import qualified CCIP.InterfacesV1.TokenPool +import qualified CCIP.RateLimiterV1 +import qualified CCIP.TicketsV1 +import qualified CCIP.UtilsV1.Context + +import CCIP.LockReleaseTokenPoolV1CodecGen ( decodeSetDynamicConfigParamsAt, decodeApplyChainUpdatesParamsAt, decodeApplyTokenTransferFeeConfigUpdatesParamsAt, @@ -33,8 +55,7 @@ import CCIP.LockReleaseTokenPoolCodecGen ( decodeAddPoolReceiveContextContractValueParamsAt, decodeRemovePoolReceiveContextValueParamsAt, ) -import CCIP.ContextCodec (decodeAnyValueAt) -import CCIP.LockReleaseTokenPoolTypes ( +import CCIP.LockReleaseTokenPoolV1Types ( TokenTransferFeeConfig(..), RemoteChainConfig(..), ChainUpdate(..), @@ -52,27 +73,6 @@ import CCIP.LockReleaseTokenPoolTypes ( RemovePoolReceiveContextValueParams(..), ) -import qualified Splice.Api.Token.HoldingV1 -import qualified Splice.Api.Token.MetadataV1 -import qualified Splice.Api.Token.TransferInstructionV1 - -import qualified CCIP.Context -import qualified CCIP.Events -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.FinalityConfig -import qualified CCIP.FeeQuoter -import qualified CCIP.Interfaces.TokenPool -import qualified CCIP.MessageCodecV1 -import qualified CCIP.Math -import qualified CCIP.Uint256 -import qualified CCIP.RateLimiter -import Chainlink.InstanceAddress (RawInstanceAddress, assertValidInstanceId) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 -import qualified CCIP.Tickets -import qualified CCIP.TokenAdminRegistry - -- | Far-future time used as "never expires" for pending transfers. -- Matches Splice's maxTime pattern: https://github.com/hyperledger-labs/splice/blob/139ee12335f61851d7cbf540a4b56c80622c911f/daml/splice-amulet/daml/Splice/Expiry.daml#L125 maxTime : Time @@ -82,31 +82,31 @@ transferFactoryContextKey : Text transferFactoryContextKey = "transfer-factory" lookupTransferFactory : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory) -lookupTransferFactory ctx = CCIP.Context.getFromContextU ctx transferFactoryContextKey +lookupTransferFactory ctx = CCIP.UtilsV1.Context.getFromContextU ctx transferFactoryContextKey transferFactoryExtraArgsContextValuesContextKey : Text transferFactoryExtraArgsContextValuesContextKey = "transfer-factory-extra-args-context-values" lookupTransferFactoryExtraArgsContextValues : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (TextMap.TextMap Splice.Api.Token.MetadataV1.AnyValue) -lookupTransferFactoryExtraArgsContextValues ctx = fromOptional TextMap.empty <$> CCIP.Context.lookupFromContextU ctx transferFactoryExtraArgsContextValuesContextKey +lookupTransferFactoryExtraArgsContextValues ctx = fromOptional TextMap.empty <$> CCIP.UtilsV1.Context.lookupFromContextU ctx transferFactoryExtraArgsContextValuesContextKey transferFactoryExtraArgsMetaValuesContextKey : Text transferFactoryExtraArgsMetaValuesContextKey = "transfer-factory-extra-args-meta-values" lookupTransferFactoryExtraArgsMetaValues : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (TextMap.TextMap Text) -lookupTransferFactoryExtraArgsMetaValues ctx = fromOptional TextMap.empty <$> CCIP.Context.lookupFromContextU ctx transferFactoryExtraArgsMetaValuesContextKey +lookupTransferFactoryExtraArgsMetaValues ctx = fromOptional TextMap.empty <$> CCIP.UtilsV1.Context.lookupFromContextU ctx transferFactoryExtraArgsMetaValuesContextKey tokenPoolHoldingsContextKey : Text tokenPoolHoldingsContextKey = "token-pool-holdings" lookupTokenPoolHoldings : Splice.Api.Token.MetadataV1.ChoiceContext -> Update [ContractId Splice.Api.Token.HoldingV1.Holding] -lookupTokenPoolHoldings ctx = CCIP.Context.getFromContextU ctx tokenPoolHoldingsContextKey +lookupTokenPoolHoldings ctx = CCIP.UtilsV1.Context.getFromContextU ctx tokenPoolHoldingsContextKey data LockReleaseTokenPoolDeps = LockReleaseTokenPoolDeps with - tokenAdminRegistry : RawInstanceAddress - rmnRemote : RawInstanceAddress - feeQuoter : RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) parseSourcePoolDecimals : Int -> BytesHex -> Int @@ -116,7 +116,7 @@ parseSourcePoolDecimals localDecimals sourcePoolData = else let decoded = fromSomeNote "ReleaseFromTicket: invalid source pool decimals" - (CCIP.MessageCodecV1.decodeUint256 sourcePoolData) + (CCIP.CodecV1.MessageCodecV1.decodeUint256 sourcePoolData) in if decoded < 0.0 || decoded > 255.0 then error "ReleaseFromTicket: invalid source pool decimals" @@ -124,7 +124,7 @@ parseSourcePoolDecimals localDecimals sourcePoolData = calculateLocalAmount : Numeric 0 -> Int -> Int -> Numeric 0 calculateLocalAmount remoteAmount remoteDecimals localDecimals = - CCIP.Math.calculateLocalAmountChecked + CCIP.CodecV1.Math.calculateLocalAmountChecked "LockReleaseTokenPool.calculateLocalAmount" remoteAmount remoteDecimals @@ -191,7 +191,7 @@ assertTransferInstructionMatches prefix expectedSender expectedReceiver expected assertMsg (prefix <> ": pending transfer instrumentId mismatch") (transfer.instrumentId == expectedInstrumentId) -remoteChainRateLimiterAddresses : Map.Map (Numeric 0) RemoteChainConfig -> [RawInstanceAddress.RawInstanceAddress] +remoteChainRateLimiterAddresses : Map.Map (Numeric 0) RemoteChainConfig -> [Chainlink.InstanceAddress.RawInstanceAddress] remoteChainRateLimiterAddresses configs = concatMap (\(_, cfg) -> @@ -205,12 +205,12 @@ assertPoolConfiguredRateLimiter : Text -> Party -> Map.Map (Numeric 0) RemoteChainConfig - -> ContractId CCIP.RateLimiter.RateLimiter + -> ContractId CCIP.RateLimiterV1.RateLimiter -> Update () assertPoolConfiguredRateLimiter poolInstanceId poolOwner remoteChainConfigs rateLimiterCid = do rl <- fetch rateLimiterCid assertMsg "SetRateLimitConfig: rate limiter not configured on pool" - (CCIP.RateLimiter.rawInstanceAddress rl `elem` remoteChainRateLimiterAddresses remoteChainConfigs) + (CCIP.RateLimiterV1.rawInstanceAddress rl `elem` remoteChainRateLimiterAddresses remoteChainConfigs) assertMsg "SetRateLimitConfig: pool instance mismatch" (rl.poolInstanceId == poolInstanceId) assertMsg "SetRateLimitConfig: pool owner mismatch" (rl.poolOwner == poolOwner) @@ -218,13 +218,13 @@ assertRateLimiter : Text -> Text -> Numeric 0 - -> CCIP.RateLimiter.RateLimitDirection - -> CCIP.RateLimiter.RateLimitMode - -> RawInstanceAddress.RawInstanceAddress - -> CCIP.RateLimiter.RateLimiter + -> CCIP.RateLimiterV1.RateLimitDirection + -> CCIP.RateLimiterV1.RateLimitMode + -> Chainlink.InstanceAddress.RawInstanceAddress + -> CCIP.RateLimiterV1.RateLimiter -> Update () assertRateLimiter prefix poolInstanceId remoteChainSelector direction mode expected limiter = do - RawInstanceAddress.assertEqual (prefix <> ": instance address mismatch") + Chainlink.InstanceAddress.assertEqual (prefix <> ": instance address mismatch") limiter.instanceId limiter.poolOwner expected @@ -241,11 +241,11 @@ bpsDenominator : Numeric 0 bpsDenominator = 10000.0 calculateFeeFromBps : Numeric 0 -> Numeric 0 -> Numeric 0 -calculateFeeFromBps amount feeBps = CCIP.Math.mulDivDown amount feeBps bpsDenominator +calculateFeeFromBps amount feeBps = CCIP.CodecV1.Math.mulDivDown amount feeBps bpsDenominator -customFinalityRateLimiterRequired : CCIP.FinalityConfig.FinalityConfig -> Bool +customFinalityRateLimiterRequired : CCIP.CodecV1.FinalityConfig.FinalityConfig -> Bool customFinalityRateLimiterRequired finalityConfig = - CCIP.FinalityConfig.customFinalityRateLimiterRequired finalityConfig + CCIP.CodecV1.FinalityConfig.customFinalityRateLimiterRequired finalityConfig -- | Lock/release token pool with dynamic CCV requirements per chain. template LockReleaseTokenPool @@ -280,10 +280,10 @@ template LockReleaseTokenPool signatory poolOwner observer optional [] pure rateLimitAdmin - ensure assertValidInstanceId instanceId - && CCIP.Math.isValidTokenDecimals decimals + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId + && CCIP.CodecV1.Math.isValidTokenDecimals decimals && all - (\cfg -> CCIP.FinalityConfig.isValidFinalityConfig cfg.finalityConfig) + (\cfg -> CCIP.CodecV1.FinalityConfig.isValidFinalityConfig cfg.finalityConfig) (Map.values remoteChainConfigs) && all (\cfg -> @@ -293,18 +293,20 @@ template LockReleaseTokenPool ) (Map.values tokenTransferFeeConfigs) - interface instance CCIP.Interfaces.TokenPool.ITokenPool for LockReleaseTokenPool where - view = CCIP.Interfaces.TokenPool.TokenPoolView with + interface instance CCIP.InterfacesV1.TokenPool.ITokenPool for LockReleaseTokenPool where + view = CCIP.InterfacesV1.TokenPool.TokenPoolView with owner = poolOwner ccipOwner = ccipOwner instrumentId = instrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext tokenPool_getRequiredCCVsImpl self arg = do + let finality = fromSomeNote "Invalid finality" (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality arg.finality) exercise (fromInterfaceContractId @LockReleaseTokenPool self) GetRequiredCCVs with remoteChainSelector = arg.remoteChainSelector sourceAmount = arg.sourceAmount - finality = arg.finality + finality = finality.requested extraData = arg.extraData direction = arg.direction caller = arg.caller @@ -314,8 +316,8 @@ template LockReleaseTokenPool with tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid - extraContext = arg.extraContext executingMessageCid = arg.executingMessageCid + context = arg.context caller = arg.caller tokenPool_verifyOutboundCCVsImpl self arg = do @@ -323,9 +325,9 @@ template LockReleaseTokenPool with tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid - extraContext = arg.extraContext sendingMessageCid = arg.sendingMessageCid amount = arg.amount + context = arg.context caller = arg.caller tokenPool_releaseFromTicketImpl self arg = do @@ -334,8 +336,8 @@ template LockReleaseTokenPool tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid rmnRemoteCid = arg.rmnRemoteCid - extraContext = arg.extraContext tokenReceiveTicketCid = arg.tokenReceiveTicketCid + context = arg.context caller = arg.caller tokenPool_lockOrBurnImpl self arg = do @@ -344,10 +346,10 @@ template LockReleaseTokenPool tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid rmnRemoteCid = arg.rmnRemoteCid - extraContext = arg.extraContext sendingMessageCid = arg.sendingMessageCid senderInputCids = arg.senderInputCids amount = arg.amount + context = arg.context caller = arg.caller tokenPool_calculateFeeImpl self arg = do @@ -355,10 +357,10 @@ template LockReleaseTokenPool with tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid - extraContext = arg.extraContext sendingMessageCid = arg.sendingMessageCid feeQuoterCid = arg.feeQuoterCid tokenInstrumentId = arg.tokenInstrumentId + context = arg.context caller = arg.caller tokenPool_getFeeImpl self arg = do @@ -367,6 +369,7 @@ template LockReleaseTokenPool feeQuoterCid = arg.feeQuoterCid destChainSelector = arg.destChainSelector tokenInstrumentId = arg.tokenInstrumentId + context = arg.context caller = arg.caller -- Sets the dynamic configuration for the pool. @@ -418,9 +421,9 @@ template LockReleaseTokenPool assertMsg "ApplyChainUpdates: remote token address cannot be empty" (remoteTokenAddress /= "") -- If the chain already exists, the update should first remove it. assertMsg ("ApplyChainUpdates: chain already exists: " <> show remoteChainSelector) (not (Map.member remoteChainSelector remoteChainConfigsRemoved)) - assertMsg "ApplyChainUpdates: BlockDepth finality must be positive" (CCIP.FinalityConfig.isValidFinalityConfig finalityConfig) + assertMsg "ApplyChainUpdates: BlockDepth finality must be positive" (CCIP.CodecV1.FinalityConfig.isValidFinalityConfig finalityConfig) -- Validate rate limiters - CCIP.RateLimiter.assertDistinctRateLimiters "ApplyChainUpdates" + CCIP.RateLimiterV1.assertDistinctRateLimiters "ApplyChainUpdates" inboundRateLimiter outboundRateLimiter (if customFinalityRateLimiterRequired finalityConfig @@ -491,10 +494,10 @@ template LockReleaseTokenPool -- Tunes capacity/rate/isEnabled on a rate limiter already referenced by this pool's remote chain config. -- Callable by poolOwner; caller must be poolOwner or rateLimitAdmin (admin does not sign—owner executes on their behalf). - nonconsuming choice SetRateLimitConfig : ContractId CCIP.RateLimiter.RateLimiter + nonconsuming choice SetRateLimitConfig : ContractId CCIP.RateLimiterV1.RateLimiter with caller : Party - rateLimiterCid : ContractId CCIP.RateLimiter.RateLimiter + rateLimiterCid : ContractId CCIP.RateLimiterV1.RateLimiter newIsEnabled : Bool newCapacity : Numeric 0 newRate : Numeric 0 @@ -503,7 +506,7 @@ template LockReleaseTokenPool assertMsg "SetRateLimitConfig: unauthorized caller" (caller == poolOwner || rateLimitAdmin == Some caller) assertPoolConfiguredRateLimiter instanceId poolOwner remoteChainConfigs rateLimiterCid - exercise rateLimiterCid CCIP.RateLimiter.SetConfig with + exercise rateLimiterCid CCIP.RateLimiterV1.SetConfig with newIsEnabled newCapacity newRate @@ -521,7 +524,7 @@ template LockReleaseTokenPool cfg <- case Map.lookup arg.remoteChainSelector remoteChainConfigs of None -> abort ("SetRateLimiterReferences: unsupported chain selector: " <> show arg.remoteChainSelector) Some cfg -> pure cfg - CCIP.RateLimiter.assertDistinctRateLimiters "SetRateLimitConfig" + CCIP.RateLimiterV1.assertDistinctRateLimiters "SetRateLimitConfig" arg.inboundRateLimiter arg.outboundRateLimiter (if customFinalityRateLimiterRequired cfg.finalityConfig @@ -592,51 +595,56 @@ template LockReleaseTokenPool do create this with transferTimeout = newTransferTimeout -- Get required CCV raw instance addresses based on chain and direction. - nonconsuming choice GetRequiredCCVs : [RawInstanceAddress] + nonconsuming choice GetRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] with remoteChainSelector : Numeric 0 sourceAmount : BytesHex - finality : CCIP.FinalityConfig.FinalityConfig + finality : CCIP.CodecV1.FinalityConfig.FinalityConfig extraData : BytesHex - direction : CCIP.Interfaces.TokenPool.TransferDirection + direction : CCIP.InterfacesV1.TokenPool.TransferDirection caller : Party controller caller do case Map.lookup remoteChainSelector remoteChainConfigs of None -> abort "pool: unsupported remote chain selector" Some config -> case direction of - CCIP.Interfaces.TokenPool.Inbound -> pure config.inboundCCVs - CCIP.Interfaces.TokenPool.Outbound -> pure config.outboundCCVs + CCIP.InterfacesV1.TokenPool.Inbound -> pure config.inboundCCVs + CCIP.InterfacesV1.TokenPool.Outbound -> pure config.outboundCCVs -- Validate inbound token transfer message and record pool CCV requirements. -- Validates that the message has a token transfer targeting this pool's instrument, -- validates the source pool address against the allowed remote pools for the source chain, -- looks up per-chain CCV requirements, and records them on the executing message. -- OffRamp performs the actual CCV coverage check. - nonconsuming choice VerifyInboundMessage : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + nonconsuming choice VerifyInboundMessage : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + executingMessageCid : ContractId CCIP.APIV1.ExecutingMessage.IExecutingMessage + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do execMsg <- fetch executingMessageCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + let execMsgView = view execMsg + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch + with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry assertMsg "pool: executing message tokenAdminRegistry mismatch" - (execMsg.deps.tokenAdminRegistry == deps.tokenAdminRegistry) + (execMsgView.tokenAdminRegistry == deps.tokenAdminRegistry) assertMsg "pool: executing message rmnRemote mismatch" - (execMsg.deps.rmnRemote == deps.rmnRemote) - let message = execMsg.message + (execMsgView.rmnRemote == deps.rmnRemote) + let message = execMsgView.message tt <- case message.tokenTransfer of None -> abort "pool: no token transfer in message" Some t -> pure t - let expectedAddr = CCIP.MessageCodecV1.encodeInstrumentId instrumentId + let expectedAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId instrumentId assertMsg "pool: destTokenAddress does not match pool instrumentId" (tt.destTokenAddress == expectedAddr) @@ -644,7 +652,7 @@ template LockReleaseTokenPool None -> abort "pool: unsupported source chain" Some cfg -> pure cfg assertMsg "pool: message finality not allowed by pool finality config" - (CCIP.FinalityConfig.requestedFinalityAllowed message.finality.requested remoteChainCfg.finalityConfig) + (CCIP.CodecV1.FinalityConfig.requestedFinalityAllowed message.finality.requested remoteChainCfg.finalityConfig) assertMsg "pool: invalid sourcePoolAddress" (tt.sourcePoolAddress `elem` remoteChainCfg.remotePools) @@ -653,91 +661,109 @@ template LockReleaseTokenPool (tt.sourceTokenAddress == remoteChainCfg.remoteTokenAddress) exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.SetInboundPoolCCVs with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_SetInboundPoolCCVs with tokenConfigCid executingMessageCid poolInstanceId = instanceId poolCCVs = remoteChainCfg.inboundCCVs + context = context caller = poolOwner -- Declare outbound CCV requirements on SendingMessageV1 via TAR. -- Looks up per-chain CCV requirements and records them on the sending message. - nonconsuming choice VerifyOutboundCCVs : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice VerifyOutboundCCVs : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage amount : Decimal + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do assertMsg "pool: amount must be positive" (amount > 0.0) - sm <- fetch sendingMessageCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + sendingMsg <- fetch sendingMessageCid + let sendingMsgView = view sendingMsg + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch + with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry assertMsg "pool: sending message ccipOwner mismatch" - (sm.ccipOwner == tokenAdminRegistry.owner) + (sendingMsgView.ccipOwner == tokenAdminRegistryView.ccipOwner) assertMsg "pool: sending message tokenAdminRegistry mismatch" - (sm.deps.tokenAdminRegistry == deps.tokenAdminRegistry) + (sendingMsgView.tokenAdminRegistry == deps.tokenAdminRegistry) assertMsg "pool: sending message rmnRemote mismatch" - (sm.deps.rmnRemote == deps.rmnRemote) + (sendingMsgView.rmnRemote == deps.rmnRemote) - poolCCVs <- case Map.lookup sm.destChainSelector remoteChainConfigs of + poolCCVs <- case Map.lookup sendingMsgView.destChainSelector remoteChainConfigs of None -> abort "pool: unsupported dest chain" Some cfg -> pure cfg.outboundCCVs exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.SetOutboundPoolCCVs with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_SetOutboundPoolCCVs with tokenConfigCid sendingMessageCid = sendingMessageCid poolInstanceId = instanceId poolCCVs = poolCCVs + context = context caller = poolOwner -- Release tokens by consuming a TokenReceiveTicket via TokenAdminRegistry. -- The TAR validates the ticket was issued by the correct registry instance, -- the pool is the registered pool for the instrument, and archives the ticket -- atomically. If any check fails, the entire transaction rolls back. - nonconsuming choice ReleaseFromTicket : CCIP.Interfaces.TokenPool.ReleaseOrMintResult + nonconsuming choice ReleaseFromTicket : CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - tokenReceiveTicketCid : ContractId CCIP.Tickets.TokenReceiveTicket + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + tokenReceiveTicketCid : ContractId CCIP.APIV1.ExecutingMessage.ITokenReceiveTicket + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do - ticket <- fetch tokenReceiveTicketCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "ReleaseFromTicket: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry - config <- exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.GetTokenConfigByCid with + let tokenReceiveTicketImplementation = coerceContractId @_ @CCIP.TicketsV1.TokenReceiveTicket tokenReceiveTicketCid + + ticket <- fetch tokenReceiveTicketImplementation + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch + with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "ReleaseFromTicket: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry + _ <- exercise tokenAdminRegistryCid + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_FetchTokenConfig with tokenConfigCid instrumentId = instrumentId + context = context caller = poolOwner assertMsg "ReleaseFromTicket: ticket tokenAdminRegistry instance mismatch" - (ticket.tokenAdminRegistryInstanceId == tokenAdminRegistry.instanceId) + (ticket.tokenAdminRegistryInstanceId == tokenAdminRegistryView.instanceId) assertMsg "ReleaseFromTicket: ticket ccipOwner mismatch" - (ticket.ccipOwner == tokenAdminRegistry.owner) - rmnRemote <- exercise rmnRemoteCid CCIP.RMNRemote.Get with caller - RawInstanceAddress.assertEqual "ReleaseFromTicket: rmn mismatch" - rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote + (ticket.ccipOwner == tokenAdminRegistryView.ccipOwner) + rmnRemoteView <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_PublicFetch with + expectedAddress = deps.rmnRemote + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "ReleaseFromTicket: rmn mismatch" + rmnRemoteView.instanceId rmnRemoteView.rmnOwner deps.rmnRemote assertMsg "ReleaseFromTicket: ticket instrument must match pool instrument" (ticket.instrumentId == instrumentId) - let poolAddress = RawInstanceAddress.make instanceId poolOwner + let poolAddress = Chainlink.InstanceAddress.make instanceId poolOwner assertMsg "ReleaseFromTicket: ticket pool owner mismatch" (ticket.poolOwner == poolOwner) assertMsg "ReleaseFromTicket: ticket pool address mismatch" (ticket.poolAddress == poolAddress) - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with - caller = poolOwner + isCursed <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_IsCursedForChain with chainSelector = ticket.sourceChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = poolOwner assertMsg "ReleaseFromTicket: source chain is cursed" (not isCursed) assertMsg "ReleaseFromTicket: caller must be tokenReceiver" @@ -748,7 +774,7 @@ template LockReleaseTokenPool let ticketSignatories = signatory ticket Foldable.forA_ ticket.verifiedCCVs $ \verifiedCCV -> assertMsg ("ReleaseFromTicket: verified CCV owner is not a ticket signatory " <> show verifiedCCV) - (RawInstanceAddress.ownerParty verifiedCCV `elem` ticketSignatories) + (Chainlink.InstanceAddress.ownerParty verifiedCCV `elem` ticketSignatories) -- Also check that the pool's owner is a signatory on the ticket assertMsg "ReleaseFromTicket: pool owner is not a ticket signatory" @@ -766,26 +792,26 @@ template LockReleaseTokenPool (requiredCCV `elem` ticket.verifiedCCVs) let useCustomFinalityRateLimiter = - ticket.finality /= CCIP.FinalityConfig.WaitForFinality - && CCIP.FinalityConfig.customFinalityRateLimiterRequired remoteChainCfg.finalityConfig + ticket.finality /= CCIP.CodecV1.FinalityConfig.WaitForFinality + && CCIP.CodecV1.FinalityConfig.customFinalityRateLimiterRequired remoteChainCfg.finalityConfig let expectedRateLimitMode = if useCustomFinalityRateLimiter - then CCIP.RateLimiter.RateLimitMode_CustomFinality - else CCIP.RateLimiter.RateLimitMode_DefaultFinality + then CCIP.RateLimiterV1.RateLimitMode_CustomFinality + else CCIP.RateLimiterV1.RateLimitMode_DefaultFinality let expectedRateLimiter = if useCustomFinalityRateLimiter then remoteChainCfg.inboundCustomBlockConfirmationsRateLimiter else remoteChainCfg.inboundRateLimiter - rateLimiterCid <- CCIP.RateLimiter.lookupRateLimiterCid extraContext + rateLimiterCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RateLimiterV1.rateLimiterContextKey rateLimiter <- fetch rateLimiterCid assertRateLimiter "ReleaseFromTicket: rateLimiter" instanceId ticket.sourceChainSelector - CCIP.RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound expectedRateLimitMode expectedRateLimiter rateLimiter let sourceDecimals = parseSourcePoolDecimals decimals ticket.sourcePoolData - conversion <- case CCIP.Uint256.calculateLocalAmountFromUint256Checked + conversion <- case CCIP.CodecV1.Uint256.calculateLocalAmountFromUint256Checked "ReleaseFromTicket" ticket.amount sourceDecimals @@ -795,32 +821,33 @@ template LockReleaseTokenPool assertMsg "ReleaseFromTicket: local amount rounds down to zero" (conversion.localAmount > 0.0) let localAmount = conversion.localAmount - _ <- exercise rateLimiterCid CCIP.RateLimiter.ConsumeCapacity with + _ <- exercise rateLimiterCid CCIP.RateLimiterV1.ConsumeCapacity with requested = localAmount -- Consume ticket via TAR after validating the disclosed TAR identity. exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.ConsumeReceiveTicket with - tokenConfigCid - ticketCid = tokenReceiveTicketCid + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_ConsumeReceiveTicket with + tokenConfigCid = tokenConfigCid + tokenReceiveTicketCid = tokenReceiveTicketCid instrumentId = instrumentId poolInstanceId = instanceId + context = context caller = poolOwner - -- Get inputs from extraContext - tokenPoolHoldings <- lookupTokenPoolHoldings extraContext + -- Get inputs from context + tokenPoolHoldings <- CCIP.UtilsV1.Context.getFromContextU context tokenPoolHoldingsContextKey _ <- sumCheckedHoldingAmounts "ReleaseFromTicket: tokenPoolHoldings" poolOwner instrumentId tokenPoolHoldings - transferFactory <- lookupTransferFactory extraContext - CCIP.TokenAdminRegistry.assertConfiguredTransferFactory - "ReleaseFromTicket" - config - transferFactory - extraArgsContextValues <- lookupTransferFactoryExtraArgsContextValues extraContext - extraArgsMetaValues <- lookupTransferFactoryExtraArgsMetaValues extraContext + transferFactory <- lookupTransferFactory context + _ <- exercise tokenConfigCid CCIP.APIV1.TokenAdminRegistry.TokenConfig_AssertConfiguredTransferFactory with + suppliedFactory = transferFactory + context = context + caller = poolOwner + extraArgsContextValues <- lookupTransferFactoryExtraArgsContextValues context + extraArgsMetaValues <- lookupTransferFactoryExtraArgsMetaValues context -- Transfer tokens from pool to receiver via TransferFactory. -- If receiver has preapproval, completes immediately. Otherwise creates pending @@ -829,7 +856,7 @@ template LockReleaseTokenPool let executeBefore = case transferTimeout of Indefinite -> maxTime RelativeHours h -> addRelTime now (hours h) - let amountDecimal = CCIP.Math.numeric0ToDecimal localAmount + let amountDecimal = CCIP.CodecV1.Math.numeric0ToDecimal localAmount let transfer = Splice.Api.Token.TransferInstructionV1.Transfer with sender = poolOwner receiver = ticket.tokenReceiver @@ -859,18 +886,18 @@ template LockReleaseTokenPool instrumentId amountDecimal receiverCids - let output = CCIP.Interfaces.TokenPool.ReleaseOrMintResult_Completed with + let output = CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed with receiverHoldingCids = receiverCids - let claimedOutput = CCIP.Events.TokenReceiveTicketClaimed_Completed with + let claimedOutput = CCIP.EventsV1.Events.TokenReceiveTicketClaimed_Completed with receiverHoldingCids = receiverCids - claimedEventCid <- create CCIP.Events.TokenReceiveTicketClaimed with + claimedEventCid <- create CCIP.EventsV1.Events.TokenReceiveTicketClaimed with ccipOwner = ticket.ccipOwner ccvOwners = ticket.ccvOwners poolOwner = ticket.poolOwner receiver = ticket.receiver tokenReceiver = ticket.tokenReceiver - tokenReceiveTicketCid - event = CCIP.Events.TokenReceiveTicketClaimedEvent with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketImplementation + event = CCIP.EventsV1.Events.TokenReceiveTicketClaimedEvent with verifiedCCVs = ticket.verifiedCCVs tokenAdminRegistryInstanceId = ticket.tokenAdminRegistryInstanceId poolAddress = ticket.poolAddress @@ -882,10 +909,11 @@ template LockReleaseTokenPool sourceChainSelector = ticket.sourceChainSelector finality = ticket.finality output = claimedOutput - pure CCIP.Interfaces.TokenPool.ReleaseOrMintResult with + pure CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult with output poolChangeCids = transferResult.senderChangeCids - claimedEventCid + claimedEventCid = coerceContractId claimedEventCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Pending instrCid -> do assertTransferInstructionMatches "ReleaseFromTicket" @@ -894,18 +922,18 @@ template LockReleaseTokenPool amountDecimal instrumentId instrCid - let output = CCIP.Interfaces.TokenPool.ReleaseOrMintResult_Pending with + let output = CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Pending with transferInstructionCid = instrCid - let claimedOutput = CCIP.Events.TokenReceiveTicketClaimed_Pending with + let claimedOutput = CCIP.EventsV1.Events.TokenReceiveTicketClaimed_Pending with transferInstructionCid = instrCid - claimedEventCid <- create CCIP.Events.TokenReceiveTicketClaimed with + claimedEventCid <- create CCIP.EventsV1.Events.TokenReceiveTicketClaimed with ccipOwner = ticket.ccipOwner ccvOwners = ticket.ccvOwners poolOwner = ticket.poolOwner receiver = ticket.receiver tokenReceiver = ticket.tokenReceiver - tokenReceiveTicketCid - event = CCIP.Events.TokenReceiveTicketClaimedEvent with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketImplementation + event = CCIP.EventsV1.Events.TokenReceiveTicketClaimedEvent with verifiedCCVs = ticket.verifiedCCVs tokenAdminRegistryInstanceId = ticket.tokenAdminRegistryInstanceId poolAddress = ticket.poolAddress @@ -917,45 +945,53 @@ template LockReleaseTokenPool sourceChainSelector = ticket.sourceChainSelector finality = ticket.finality output = claimedOutput - pure CCIP.Interfaces.TokenPool.ReleaseOrMintResult with + pure CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult with output poolChangeCids = transferResult.senderChangeCids - claimedEventCid + claimedEventCid = coerceContractId claimedEventCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext _ -> abort "ReleaseFromTicket: unexpected failed transfer" -- Calculate fee for outbound token transfer (USD cents only). -- Reads destChainSelector from SendingMessageV1, looks up per-chain -- fee config, appends fee directly to SendingMessageV1. - nonconsuming choice CalculateFee - : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice CalculateFee : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage + feeQuoterCid : ContractId CCIP.APIV1.FeeQuoter.IFeeQuoter tokenInstrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do sendingMsg <- fetch sendingMessageCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + let sendingMsgView = view sendingMsg + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch + with + expectedAddress = deps.tokenAdminRegistry + context = context + caller + Chainlink.InstanceAddress.assertEqual "pool: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry assertMsg "pool: sending message ccipOwner mismatch" - (sendingMsg.ccipOwner == tokenAdminRegistry.owner) + (sendingMsgView.ccipOwner == tokenAdminRegistryView.ccipOwner) assertMsg "pool: sending message tokenAdminRegistry mismatch" - (sendingMsg.deps.tokenAdminRegistry == deps.tokenAdminRegistry) + (sendingMsgView.tokenAdminRegistry == deps.tokenAdminRegistry) assertMsg "pool: tokenInstrumentId mismatch" (tokenInstrumentId == instrumentId) - feeQuoter <- exercise feeQuoterCid CCIP.FeeQuoter.Get with caller - RawInstanceAddress.assertEqual "pool: feeQuoter mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + feeQuoterView <- exercise feeQuoterCid CCIP.APIV1.FeeQuoter.FeeQuoter_PublicFetch with + expectedAddress = deps.feeQuoter + context = context + caller + Chainlink.InstanceAddress.assertEqual "pool: feeQuoter mismatch" + feeQuoterView.instanceId feeQuoterView.ccipOwner deps.feeQuoter assertMsg "pool: sending message feeQuoter mismatch" - (sendingMsg.deps.feeQuoter == deps.feeQuoter) + (sendingMsgView.feeQuoter == deps.feeQuoter) -- Check if fee config is enabled for the destination chain. -- If no config is set/it's disabled, use the FeeQuoter defaults. If enabled, use the specified fee parameters. - (feeUSDCents, destGasOverhead, destBytesOverhead) <- case Map.lookup sendingMsg.destChainSelector tokenTransferFeeConfigs of + (feeUSDCents, destGasOverhead, destBytesOverhead) <- case Map.lookup sendingMsgView.destChainSelector tokenTransferFeeConfigs of Some feeConfig | feeConfig.isEnabled -> pure ( feeConfig.feeUSDCents @@ -963,41 +999,47 @@ template LockReleaseTokenPool , feeConfig.destBytesOverhead ) _ -> - exercise feeQuoterCid CCIP.FeeQuoter.GetTokenTransferFee with - destChainSelector = sendingMsg.destChainSelector + exercise feeQuoterCid CCIP.APIV1.FeeQuoter.FeeQuoter_GetTokenTransferFee with + destChainSelector = sendingMsgView.destChainSelector token = tokenInstrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.AddTokenSendFee with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_AddTokenSendFee with tokenConfigCid sendingMessageCid = sendingMessageCid poolInstanceId = instanceId feeUSDCents = feeUSDCents destGasOverhead = destGasOverhead destBytesOverhead = destBytesOverhead + context = context caller = poolOwner -- Quote fee for outbound token transfer (USD cents only). nonconsuming choice GetFee - : CCIP.Interfaces.TokenPool.TokenPoolFeeQuote + : CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote with - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter + feeQuoterCid : ContractId CCIP.APIV1.FeeQuoter.IFeeQuoter destChainSelector : Numeric 0 tokenInstrumentId : Splice.Api.Token.HoldingV1.InstrumentId + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do assertMsg "pool: tokenInstrumentId mismatch" (tokenInstrumentId == instrumentId) - feeQuoter <- exercise feeQuoterCid CCIP.FeeQuoter.Get with caller - RawInstanceAddress.assertEqual "pool: feeQuoter mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + feeQuoterView <- exercise feeQuoterCid CCIP.APIV1.FeeQuoter.FeeQuoter_PublicFetch with + expectedAddress = deps.feeQuoter + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "pool: feeQuoter mismatch" + feeQuoterView.instanceId feeQuoterView.ccipOwner deps.feeQuoter case Map.lookup destChainSelector tokenTransferFeeConfigs of Some feeConfig | feeConfig.isEnabled -> - pure CCIP.Interfaces.TokenPool.TokenPoolFeeQuote with + pure CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote with poolInstanceId = instanceId poolOwner = poolOwner feeUSDCents = feeConfig.feeUSDCents @@ -1005,13 +1047,15 @@ template LockReleaseTokenPool destBytesOverhead = feeConfig.destBytesOverhead tokenFeeBps = feeConfig.feeBps isEnabled = True + context = Splice.Api.Token.MetadataV1.emptyChoiceContext _ -> do (feeUSDCents, destGasOverhead, destBytesOverhead) <- exercise feeQuoterCid - CCIP.FeeQuoter.GetTokenTransferFee with + CCIP.APIV1.FeeQuoter.FeeQuoter_GetTokenTransferFee with destChainSelector = destChainSelector token = tokenInstrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner - pure CCIP.Interfaces.TokenPool.TokenPoolFeeQuote with + pure CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote with poolInstanceId = instanceId poolOwner = poolOwner feeUSDCents = feeUSDCents @@ -1019,77 +1063,88 @@ template LockReleaseTokenPool destBytesOverhead = destBytesOverhead tokenFeeBps = 0.0 isEnabled = False + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Lock tokens for outbound transfer and append token send data. -- Reads from SendingMessageV1 instead of taking separate params. -- Requires ccvAndExecutorHash to be finalized by the executor step before this runs. - nonconsuming choice LockOrBurn : CCIP.Interfaces.TokenPool.LockOrBurnResult + nonconsuming choice LockOrBurn : CCIP.InterfacesV1.TokenPool.LockOrBurnResult with - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - extraContext : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry + tokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage senderInputCids : [ContractId Splice.Api.Token.HoldingV1.Holding] amount : Decimal + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do assertMsg "pool: amount must be positive" (amount > 0.0) - let amountNumeric0 = CCIP.Math.decimalToNumeric0 amount + let amountNumeric0 = CCIP.CodecV1.Math.decimalToNumeric0 amount sendingMsg <- fetch sendingMessageCid - tokenAdminRegistry <- exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.Get with caller - RawInstanceAddress.assertEqual "LockOrBurn: tokenAdminRegistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry - config <- exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.GetTokenConfigByCid with + let sendingMsgView = view sendingMsg + tokenAdminRegistryView <- exercise tokenAdminRegistryCid CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_PublicFetch + with + expectedAddress = deps.tokenAdminRegistry + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "LockOrBurn: tokenAdminRegistry mismatch" + tokenAdminRegistryView.instanceId tokenAdminRegistryView.ccipOwner deps.tokenAdminRegistry + _ <- exercise tokenAdminRegistryCid + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_FetchTokenConfig with tokenConfigCid instrumentId + context = context caller = poolOwner assertMsg "LockOrBurn: sending message ccipOwner mismatch" - (sendingMsg.ccipOwner == tokenAdminRegistry.owner) + (sendingMsgView.ccipOwner == tokenAdminRegistryView.ccipOwner) assertMsg "LockOrBurn: sending message tokenAdminRegistry mismatch" - (sendingMsg.deps.tokenAdminRegistry == deps.tokenAdminRegistry) - rmnRemote <- exercise rmnRemoteCid CCIP.RMNRemote.Get with caller - RawInstanceAddress.assertEqual "LockOrBurn: rmn mismatch" - rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote + (sendingMsgView.tokenAdminRegistry == deps.tokenAdminRegistry) + rmnRemoteView <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_PublicFetch with + expectedAddress = deps.rmnRemote + context = context + caller = caller + Chainlink.InstanceAddress.assertEqual "LockOrBurn: rmn mismatch" + rmnRemoteView.instanceId rmnRemoteView.rmnOwner deps.rmnRemote assertMsg "LockOrBurn: sending message rmn mismatch" - (sendingMsg.deps.rmnRemote == deps.rmnRemote) + (sendingMsgView.rmnRemote == deps.rmnRemote) - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with + isCursed <- exercise rmnRemoteCid CCIP.APIV1.RMNRemote.RMNRemote_IsCursedForChain with + chainSelector = sendingMsgView.destChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner - chainSelector = sendingMsg.destChainSelector assertMsg "LockOrBurn: dest chain is cursed" (not isCursed) - remoteChainCfg <- case Map.lookup sendingMsg.destChainSelector remoteChainConfigs of + remoteChainCfg <- case Map.lookup sendingMsgView.destChainSelector remoteChainConfigs of None -> abort "pool: unsupported dest chain" Some cfg -> pure cfg let destTokenAddr = remoteChainCfg.remoteTokenAddress - let destPoolData = CCIP.MessageCodecV1.encodeUint256 (intToNumeric decimals) - let tokenFeeBps = case Map.lookup sendingMsg.destChainSelector tokenTransferFeeConfigs of + let destPoolData = CCIP.CodecV1.MessageCodecV1.encodeUint256 (intToNumeric decimals) + let tokenFeeBps = case Map.lookup sendingMsgView.destChainSelector tokenTransferFeeConfigs of Some feeCfg | feeCfg.isEnabled -> feeCfg.feeBps _ -> 0.0 let amountAfterFeeBps = amountNumeric0 - calculateFeeFromBps amountNumeric0 tokenFeeBps let expectedRateLimiter = remoteChainCfg.outboundRateLimiter - rateLimiterCid <- CCIP.RateLimiter.lookupRateLimiterCid extraContext + rateLimiterCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RateLimiterV1.rateLimiterContextKey rateLimiter <- fetch rateLimiterCid assertRateLimiter "LockOrBurn: rateLimiter" instanceId - sendingMsg.destChainSelector - CCIP.RateLimiter.RateLimitDirection_Outbound - CCIP.RateLimiter.RateLimitMode_DefaultFinality + sendingMsgView.destChainSelector + CCIP.RateLimiterV1.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality expectedRateLimiter rateLimiter - _ <- exercise rateLimiterCid CCIP.RateLimiter.ConsumeCapacity with + _ <- exercise rateLimiterCid CCIP.RateLimiterV1.ConsumeCapacity with requested = amountAfterFeeBps - -- Get inputs from extraContext - tokenPoolHoldings <- lookupTokenPoolHoldings extraContext + -- Get inputs from context + tokenPoolHoldings <- CCIP.UtilsV1.Context.getFromContextU context tokenPoolHoldingsContextKey _ <- sumCheckedHoldingAmounts "LockOrBurn: existing tokenPoolHoldings" poolOwner @@ -1100,13 +1155,13 @@ template LockReleaseTokenPool caller instrumentId senderInputCids - transferFactory <- lookupTransferFactory extraContext - CCIP.TokenAdminRegistry.assertConfiguredTransferFactory - "LockOrBurn" - config - transferFactory - extraArgsContextValues <- lookupTransferFactoryExtraArgsContextValues extraContext - extraArgsMetaValues <- lookupTransferFactoryExtraArgsMetaValues extraContext + transferFactory <- lookupTransferFactory context + _ <- exercise tokenConfigCid CCIP.APIV1.TokenAdminRegistry.TokenConfig_AssertConfiguredTransferFactory with + suppliedFactory = transferFactory + context = context + caller = poolOwner + extraArgsContextValues <- lookupTransferFactoryExtraArgsContextValues context + extraArgsMetaValues <- lookupTransferFactoryExtraArgsMetaValues context -- Merge the pool's receive context with the extra args context values let mergedContext = Splice.Api.Token.MetadataV1.ChoiceContext with @@ -1149,10 +1204,10 @@ template LockReleaseTokenPool let amountAfterFeeBpsBytes = fromSomeNote "LockOrBurn: amountAfterFeeBps does not fit uint256" - (CCIP.Uint256.numeric0ToUint256Bytes amountAfterFeeBps) + (CCIP.CodecV1.Uint256.numeric0ToUint256Bytes amountAfterFeeBps) let extraData = fromOptional "" destPoolData newSendingMessageCid <- exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.AddTokenSend with + CCIP.APIV1.TokenAdminRegistry.TokenAdminRegistry_AddTokenSend with tokenConfigCid sendingMessageCid = sendingMessageCid poolInstanceId = instanceId @@ -1160,12 +1215,14 @@ template LockReleaseTokenPool amount = amountAfterFeeBpsBytes destTokenAddress = destTokenAddr extraData = extraData + context = context caller = poolOwner - pure CCIP.Interfaces.TokenPool.LockOrBurnResult with + pure CCIP.InterfacesV1.TokenPool.LockOrBurnResult with poolChangeCids = receiverCids ++ tokenPoolHoldings senderChangeCids = transferResult.senderChangeCids - sendingMessageCid = newSendingMessageCid + sendingMessageCid = coerceContractId newSendingMessageCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext interface instance MCMSReceiver for LockReleaseTokenPool where view = MCMSReceiverView with @@ -1221,10 +1278,10 @@ template LockReleaseTokenPool pool <- fetch selfCid assertMsg "E_RATE_LIMITER_NOT_ON_POOL" (rateLimiterInstanceAddress `elem` remoteChainRateLimiterAddresses pool.remoteChainConfigs) - let limiterAddr = RawInstanceAddress.toText rateLimiterInstanceAddress + let limiterAddr = Chainlink.InstanceAddress.toText rateLimiterInstanceAddress rateLimiterCid <- case Map.lookup limiterAddr contractIds of None -> abort ("E_RATE_LIMITER_NOT_IN_MAP: " <> limiterAddr) - Some c -> pure (coerceContractId c : ContractId CCIP.RateLimiter.RateLimiter) + Some c -> pure (coerceContractId c : ContractId CCIP.RateLimiterV1.RateLimiter) updatedLimiterCid <- exercise selfCid SetRateLimitConfig with caller rateLimiterCid @@ -1237,7 +1294,7 @@ template LockReleaseTokenPool None -> abort "E_INVALID_PARAMS: AddPoolReceiveContextNonContractValue" Some (AddPoolReceiveContextNonContractValueParams{..}, finalOffset) -> do assertMsg "E_TRAILING_BYTES: AddPoolReceiveContextNonContractValue" (finalOffset == byteCount operationData) - (value, innerOff) <- case decodeAnyValueAt valuePayload 0 of + (value, innerOff) <- case CCIP.UtilsV1.Context.decodeAnyValueAt valuePayload 0 of None -> abort "E_INVALID_PARAMS: AddPoolReceiveContextNonContractValue:valuePayload" Some p -> pure p assertMsg "E_TRAILING_BYTES: AddPoolReceiveContextNonContractValue:valuePayload" (innerOff == byteCount valuePayload) @@ -1248,7 +1305,7 @@ template LockReleaseTokenPool None -> abort "E_INVALID_PARAMS: AddPoolReceiveContextContractValue" Some (AddPoolReceiveContextContractValueParams{..}, finalOffset) -> do assertMsg "E_TRAILING_BYTES: AddPoolReceiveContextContractValue" (finalOffset == byteCount operationData) - let refAddr = RawInstanceAddress.toText referentInstanceAddress + let refAddr = Chainlink.InstanceAddress.toText referentInstanceAddress referred <- case Map.lookup refAddr contractIds of None -> abort ("E_REFERENT_CONTRACT_NOT_IN_MAP: " <> refAddr) Some c -> pure c diff --git a/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolCodecGen.daml b/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1CodecGen.daml similarity index 91% rename from contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolCodecGen.daml rename to contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1CodecGen.daml index 2a7bfafb7..512904a49 100644 --- a/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPoolCodecGen.daml +++ b/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1CodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.BurnMintTokenPoolCodecGen where +module CCIP.LockReleaseTokenPoolV1CodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.BurnMintTokenPoolTypes (ChainUpdate(..), RemoteChainConfig(..), TokenTransferFeeConfigArgs(..), TokenTransferFeeConfig(..), RateLimitConfigArgs(..), SetDynamicConfigParams(..), ApplyChainUpdatesParams(..), ApplyTokenTransferFeeConfigUpdatesParams(..), SetRateLimiterReferencesParams(..), SetRateLimitConfigParams(..), SetTransferTimeoutParams(..), AddPoolReceiveContextNonContractValueParams(..), AddPoolReceiveContextContractValueParams(..), RemovePoolReceiveContextValueParams(..), TransferTimeout(..)) +import CCIP.LockReleaseTokenPoolV1Types (ChainUpdate(..), RemoteChainConfig(..), TokenTransferFeeConfigArgs(..), TokenTransferFeeConfig(..), RateLimitConfigArgs(..), SetDynamicConfigParams(..), ApplyChainUpdatesParams(..), ApplyTokenTransferFeeConfigUpdatesParams(..), SetRateLimiterReferencesParams(..), SetRateLimitConfigParams(..), SetTransferTimeoutParams(..), AddPoolReceiveContextNonContractValueParams(..), AddPoolReceiveContextContractValueParams(..), RemovePoolReceiveContextValueParams(..), TransferTimeout(..)) import MCMS.Codec ( decodeBoolAt, @@ -29,7 +29,7 @@ import MCMS.Codec ( extractBytes ) -import CCIP.Codec (decodeRawInstanceAddressAt, decodeRawInstanceAddressList, decodeRequestedFinalityAt, encodeRawInstanceAddress, encodeRawInstanceAddressList, encodeRequestedFinality) +import CCIP.CodecV1 (decodeRawInstanceAddressAt, decodeRequestedFinalityAt, encodeRawInstanceAddress, encodeRequestedFinality) -- =============================================== @@ -41,8 +41,8 @@ encodeChainUpdate params = encodeNumeric0 params.remoteChainSelector <> encodeBytesHexList params.remotePools <> encodeBytesHex params.remoteTokenAddress - <> encodeRawInstanceAddressList params.inboundCCVs - <> encodeRawInstanceAddressList params.outboundCCVs + <> encodeList params.inboundCCVs encodeRawInstanceAddress + <> encodeList params.outboundCCVs encodeRawInstanceAddress <> encodeRequestedFinality params.finalityConfig <> encodeRawInstanceAddress params.inboundRateLimiter <> encodeRawInstanceAddress params.inboundCustomBlockConfirmationsRateLimiter @@ -53,8 +53,8 @@ decodeChainUpdateAt encoded offset = do (remoteChainSelector, offset) <- decodeNumeric0At encoded offset (remotePools, offset) <- decodeBytesHexList encoded offset (remoteTokenAddress, offset) <- decodeBytesHexAt encoded offset - (inboundCCVs, offset) <- decodeRawInstanceAddressList encoded offset - (outboundCCVs, offset) <- decodeRawInstanceAddressList encoded offset + (inboundCCVs, offset) <- decodeList encoded offset decodeRawInstanceAddressAt + (outboundCCVs, offset) <- decodeList encoded offset decodeRawInstanceAddressAt (finalityConfig, offset) <- decodeRequestedFinalityAt encoded offset (inboundRateLimiter, offset) <- decodeRawInstanceAddressAt encoded offset (inboundCustomBlockConfirmationsRateLimiter, offset) <- decodeRawInstanceAddressAt encoded offset @@ -70,8 +70,8 @@ encodeRemoteChainConfig : RemoteChainConfig -> BytesHex encodeRemoteChainConfig params = encodeBytesHexList params.remotePools <> encodeBytesHex params.remoteTokenAddress - <> encodeRawInstanceAddressList params.inboundCCVs - <> encodeRawInstanceAddressList params.outboundCCVs + <> encodeList params.inboundCCVs encodeRawInstanceAddress + <> encodeList params.outboundCCVs encodeRawInstanceAddress <> encodeRequestedFinality params.finalityConfig <> encodeRawInstanceAddress params.inboundRateLimiter <> encodeRawInstanceAddress params.inboundCustomBlockConfirmationsRateLimiter @@ -81,8 +81,8 @@ decodeRemoteChainConfigAt : BytesHex -> Int -> Optional (RemoteChainConfig, Int) decodeRemoteChainConfigAt encoded offset = do (remotePools, offset) <- decodeBytesHexList encoded offset (remoteTokenAddress, offset) <- decodeBytesHexAt encoded offset - (inboundCCVs, offset) <- decodeRawInstanceAddressList encoded offset - (outboundCCVs, offset) <- decodeRawInstanceAddressList encoded offset + (inboundCCVs, offset) <- decodeList encoded offset decodeRawInstanceAddressAt + (outboundCCVs, offset) <- decodeList encoded offset decodeRawInstanceAddressAt (finalityConfig, offset) <- decodeRequestedFinalityAt encoded offset (inboundRateLimiter, offset) <- decodeRawInstanceAddressAt encoded offset (inboundCustomBlockConfirmationsRateLimiter, offset) <- decodeRawInstanceAddressAt encoded offset diff --git a/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolTypes.daml b/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1Types.daml similarity index 68% rename from contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolTypes.daml rename to contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1Types.daml index c2a99d707..5d9383506 100644 --- a/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolTypes.daml +++ b/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPoolV1Types.daml @@ -1,34 +1,35 @@ -- | Types for LockReleaseTokenPool, extracted to avoid circular dependencies -module CCIP.LockReleaseTokenPoolTypes where +module CCIP.LockReleaseTokenPoolV1Types where import DA.Crypto.Text (BytesHex) -import qualified CCIP.FinalityConfig -import Chainlink.InstanceAddress (RawInstanceAddress) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CodecV1.FinalityConfig data ChainUpdate = ChainUpdate with remoteChainSelector : Numeric 0 -- Chain selector for this config update remotePools : [BytesHex] -- Allowed remote pool addresses for this chain remoteTokenAddress : BytesHex -- The token address on the remote chain - inboundCCVs : [RawInstanceAddress] -- Required CCVs for incoming transfers - outboundCCVs : [RawInstanceAddress] -- Required CCVs for outgoing transfers - finalityConfig : CCIP.FinalityConfig.FinalityConfig -- Allowed finality policy, "WaitForFinality" means finalized-only - inboundRateLimiter : RawInstanceAddress -- Required rate limiter for incoming transfers - inboundCustomBlockConfirmationsRateLimiter : RawInstanceAddress -- Required rate limiter for FTF incoming transfers - outboundRateLimiter : RawInstanceAddress -- Required rate limiter for outgoing transfers + inboundCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs for incoming transfers + outboundCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs for outgoing transfers + finalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig -- Allowed finality policy, "WaitForFinality" means finalized-only + inboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for incoming transfers + inboundCustomBlockConfirmationsRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for FTF incoming transfers + outboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for outgoing transfers deriving (Eq, Show) data RemoteChainConfig = RemoteChainConfig with remotePools : [BytesHex] -- Allowed remote pool addresses for this chain remoteTokenAddress : BytesHex -- The token address on the remote chain - inboundCCVs : [RawInstanceAddress] -- Required CCVs for incoming transfers - outboundCCVs : [RawInstanceAddress] -- Required CCVs for outgoing transfers - finalityConfig : CCIP.FinalityConfig.FinalityConfig -- Allowed finality policy, "WaitForFinality" means finalized-only - inboundRateLimiter : RawInstanceAddress -- Required rate limiter for incoming transfers - inboundCustomBlockConfirmationsRateLimiter : RawInstanceAddress -- Required rate limiter for FTF incoming transfers - outboundRateLimiter : RawInstanceAddress -- Required rate limiter for outgoing transfers + inboundCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs for incoming transfers + outboundCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Required CCVs for outgoing transfers + finalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig -- Allowed finality policy, "WaitForFinality" means finalized-only + inboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for incoming transfers + inboundCustomBlockConfirmationsRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for FTF incoming transfers + outboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress -- Required rate limiter for outgoing transfers deriving (Eq, Show) data TokenTransferFeeConfigArgs = TokenTransferFeeConfigArgs @@ -53,9 +54,9 @@ data TokenTransferFeeConfig = TokenTransferFeeConfig data RateLimitConfigArgs = RateLimitConfigArgs with remoteChainSelector : Numeric 0 - inboundRateLimiter : RawInstanceAddress - inboundCustomBlockConfirmationsRateLimiter : RawInstanceAddress - outboundRateLimiter : RawInstanceAddress + inboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress + inboundCustomBlockConfirmationsRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress + outboundRateLimiter : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) -- | Transfer timeout configuration for pending TransferInstructions. @@ -99,12 +100,12 @@ data SetRateLimiterReferencesParams = SetRateLimiterReferencesParams deriving (Eq, Show) -- | Params for SetRateLimitConfig (tune capacity/rate/isEnabled; MCMS entrypoint). --- | rateLimiterInstanceAddress: full RawInstanceAddress (instanceId@owner), not bare instanceId. +-- | rateLimiterInstanceAddress: full Chainlink.InstanceAddress.RawInstanceAddress (instanceId@owner), not bare instanceId. -- | Resolved against MCMS contractIds map key; pool choice receives the resulting ContractId. data SetRateLimitConfigParams = SetRateLimitConfigParams with caller : Party - rateLimiterInstanceAddress : RawInstanceAddress + rateLimiterInstanceAddress : Chainlink.InstanceAddress.RawInstanceAddress newIsEnabled : Bool newCapacity : Numeric 0 newRate : Numeric 0 @@ -128,7 +129,7 @@ data AddPoolReceiveContextNonContractValueParams = AddPoolReceiveContextNonContr data AddPoolReceiveContextContractValueParams = AddPoolReceiveContextContractValueParams with contextKey : Text - referentInstanceAddress : RawInstanceAddress + referentInstanceAddress : Chainlink.InstanceAddress.RawInstanceAddress deriving (Eq, Show) -- | MCMS params: remove one ChoiceContext entry by key. diff --git a/contracts/ccip/rate-limiter/daml.yaml b/contracts/ccip/rate-limiter/daml.yaml new file mode 100644 index 000000000..2e86024a7 --- /dev/null +++ b/contracts/ccip/rate-limiter/daml.yaml @@ -0,0 +1,13 @@ +sdk-version: 3.4.11 +name: ccip-rate-limiter +source: daml +version: 2.0.0 +build-options: + - "-Wno-crypto-text-is-alpha" + - "-Werror=unused-dependency" +data-dependencies: + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/core/daml/CCIP/RateLimiter.daml b/contracts/ccip/rate-limiter/daml/CCIP/RateLimiterV1.daml similarity index 95% rename from contracts/ccip/core/daml/CCIP/RateLimiter.daml rename to contracts/ccip/rate-limiter/daml/CCIP/RateLimiterV1.daml index d6105b8d8..dd9eff261 100644 --- a/contracts/ccip/core/daml/CCIP/RateLimiter.daml +++ b/contracts/ccip/rate-limiter/daml/CCIP/RateLimiterV1.daml @@ -1,13 +1,9 @@ -module CCIP.RateLimiter where +module CCIP.RateLimiterV1 where import DA.Map qualified as Map import DA.Time (convertRelTimeToMicroseconds, subTime) import DA.Crypto.Text (BytesHex, byteCount) -import Splice.Api.Token.MetadataV1 (ChoiceContext) - -import qualified CCIP.Context - import Chainlink.InstanceAddress qualified as RawInstanceAddress import Chainlink.InstanceAddress (assertValidInstanceId) import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) @@ -36,11 +32,8 @@ assertDistinctRateLimiters label inbound outbound maybeCustom = do assertMsg (label <> ": custom finality inbound rate limiter must be distinct from the outbound limiter") (custom /= outbound) -rateLimiterKey : Text -rateLimiterKey = "rate-limiter" - -lookupRateLimiterCid : ChoiceContext -> Update (ContractId RateLimiter) -lookupRateLimiterCid ctx = CCIP.Context.getFromContextU ctx rateLimiterKey +rateLimiterContextKey : Text +rateLimiterContextKey = "rate-limiter" rawInstanceAddress : RateLimiter -> RawInstanceAddress.RawInstanceAddress rawInstanceAddress rl = RawInstanceAddress.make rl.instanceId rl.poolOwner diff --git a/contracts/ccip/receiver/daml.yaml b/contracts/ccip/receiver/daml.yaml index ebfb988d7..c1e98f9bf 100644 --- a/contracts/ccip/receiver/daml.yaml +++ b/contracts/ccip/receiver/daml.yaml @@ -10,11 +10,13 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar + - ../client-api/.daml/dist/ccip-client-api-2.0.0.dar + - ../utils/.daml/dist/ccip-utils-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar - - ../core/.daml/dist/ccip-core-2.0.0.dar - - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar - - ../runtime/.daml/dist/ccip-runtime-2.0.0.dar diff --git a/contracts/ccip/receiver/daml/CCIP/CCIPReceiver.daml b/contracts/ccip/receiver/daml/CCIP/CCIPReceiver.daml index 4cd53ccfa..f27c0a1c9 100644 --- a/contracts/ccip/receiver/daml/CCIP/CCIPReceiver.daml +++ b/contracts/ccip/receiver/daml/CCIP/CCIPReceiver.daml @@ -12,33 +12,35 @@ import DA.Action (foldlA) import DA.List (unique) import DA.Optional (fromSomeNote) -import Splice.Api.Token.MetadataV1 (ChoiceContext) +import qualified Splice.Api.Token.MetadataV1 -import qualified CCIP.Context -import qualified CCIP.FinalityConfig -import qualified CCIP.Interfaces.CrossChainVerifier -import qualified CCIP.Interfaces.TokenPool -import qualified CCIP.MessageCodecV1 -import qualified CCIP.PerPartyRouter -import Chainlink.InstanceAddress (RawInstanceAddress, assertValidInstanceId) -import qualified CCIP.TokenAdminRegistry +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.ClientV1 +import qualified CCIP.InterfacesV1.CrossChainVerifier +import qualified CCIP.InterfacesV1.TokenPool +import qualified CCIP.UtilsV1.Context -- | Per-CCV verification input. Pairs a verifier contract (via interface) -- with the attestation data and per-CCV extra context. data CCVInput = CCVInput with - ccvCid : ContractId CCIP.Interfaces.CrossChainVerifier.ICrossChainVerifier + ccvCid : ContractId CCIP.InterfacesV1.CrossChainVerifier.ICrossChainVerifier verifierResults : BytesHex - ccvExtraContext : ChoiceContext + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) -- | Token transfer input, provided only when the message includes a -- token transfer. Mirrors how TokenReceiveTicket is Optional on the OffRamp. data TokenTransferInput = TokenTransferInput with - tokenPoolCid : ContractId CCIP.Interfaces.TokenPool.ITokenPool + tokenPoolCid : ContractId CCIP.InterfacesV1.TokenPool.ITokenPool tokenReceiverParty : Party - poolExtraContext : ChoiceContext + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) template CCIPReceiver @@ -48,31 +50,31 @@ template CCIPReceiver -- Receiver's required CCV instance addresses, analogous to -- IAny2EVMMessageReceiverV2.getCCVs() in the EVM implementation. -- Passed to PerPartyRouter.Execute as receiverRequiredCCVs. - requiredCCVs : [RawInstanceAddress] - optionalCCVs : [RawInstanceAddress] + requiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + optionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] optionalThreshold : Int -- Allowed finality policy for inbound execution. - receiverFinalityConfig : CCIP.FinalityConfig.FinalityConfig + receiverFinalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig where signatory owner -- Ensure that requiredCCVs are unique - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && unique requiredCCVs - && CCIP.FinalityConfig.isValidFinalityConfig receiverFinalityConfig + && CCIP.CodecV1.FinalityConfig.isValidFinalityConfig receiverFinalityConfig -- | Query the final required CCVs for executing an inbound message. -- Aggregates receiver policy with token-pool requirements and delegates -- protocol-level resolution to PerPartyRouter/OffRamp. - nonconsuming choice GetRequiredCCVs : [RawInstanceAddress] + nonconsuming choice GetRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] with - context : ChoiceContext - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter + routerCid : ContractId CCIP.ClientV1.PerPartyRouter encodedMessage : BytesHex - tokenPoolCid : Optional (ContractId CCIP.Interfaces.TokenPool.ITokenPool) + tokenPoolCid : Optional (ContractId CCIP.InterfacesV1.TokenPool.ITokenPool) + context : Splice.Api.Token.MetadataV1.ChoiceContext controller owner do let message = fromSomeNote "receiver: failed to decode message" - (CCIP.MessageCodecV1.decodeMessageV1 encodedMessage) + (CCIP.CodecV1.MessageCodecV1.decodeMessageV1 encodedMessage) tokenPoolRequiredCCVs <- case (message.tokenTransfer, tokenPoolCid) of (None, None) -> pure [] @@ -84,15 +86,16 @@ template CCIPReceiver let tokenExtraData : BytesHex = tt.extraData in exercise poolCid - CCIP.Interfaces.TokenPool.TokenPool_GetRequiredCCVs with + CCIP.InterfacesV1.TokenPool.TokenPool_GetRequiredCCVs with remoteChainSelector = message.sourceChainSelector sourceAmount = tt.amount - finality = message.finality.requested + finality = message.finality.raw extraData = tokenExtraData - direction = CCIP.Interfaces.TokenPool.Inbound + direction = CCIP.InterfacesV1.TokenPool.Inbound + context = context caller = owner - exercise routerCid CCIP.PerPartyRouter.GetRequiredCCVsForExecute with + exercise routerCid CCIP.ClientV1.PerPartyRouter_GetRequiredCCVsForExecute with context = context message = message receiverRequiredCCVs = requiredCCVs @@ -103,7 +106,7 @@ template CCIPReceiver -- | Update CCV requirements. choice UpdateRequiredCCVs : ContractId CCIPReceiver with - newRequiredCCVs : [RawInstanceAddress] + newRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] controller owner do assertMsg "DuplicateCCVNotAllowed: duplicate CCVs in new required CCVs" (unique newRequiredCCVs) @@ -113,11 +116,8 @@ template CCIPReceiver -- TODO: consider allowing arbitrary callers nonconsuming choice Execute : ContractId CCIPMessageReceived with - -- CCIP context for internal orchestration (PerPartyRouter calls). - context : ChoiceContext - -- CCIP contract IDs - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter + routerCid : ContractId CCIP.ClientV1.PerPartyRouter -- The encoded CCIP message (hex-encoded bytes) encodedMessage : BytesHex @@ -128,14 +128,17 @@ template CCIPReceiver -- One entry per CCV that should verify this message. -- Accepts any ICrossChainVerifier implementation. ccvInputs : [CCVInput] + + -- CCIP context for internal orchestration (PerPartyRouter calls). + context : Splice.Api.Token.MetadataV1.ChoiceContext controller owner do -- Extract CIDs from context using typed accessors for pool/CCV calls. - rmnRemoteCid <- CCIP.Context.lookupRmnRemoteCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.RMNRemote.rmnRemoteContextKey + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey -- PrepareExecute: decode, validate, create ExecutingMessageV1 - emCid <- exercise routerCid CCIP.PerPartyRouter.PrepareExecute with + emCid <- exercise routerCid CCIP.ClientV1.PerPartyRouter_PrepareExecute with context = context encodedMessage = encodedMessage receiverParty = owner @@ -150,40 +153,40 @@ template CCIPReceiver emCid <- case tokenTransfer of None -> pure emCid Some tt -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context + tokenConfigCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenConfigContextKey exercise tt.tokenPoolCid - CCIP.Interfaces.TokenPool.TokenPool_VerifyInboundMessage with + CCIP.InterfacesV1.TokenPool.TokenPool_VerifyInboundMessage with tokenAdminRegistryCid = tokenAdminRegistryCid tokenConfigCid = tokenConfigCid - extraContext = tt.poolExtraContext + context = tt.context executingMessageCid = emCid caller = owner -- CCV verification: thread executingMessageCid through each CCV emCid <- foldlA (\cid input -> exercise input.ccvCid - CCIP.Interfaces.CrossChainVerifier.CrossChainVerifier_VerifyMessage with + CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifier_VerifyMessage with rmnRemoteCid = rmnRemoteCid - extraContext = input.ccvExtraContext + context = input.context executingMessageCid = cid verifierResults = input.verifierResults caller = owner ) emCid ccvInputs -- Execute with the final executingMessageCid - result <- exercise routerCid CCIP.PerPartyRouter.Execute with + result <- exercise routerCid CCIP.ClientV1.PerPartyRouter_Execute with context = context executingMessageCid = emCid -- Token release tokenReleaseResult <- case (tokenTransfer, result.tokenReceiveTicket) of (Some tt, Some ticketCid) -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context - releaseResult <- exercise tt.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_ReleaseFromTicket with + tokenConfigCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenConfigContextKey + releaseResult <- exercise tt.tokenPoolCid CCIP.InterfacesV1.TokenPool.TokenPool_ReleaseFromTicket with tokenAdminRegistryCid = tokenAdminRegistryCid tokenConfigCid = tokenConfigCid rmnRemoteCid = rmnRemoteCid - extraContext = tt.poolExtraContext + context = tt.context tokenReceiveTicketCid = ticketCid caller = owner pure (Some releaseResult) @@ -204,9 +207,9 @@ template CCIPReceiver template CCIPMessageReceived with owner : Party - router : ContractId CCIP.PerPartyRouter.PerPartyRouter + router : ContractId CCIP.ClientV1.PerPartyRouter messageId : BytesHex - message : CCIP.MessageCodecV1.MessageV1 - tokenReleaseResult : Optional CCIP.Interfaces.TokenPool.ReleaseOrMintResult + message : CCIP.CodecV1.MessageCodecV1.MessageV1 + tokenReleaseResult : Optional CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult where signatory owner diff --git a/contracts/ccip/runtime/daml.yaml b/contracts/ccip/runtime/daml.yaml index 730f058b7..ddb664b05 100644 --- a/contracts/ccip/runtime/daml.yaml +++ b/contracts/ccip/runtime/daml.yaml @@ -10,10 +10,16 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar + - ../client-api/.daml/dist/ccip-client-api-2.0.0.dar + - ../events/.daml/dist/ccip-events-2.0.0.dar + - ../tickets/.daml/dist/ccip-tickets-2.0.0.dar + - ../core/.daml/dist/ccip-core-2.0.0.dar + - ../utils/.daml/dist/ccip-utils-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar - - ../core/.daml/dist/ccip-core-2.0.0.dar - - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar diff --git a/contracts/ccip/runtime/daml/CCIP/OffRampTypes.daml b/contracts/ccip/runtime/daml/CCIP/OffRampTypes.daml deleted file mode 100644 index 9cc686515..000000000 --- a/contracts/ccip/runtime/daml/CCIP/OffRampTypes.daml +++ /dev/null @@ -1,17 +0,0 @@ -module CCIP.OffRampTypes where - -import Chainlink.InstanceAddress (RawInstanceAddress) - -data OffRampDeps = OffRampDeps - with - globalConfig : RawInstanceAddress - rmnRemote : RawInstanceAddress - tokenAdminRegistry : RawInstanceAddress - deriving (Eq, Show) - -data SetDepsParams = SetDepsParams - with - globalConfig : Optional RawInstanceAddress - rmnRemote : Optional RawInstanceAddress - tokenAdminRegistry : Optional RawInstanceAddress - deriving (Eq, Show) diff --git a/contracts/ccip/runtime/daml/CCIP/OnRampTypes.daml b/contracts/ccip/runtime/daml/CCIP/OnRampTypes.daml deleted file mode 100644 index 170ed8c39..000000000 --- a/contracts/ccip/runtime/daml/CCIP/OnRampTypes.daml +++ /dev/null @@ -1,21 +0,0 @@ -module CCIP.OnRampTypes where - -import Chainlink.InstanceAddress (RawInstanceAddress) - -data OnRampDeps = OnRampDeps - with - globalConfig : RawInstanceAddress - rmnRemote : RawInstanceAddress - tokenAdminRegistry : RawInstanceAddress - feeQuoter : RawInstanceAddress - ccvRegistry : RawInstanceAddress - deriving (Eq, Show) - -data SetDepsParams = SetDepsParams - with - globalConfig : Optional RawInstanceAddress - rmnRemote : Optional RawInstanceAddress - tokenAdminRegistry : Optional RawInstanceAddress - feeQuoter : Optional RawInstanceAddress - ccvRegistry : Optional RawInstanceAddress - deriving (Eq, Show) diff --git a/contracts/ccip/runtime/daml/CCIP/PerPartyRouterTypes.daml b/contracts/ccip/runtime/daml/CCIP/PerPartyRouterTypes.daml deleted file mode 100644 index 1070eede3..000000000 --- a/contracts/ccip/runtime/daml/CCIP/PerPartyRouterTypes.daml +++ /dev/null @@ -1,33 +0,0 @@ -module CCIP.PerPartyRouterTypes where - -import Chainlink.InstanceAddress (RawInstanceAddress) - -data PerPartyRouterDeps = PerPartyRouterDeps - with - onRamp : RawInstanceAddress - offRamp : RawInstanceAddress - globalConfig : RawInstanceAddress - tokenAdminRegistry : RawInstanceAddress - feeQuoter : RawInstanceAddress - rmnRemote : RawInstanceAddress - deriving (Eq, Show) - -data SetDepsParams = SetDepsParams - with - onRamp : Optional RawInstanceAddress - offRamp : Optional RawInstanceAddress - globalConfig : Optional RawInstanceAddress - tokenAdminRegistry : Optional RawInstanceAddress - feeQuoter : Optional RawInstanceAddress - rmnRemote : Optional RawInstanceAddress - deriving (Eq, Show) - -data AddCustomObserversParams = AddCustomObserversParams - with - parties : [Party] - deriving (Eq, Show) - -data RemoveCustomObserversParams = RemoveCustomObserversParams - with - parties : [Party] - deriving (Eq, Show) diff --git a/contracts/ccip/runtime/daml/CCIP/OffRamp.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRamp.daml similarity index 70% rename from contracts/ccip/runtime/daml/CCIP/OffRamp.daml rename to contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRamp.daml index 732bd3947..17b314d59 100644 --- a/contracts/ccip/runtime/daml/CCIP/OffRamp.daml +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRamp.daml @@ -1,5 +1,8 @@ -- | OffRamp for CCIP message execution, called by PerPartyRouter. -module CCIP.OffRamp where +module CCIP.RuntimeV1.OffRamp ( + module CCIP.RuntimeV1.OffRamp, + module CCIP.RuntimeV1.OffRampTypes, +) where import DA.Foldable qualified as Foldable import DA.Crypto.Text (BytesHex, keccak256, byteCount) @@ -7,39 +10,37 @@ import DA.List (dedup, unique) import DA.Map qualified as Map import DA.Optional (fromOptional, fromSomeNote, isSome) -import Splice.Api.Token.MetadataV1 (ChoiceContext) - -import qualified CCIP.Events -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.FinalityConfig -import qualified CCIP.GlobalConfig -import qualified CCIP.Internal -import qualified CCIP.MessageCodecV1 -import qualified CCIP.Context -import Chainlink.InstanceAddress (assertValidInstanceId) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.RMNRemote -import qualified CCIP.Tickets -import qualified CCIP.TokenAdminRegistry +import qualified Splice.Api.Token.MetadataV1 + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import CCIP.OffRampTypes (OffRampDeps(..), SetDepsParams(..)) -import CCIP.OffRampCodecGen (decodeSetDepsParamsAt) -offRampKey : Text -offRampKey = "off-ramp" +import qualified Chainlink.InstanceAddress + +import qualified CCIP.EventsV1.Events +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.TicketsV1 -lookupOffRampCid : ChoiceContext -> Update (ContractId OffRamp) -lookupOffRampCid ctx = CCIP.Context.getFromContextU ctx offRampKey +import CCIP.RuntimeV1.OffRampTypes (OffRampDeps(..), SetDepsParams(..)) +import CCIP.RuntimeV1.OffRampCodecGen (decodeSetDepsParamsAt) -rawInstanceAddress : OffRamp -> RawInstanceAddress.RawInstanceAddress -rawInstanceAddress offRamp = RawInstanceAddress.make offRamp.instanceId offRamp.ccipOwner +offRampContextKey : Text +offRampContextKey = "off-ramp" + +rawInstanceAddress : OffRamp -> Chainlink.InstanceAddress.RawInstanceAddress +rawInstanceAddress offRamp = Chainlink.InstanceAddress.make offRamp.instanceId offRamp.ccipOwner assertValidMessageForLane : Text -> Party -> Numeric 0 - -> CCIP.GlobalConfig.SourceChainConfig - -> CCIP.MessageCodecV1.MessageV1 + -> CCIP.CoreV1.GlobalConfig.SourceChainConfig + -> CCIP.CodecV1.MessageCodecV1.MessageV1 -> Update () assertValidMessageForLane instanceId ccipOwner chainSelector sourceConfig message = do assertMsg "offramp: source chain disabled" sourceConfig.isEnabled @@ -47,7 +48,7 @@ assertValidMessageForLane instanceId ccipOwner chainSelector sourceConfig messag (message.onRampAddress `elem` sourceConfig.onRampAddresses) assertMsg "offramp: invalid destination chain selector" (message.destChainSelector == chainSelector) - let expectedOffRampAddress = CCIP.MessageCodecV1.encodeInstanceAddress instanceId ccipOwner + let expectedOffRampAddress = CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress instanceId ccipOwner assertMsg "offramp: invalid offRampAddress" (message.offRampAddress == expectedOffRampAddress) @@ -59,7 +60,7 @@ template OffRamp deps : OffRampDeps where signatory ccipOwner - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId choice SetDeps : ContractId OffRamp with @@ -75,22 +76,22 @@ template OffRamp -- | Get required CCV raw instance addresses for inbound message execution. -- Returns the same final required CCVs that execution would enforce after -- the inbound pool CCV merge step. - nonconsuming choice GetRequiredCCVsForExecuteFromRouter : [RawInstanceAddress.RawInstanceAddress] + nonconsuming choice GetRequiredCCVsForExecuteFromRouter : [Chainlink.InstanceAddress.RawInstanceAddress] with - globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig - message : CCIP.MessageCodecV1.MessageV1 - receiverRequiredCCVs : [RawInstanceAddress.RawInstanceAddress] - receiverOptionalCCVs : [RawInstanceAddress.RawInstanceAddress] + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + message : CCIP.CodecV1.MessageCodecV1.MessageV1 + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] receiverOptionalThreshold : Int - tokenPoolRequiredCCVs : [RawInstanceAddress.RawInstanceAddress] + tokenPoolRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] controller ccipOwner do globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "offramp: globalconfig instance address mismatch" + Chainlink.InstanceAddress.assertEqual "offramp: globalconfig instance address mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig sourceConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetSourceChainConfig with + CCIP.CoreV1.GlobalConfig.GetSourceChainConfig with sourceChainSelector = message.sourceChainSelector caller = ccipOwner sourceConfig <- case sourceConfigOpt of @@ -98,7 +99,7 @@ template OffRamp Some c -> pure c (baseRequiredCCVs, baseOptionalCCVs, baseOptionalCCVThreshold) <- - CCIP.Internal.computeExecuteCCVs + CCIP.CodecV1.CCVCodec.computeExecuteCCVs sourceConfig.defaultCCVs sourceConfig.laneMandatedCCVs message @@ -111,30 +112,30 @@ template OffRamp (null tokenPoolRequiredCCVs) pure baseRequiredCCVs Some _ -> do - CCIP.Internal.assertMaxCCVListLength "offramp: token pool required CCVs" tokenPoolRequiredCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "offramp: token pool required CCVs" tokenPoolRequiredCCVs let (mergedRequiredCCVs, _, _) = - CCIP.Internal.mergeInboundPoolCCVs + CCIP.CodecV1.CCVCodec.mergeInboundPoolCCVs sourceConfig.defaultCCVs baseRequiredCCVs baseOptionalCCVs baseOptionalCCVThreshold tokenPoolRequiredCCVs - CCIP.Internal.assertMaxCCVListLength "offramp: required CCVs" mergedRequiredCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "offramp: required CCVs" mergedRequiredCCVs pure mergedRequiredCCVs pure finalRequiredCCVs - -- | Decode and validate an inbound message, creating an ExecutingMessageV1. + -- | Decode and validate an inbound message, creating an ExecutingMessage. -- Performs party address validation and RMN curse check. - nonconsuming choice PrepareExecute : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + nonconsuming choice PrepareExecute : ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage with encodedMessage : BytesHex - globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - receiverRequiredCCVs : [RawInstanceAddress.RawInstanceAddress] - receiverOptionalCCVs : [RawInstanceAddress.RawInstanceAddress] + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + tokenAdminRegistryCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] receiverOptionalThreshold : Int - receiverFinalityConfig : CCIP.FinalityConfig.FinalityConfig - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote + receiverFinalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig + rmnRemoteCid : ContractId CCIP.CoreV1.RMNRemote.RMNRemote receiverParty : Party tokenReceiverParty : Optional Party caller : Party @@ -142,11 +143,11 @@ template OffRamp do -- Decode message let message = fromSomeNote "prepareExecute: failed to decode message" - (CCIP.MessageCodecV1.decodeMessageV1 encodedMessage) + (CCIP.CodecV1.MessageCodecV1.decodeMessageV1 encodedMessage) let messageId = keccak256 encodedMessage -- Validate receiver address matches provided party - let expectedReceiverAddr = CCIP.MessageCodecV1.encodePartyAddress receiverParty + let expectedReceiverAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiverParty assertMsg "prepareExecute: receiver address mismatch" (message.receiver == expectedReceiverAddr) @@ -159,30 +160,31 @@ template OffRamp -- Validate tokenReceiver address if token transfer present case (message.tokenTransfer, resolvedTokenReceiver) of (Some tt, Some trParty) -> - let expectedAddr = CCIP.MessageCodecV1.encodePartyAddress trParty + let expectedAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress trParty in assertMsg "prepareExecute: tokenReceiver address mismatch" (tt.tokenReceiver == expectedAddr) _ -> pure () -- Validate RMN instance address and check curse rmnRemote <- fetch rmnRemoteCid - RawInstanceAddress.assertEqual "prepareExecute: rmn mismatch" + Chainlink.InstanceAddress.assertEqual "prepareExecute: rmn mismatch" rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with - caller = ccipOwner + isCursed <- exercise rmnRemoteCid CCIP.CoreV1.RMNRemote.IsCursedForChain with chainSelector = message.sourceChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner assertMsg "prepareExecute: source chain is cursed" (not isCursed) globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "prepareExecute: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "prepareExecute: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig tokenAdminRegistry <- fetch tokenAdminRegistryCid - RawInstanceAddress.assertEqual "prepareExecute: tokenadminregistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + Chainlink.InstanceAddress.assertEqual "prepareExecute: tokenadminregistry mismatch" + tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner deps.tokenAdminRegistry sourceConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetSourceChainConfig with + CCIP.CoreV1.GlobalConfig.GetSourceChainConfig with sourceChainSelector = message.sourceChainSelector caller = ccipOwner sourceConfig <- case sourceConfigOpt of @@ -198,10 +200,10 @@ template OffRamp then pure () else assertMsg "prepareExecute: message finality not allowed by receiver finality config" - (CCIP.FinalityConfig.requestedFinalityAllowed message.finality.requested receiverFinalityConfig) + (CCIP.CodecV1.FinalityConfig.requestedFinalityAllowed message.finality.requested receiverFinalityConfig) (baseRequiredCCVs, baseOptionalCCVs, baseOptionalCCVThreshold) <- - CCIP.Internal.computeExecuteCCVs + CCIP.CodecV1.CCVCodec.computeExecuteCCVs sourceConfig.defaultCCVs sourceConfig.laneMandatedCCVs message @@ -210,14 +212,14 @@ template OffRamp receiverOptionalThreshold -- Build observer list - let observers = CCIP.ExecutingMessageV1.buildObservingParties + let observers = CCIP.CoreV1.ExecutingMessage.buildObservingParties receiverParty resolvedTokenReceiver caller let initialState = if isSome message.tokenTransfer - then CCIP.ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs - else CCIP.ExecutingMessageV1.ExecutingMessageState_Prepared + then CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs + else CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_Prepared - create CCIP.ExecutingMessageV1.ExecutingMessageV1 with + create CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = messageId @@ -233,7 +235,7 @@ template OffRamp receiverFinalityConfig = receiverFinalityConfig sourceDefaultCCVs = sourceConfig.defaultCCVs inboundPoolVerification = None - deps = CCIP.ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = rawInstanceAddress this globalConfig = deps.globalConfig rmnRemote = deps.rmnRemote @@ -242,29 +244,29 @@ template OffRamp -- | Process a CCIP execute request from a PerPartyRouter. -- Reads CCV verifications, pool verification state, and prepared CCV policy - -- from the ExecutingMessageV1 collecting contract. + -- from the ExecutingMessage collecting contract. nonconsuming choice ExecuteFromRouter : ExecuteFromRouterResult with routerPartyOwner : Party - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + executingMessageCid : ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage - globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : Optional (ContractId CCIP.TokenAdminRegistry.TokenConfig) - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + tokenAdminRegistryCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry + tokenConfigCid : Optional (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) + rmnRemoteCid : ContractId CCIP.CoreV1.RMNRemote.RMNRemote controller ccipOwner do - -- Fetch ExecutingMessageV1 (ccipOwner is signatory, always visible) + -- Fetch ExecutingMessage (ccipOwner is signatory, always visible) execMsg <- fetch executingMessageCid let message = execMsg.message let messageId = execMsg.messageId - -- Verify the ExecutingMessageV1 was created by this OffRamp's ccipOwner + -- Verify the ExecutingMessage was created by this OffRamp's ccipOwner assertMsg "offramp: executingMessage ccipOwner mismatch" (execMsg.ccipOwner == ccipOwner) - RawInstanceAddress.assertEqual "offramp: executingMessage offRamp mismatch" + Chainlink.InstanceAddress.assertEqual "offramp: executingMessage offRamp mismatch" instanceId ccipOwner execMsg.deps.offRamp assertMsg "offramp: executingMessage globalConfig mismatch" (execMsg.deps.globalConfig == deps.globalConfig) @@ -279,24 +281,25 @@ template OffRamp -- Re-check RMN curse (PrepareExecute may not have been atomic with Execute) rmnRemote <- fetch rmnRemoteCid - RawInstanceAddress.assertEqual "offramp: rmn mismatch" + Chainlink.InstanceAddress.assertEqual "offramp: rmn mismatch" rmnRemote.instanceId rmnRemote.rmnOwner execMsg.deps.rmnRemote - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with - caller = ccipOwner + isCursed <- exercise rmnRemoteCid CCIP.CoreV1.RMNRemote.IsCursedForChain with chainSelector = message.sourceChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner assertMsg "offramp: source chain is cursed" (not isCursed) -- Validate dependency instance addresses globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "offramp: globalconfig instance address mismatch" + Chainlink.InstanceAddress.assertEqual "offramp: globalconfig instance address mismatch" globalConfig.instanceId globalConfig.ccipOwner execMsg.deps.globalConfig tokenAdminRegistry <- fetch tokenAdminRegistryCid - RawInstanceAddress.assertEqual "offramp: tokenadminregistry instance address mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner execMsg.deps.tokenAdminRegistry + Chainlink.InstanceAddress.assertEqual "offramp: tokenadminregistry instance address mismatch" + tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner execMsg.deps.tokenAdminRegistry sourceConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetSourceChainConfig with + CCIP.CoreV1.GlobalConfig.GetSourceChainConfig with sourceChainSelector = message.sourceChainSelector caller = ccipOwner sourceConfig <- case sourceConfigOpt of @@ -313,17 +316,17 @@ template OffRamp assertMsg "offramp: pool CCVs cannot contain duplicates" (unique verification.poolCCVs) let requiredCCVAddresses = - map RawInstanceAddress.toInstanceAddress execMsg.requiredCCVs + map Chainlink.InstanceAddress.toInstanceAddress execMsg.requiredCCVs let optionalCCVAddresses = - map RawInstanceAddress.toInstanceAddress execMsg.optionalCCVs + map Chainlink.InstanceAddress.toInstanceAddress execMsg.optionalCCVs -- every message must be verified by at least on CCV -- this should never happen as GlobalConfig requires at least one default or lane mandated CCV to be set assertMsg "offramp: at least one CCV required for message execution" (not (null requiredCCVAddresses)) - -- Compute provided CCV addresses from ExecutingMessageV1's ccvVerifications + -- Compute provided CCV addresses from ExecutingMessage's ccvVerifications let providedCCVAddresses = - map (\v -> CCIP.MessageCodecV1.encodeInstanceAddress v.ccvInstanceId v.ccvOwner) + map (\v -> CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress v.ccvInstanceId v.ccvOwner) execMsg.ccvVerifications -- Validate all required CCVs are covered @@ -343,7 +346,7 @@ template OffRamp finalizeResult <- case execMsg.tokenReceiver of None -> exercise executingMessageCid - CCIP.ExecutingMessageV1.FinalizeExecute with + CCIP.CoreV1.ExecutingMessage.FinalizeExecute with tokenAdminRegistryInstanceId = tokenAdminRegistry.instanceId maybePoolAddress = None maybeTicketReceiver = None @@ -356,7 +359,7 @@ template OffRamp configCid <- case tokenConfigCid of None -> abort "offramp: missing token config CID" Some cid -> pure cid - exercise tokenAdminRegistryCid CCIP.TokenAdminRegistry.FinalizeExecute with + exercise tokenAdminRegistryCid CCIP.CoreV1.TokenAdminRegistry.FinalizeExecute with tokenConfigCid = configCid executingMessageCid = executingMessageCid ticketReceiver = routerPartyOwner @@ -396,9 +399,9 @@ template OffRamp data ExecuteFromRouterResult = ExecuteFromRouterResult with messageId : BytesHex - message : CCIP.MessageCodecV1.MessageV1 + message : CCIP.CodecV1.MessageCodecV1.MessageV1 sourceChainSelector : Numeric 0 sequenceNumber : Numeric 0 - tokenReceiveTicket : Optional (ContractId CCIP.Tickets.TokenReceiveTicket) - executionStateChanged : ContractId CCIP.Events.ExecutionStateChanged + tokenReceiveTicket : Optional (ContractId CCIP.TicketsV1.TokenReceiveTicket) + executionStateChanged : ContractId CCIP.EventsV1.Events.ExecutionStateChanged deriving (Eq, Show) diff --git a/contracts/ccip/runtime/daml/CCIP/OffRampCodecGen.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRampCodecGen.daml similarity index 90% rename from contracts/ccip/runtime/daml/CCIP/OffRampCodecGen.daml rename to contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRampCodecGen.daml index a53c72b32..47a59fe5e 100644 --- a/contracts/ccip/runtime/daml/CCIP/OffRampCodecGen.daml +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRampCodecGen.daml @@ -1,17 +1,17 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.OffRampCodecGen where +module CCIP.RuntimeV1.OffRampCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.OffRampTypes (OffRampDeps(..), SetDepsParams(..)) +import CCIP.RuntimeV1.OffRampTypes (OffRampDeps(..), SetDepsParams(..)) import MCMS.Codec ( decodeOptional, encodeOptional ) -import CCIP.Codec (decodeRawInstanceAddressAt, encodeRawInstanceAddress) +import CCIP.CodecV1 (decodeRawInstanceAddressAt, encodeRawInstanceAddress) -- =============================================== diff --git a/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRampTypes.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRampTypes.daml new file mode 100644 index 000000000..b721f3fff --- /dev/null +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OffRampTypes.daml @@ -0,0 +1,17 @@ +module CCIP.RuntimeV1.OffRampTypes where + +import qualified Chainlink.InstanceAddress + +data OffRampDeps = OffRampDeps + with + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + deriving (Eq, Show) + +data SetDepsParams = SetDepsParams + with + globalConfig : Optional Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Optional Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Optional Chainlink.InstanceAddress.RawInstanceAddress + deriving (Eq, Show) diff --git a/contracts/ccip/runtime/daml/CCIP/OnRamp.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRamp.daml similarity index 76% rename from contracts/ccip/runtime/daml/CCIP/OnRamp.daml rename to contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRamp.daml index 5a4f71d9c..501ba23a0 100644 --- a/contracts/ccip/runtime/daml/CCIP/OnRamp.daml +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRamp.daml @@ -1,37 +1,42 @@ -- | OnRamp for CCIP message sending, called by PerPartyRouter. -module CCIP.OnRamp where +module CCIP.RuntimeV1.OnRamp ( + module CCIP.RuntimeV1.OnRamp, + module CCIP.RuntimeV1.OnRampTypes, +) where import DA.Crypto.Text (BytesHex, byteCount) import DA.Foldable qualified as Foldable import DA.List (dedup, unique) import DA.Map qualified as Map import DA.Optional (fromOptional, fromSomeNote, isNone, isSome) -import DA.Text qualified as Text - -import Splice.Api.Token.MetadataV1 (ChoiceContext) - -import qualified CCIP.Client -import qualified CCIP.Events -import qualified CCIP.FeeQuoter -import qualified CCIP.GlobalConfig -import CCIP.Interfaces.CrossChainVerifier qualified as ICCV -import qualified CCIP.Interfaces.Executor -import qualified CCIP.Interfaces.TokenPool -import qualified CCIP.Math -import qualified CCIP.MessageCodecV1 -import qualified CCIP.Context -import qualified CCIP.Internal + +import qualified Splice.Api.Token.MetadataV1 + +import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) +import MCMS.Crypto (assertValidHex) + import qualified Splice.Api.Token.HoldingV1 + import Chainlink.InstanceAddress qualified as RawInstanceAddress import Chainlink.InstanceAddress (assertValidInstanceId) -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 -import qualified CCIP.Tickets -import qualified CCIP.TokenAdminRegistry -import CCIP.OnRampTypes (OnRampDeps(..), SetDepsParams(..)) -import CCIP.OnRampCodecGen (decodeSetDepsParamsAt) -import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import MCMS.Crypto (assertValidHex) + +import qualified CCIP.EventsV1.Events +import qualified CCIP.EventsV1.Receipts +import qualified CCIP.ClientV1 +import qualified CCIP.CodecV1.Math +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.SendingMessage +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.InterfacesV1.CrossChainVerifier +import qualified CCIP.InterfacesV1.Executor +import qualified CCIP.InterfacesV1.TokenPool + +import CCIP.RuntimeV1.OnRampTypes (OnRampDeps(..), SetDepsParams(..)) +import CCIP.RuntimeV1.OnRampCodecGen (decodeSetDepsParamsAt) messageStaticSize : Int messageStaticSize = 69 @@ -66,19 +71,16 @@ noExecutionAddressBytes : BytesHex noExecutionAddressBytes = "eba517d200000000000000000000000000000000000000000000000000000000" -onRampKey : Text -onRampKey = "on-ramp" - -lookupOnRampCid : ChoiceContext -> Update (ContractId OnRamp) -lookupOnRampCid ctx = CCIP.Context.getFromContextU ctx onRampKey +onRampContextKey : Text +onRampContextKey = "on-ramp" rawInstanceAddress : OnRamp -> RawInstanceAddress.RawInstanceAddress rawInstanceAddress onRamp = RawInstanceAddress.make onRamp.instanceId onRamp.ccipOwner computeRequiredCCVsForSend - : CCIP.GlobalConfig.DestChainConfig - -> CCIP.Client.Canton2AnyMessage - -> CCIP.Client.GenericExtraArgsV3 + : CCIP.CoreV1.GlobalConfig.DestChainConfig + -> CCIP.ClientV1.Canton2AnyMessage + -> CCIP.ClientV1.GenericExtraArgsV3 -> [RawInstanceAddress.RawInstanceAddress] -> [RawInstanceAddress.RawInstanceAddress] computeRequiredCCVsForSend destConfig message extraArgs senderRequestedCCVs = @@ -90,24 +92,24 @@ computeRequiredCCVsForSend destConfig message extraArgs senderRequestedCCVs = [] -> if isTokenOnlyTransfer then [] - else CCIP.Internal.resolveRequiredCCVsWithDefaults + else CCIP.CodecV1.CCVCodec.resolveRequiredCCVsWithDefaults destConfig.defaultCCVs senderRequestedCCVs - _ -> CCIP.Internal.resolveRequiredCCVsWithDefaults + _ -> CCIP.CodecV1.CCVCodec.resolveRequiredCCVsWithDefaults destConfig.defaultCCVs senderRequestedCCVs in dedup (resolvedSenderRequiredCCVs ++ destConfig.laneMandatedCCVs) validateExecutorFeeQuote - : CCIP.Client.ExecutorExtraArg + : CCIP.ClientV1.ExecutorExtraArg -> Optional RawInstanceAddress.RawInstanceAddress - -> Optional CCIP.Interfaces.Executor.ExecutorFeeQuote + -> Optional CCIP.InterfacesV1.Executor.ExecutorFeeQuote -> Update () validateExecutorFeeQuote executorArg defaultExecutor executorFeeQuote = let expectedExecutor = case executorArg of - CCIP.Client.Executor_NoExecutor -> None - CCIP.Client.Executor_UseDefault _ -> defaultExecutor - CCIP.Client.Executor_WithAddress executorAddress _ -> Some executorAddress + CCIP.ClientV1.Executor_NoExecutor -> None + CCIP.ClientV1.Executor_UseDefault _ -> defaultExecutor + CCIP.ClientV1.Executor_WithAddress executorAddress _ -> Some executorAddress in case (expectedExecutor, executorFeeQuote) of (None, None) -> pure () (None, Some _) -> @@ -157,10 +159,10 @@ data FeeCalculationInputs = FeeCalculationInputs calculateFeeResult : Party -> Numeric 0 - -> ContractId CCIP.FeeQuoter.FeeQuoter + -> ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter -> Numeric 0 - -> CCIP.GlobalConfig.DestChainConfig - -> CCIP.FeeQuoter.FeeQuoterDestChainConfig + -> CCIP.CoreV1.GlobalConfig.DestChainConfig + -> CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig -> [Numeric 0] -> FeeCalculationInputs -> Update FeeCalculationResult @@ -185,18 +187,19 @@ calculateFeeResult ccipOwner maxUSDCentsPerMsg feeQuoterCid destChainSelector de inputs.ccvBytesSum + inputs.poolBytes + executorDestBytesOverhead - quote <- exercise feeQuoterCid CCIP.FeeQuoter.QuoteGasForExec with + quote <- exercise feeQuoterCid CCIP.CoreV1.FeeQuoter.QuoteGasForExec with destChainSelector = destChainSelector nonCalldataGas calldataSize feeToken = inputs.feeToken + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccipOwner -- Apply the premium multiplier to USD-cent fees for the cap check. -- EVM FeeQuoter.sol line 728: premiumFeeUSDWei *= multiplier. - let premiumMultiplierN = CCIP.Math.decimalToNumeric0 quote.premiumMultiplier + let premiumMultiplierN = CCIP.CodecV1.Math.decimalToNumeric0 quote.premiumMultiplier let premiumize feeUSDCents = - CCIP.Math.mulDivDown feeUSDCents premiumMultiplierN CCIP.Math.premiumIdentity + CCIP.CodecV1.Math.mulDivDown feeUSDCents premiumMultiplierN CCIP.CodecV1.Math.premiumIdentity let networkFeeUSDCents = if inputs.hasTokenTransfer then destConfig.tokenNetworkFeeUSDCents else destConfig.messageNetworkFeeUSDCents @@ -216,16 +219,16 @@ calculateFeeResult ccipOwner maxUSDCentsPerMsg feeQuoterCid destChainSelector de (totalUSDCents <= maxUSDCentsPerMsg) -- Convert per-component USD-cent fees into fee token smallest units. - -- See SendingMessageV1.FinalizeFee for the detailed EVM mapping. - let feeTokenPriceN = CCIP.Math.decimalToNumeric0 quote.feeTokenPrice + -- See SendingMessage.FinalizeFee for the detailed EVM mapping. + let feeTokenPriceN = CCIP.CodecV1.Math.decimalToNumeric0 quote.feeTokenPrice let promoteUsdCentsToUsd10 feeUSDCents = - CCIP.Math.mulDivDown feeUSDCents CCIP.Math.usdPerUsdCent 1.0 + CCIP.CodecV1.Math.mulDivDown feeUSDCents CCIP.CodecV1.Math.usdPerUsdCent 1.0 let convertWithPremium feeUSDCents = let feeUsd10 = promoteUsdCentsToUsd10 feeUSDCents - in CCIP.Math.mulDivDown feeUsd10 premiumMultiplierN feeTokenPriceN + in CCIP.CodecV1.Math.mulDivDown feeUsd10 premiumMultiplierN feeTokenPriceN let convertDirect feeUSDCents = let feeUsd10 = promoteUsdCentsToUsd10 feeUSDCents - in CCIP.Math.mulDivDown feeUsd10 CCIP.Math.premiumIdentity feeTokenPriceN + in CCIP.CodecV1.Math.mulDivDown feeUsd10 CCIP.CodecV1.Math.premiumIdentity feeTokenPriceN let ccvFeeTokenAmount = sum (map convertWithPremium ccvFeeUSDCentsByVerifier) let totalFeeTokenAmount = @@ -265,16 +268,15 @@ template OnRamp rmnRemote = fromOptional deps.rmnRemote newDeps.rmnRemote tokenAdminRegistry = fromOptional deps.tokenAdminRegistry newDeps.tokenAdminRegistry feeQuoter = fromOptional deps.feeQuoter newDeps.feeQuoter - ccvRegistry = fromOptional deps.ccvRegistry newDeps.ccvRegistry create this with deps = mergedDeps -- | Get required CCV raw instance addresses for outbound message. -- TODO: this should not concat default and lane mandated CCVs and return nonconsuming choice GetRequiredCCVsForSendFromRouter : [RawInstanceAddress.RawInstanceAddress] with - globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage + message : CCIP.ClientV1.Canton2AnyMessage poolReportedCCVs : [RawInstanceAddress.RawInstanceAddress] controller ccipOwner do @@ -283,18 +285,18 @@ template OnRamp globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig destConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetDestChainConfig with + CCIP.CoreV1.GlobalConfig.GetDestChainConfig with destChainSelector = destChainSelector caller = ccipOwner case destConfigOpt of None -> pure [] Some config -> do extraArgs <- case message.extraArgs of - CCIP.Client.V3 v3 -> pure v3 + CCIP.ClientV1.V3 v3 -> pure v3 _ -> abort "onramp: unsupported extraArgs version" let senderRequestedCCVs = map (.ccvAddress) extraArgs.ccvs - CCIP.Internal.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs - CCIP.Internal.assertMaxCCVListLength "onramp: pool-reported CCVs" poolReportedCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "onramp: pool-reported CCVs" poolReportedCCVs assertMsg "onramp: pool-reported CCVs cannot contain duplicates" (unique poolReportedCCVs) let senderRequiredCCVs = @@ -306,27 +308,28 @@ template OnRamp let finalRequiredCCVs = case message.tokenTransfer of None -> senderRequiredCCVs Some _ -> - dedup (senderRequiredCCVs ++ CCIP.Internal.resolveRequiredCCVsWithDefaults + dedup (senderRequiredCCVs ++ CCIP.CodecV1.CCVCodec.resolveRequiredCCVsWithDefaults config.defaultCCVs poolReportedCCVs) - CCIP.Internal.assertMaxCCVListLength "onramp: required CCVs" finalRequiredCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "onramp: required CCVs" finalRequiredCCVs pure finalRequiredCCVs - -- | Build SendingMessageV1 for outbound message. + -- | Build SendingMessage for outbound message. -- Validates fee token is accepted, reads network fee from DestChainConfig. -- Message construction is deferred until execution metadata is finalized. - nonconsuming choice PrepareSendFromRouter : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice PrepareSendFromRouter : ContractId CCIP.CoreV1.SendingMessage.SendingMessage with destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage + message : CCIP.ClientV1.Canton2AnyMessage routerPartyOwner : Party routerInstanceId : Text - globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + tokenAdminRegistryCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry + feeQuoterCid : ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter + rmnRemoteCid : ContractId CCIP.CoreV1.RMNRemote.RMNRemote currentSequenceNumber : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext controller ccipOwner do -- Fetch dependencies @@ -340,20 +343,21 @@ template OnRamp tokenAdminRegistry <- fetch tokenAdminRegistryCid RawInstanceAddress.assertEqual "onramp: tokenadminregistry instance address mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner deps.tokenAdminRegistry feeQuoter <- fetch feeQuoterCid RawInstanceAddress.assertEqual "onramp: feequoter instance address mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + feeQuoter.instanceId feeQuoter.ccipOwner deps.feeQuoter -- RMN curse check - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with - caller = ccipOwner + isCursed <- exercise rmnRemoteCid CCIP.CoreV1.RMNRemote.IsCursedForChain with chainSelector = destChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner assertMsg "onramp: destination chain is cursed" (not isCursed) destConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetDestChainConfig with + CCIP.CoreV1.GlobalConfig.GetDestChainConfig with destChainSelector = destChainSelector caller = ccipOwner destConfig <- case destConfigOpt of @@ -368,9 +372,9 @@ template OnRamp -- Parse extraArgs and validate fields extraArgs <- case message.extraArgs of - CCIP.Client.V3 v3 -> pure v3 + CCIP.ClientV1.V3 v3 -> pure v3 let senderRequestedCCVs = map (.ccvAddress) extraArgs.ccvs - CCIP.Internal.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs assertMsg "onramp: gas limit exceeds uint32" (extraArgs.gasLimit <= 4294967295) assertValidHex "tokenReceiver" extraArgs.tokenReceiver assertMsg "onramp: tokenReceiver not allowed" (destConfig.tokenReceiverAllowed || extraArgs.tokenReceiver == "") @@ -380,10 +384,10 @@ template OnRamp assertMsg "onramp: CCVs cannot contain duplicates" (unique senderRequestedCCVs) case extraArgs.executor of - CCIP.Client.Executor_NoExecutor -> pure () - CCIP.Client.Executor_UseDefault executorArgs -> + CCIP.ClientV1.Executor_NoExecutor -> pure () + CCIP.ClientV1.Executor_UseDefault executorArgs -> assertValidHex "executorArgs" executorArgs - CCIP.Client.Executor_WithAddress _ executorArgs -> + CCIP.ClientV1.Executor_WithAddress _ executorArgs -> assertValidHex "executorArgs" executorArgs case Map.lookup destChainSelector feeQuoter.destChainConfigs of @@ -392,58 +396,59 @@ template OnRamp (byteCount message.payload <= feeDestConfig.maxDataBytes) None -> abort ("onramp: no fee config for destination chain " <> show destChainSelector) - _ <- exercise feeQuoterCid CCIP.FeeQuoter.GetTokenPrice with - instrumentId = message.feeToken + _ <- exercise feeQuoterCid CCIP.CoreV1.FeeQuoter.GetTokenPrice with + token = message.feeToken + context = context caller = ccipOwner - let (hasTokenTransfer, tokenInstrumentId) = case message.tokenTransfer of - None -> (False, None) - Some tt -> (True, Some tt.token) + let (hasTokenTransfer, tokenInstrumentId, tokenAmountBeforeTokenPoolFees) = case message.tokenTransfer of + None -> (False, None, 0.0) + Some tt -> (True, Some tt.token, tt.amount) let resolvedSenderRequiredCCVs = computeRequiredCCVsForSend destConfig message extraArgs senderRequestedCCVs - CCIP.Internal.assertMaxCCVListLength "onramp: required CCVs" resolvedSenderRequiredCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "onramp: required CCVs" resolvedSenderRequiredCCVs let newSequenceNumber = currentSequenceNumber + 1.0 assertMsg "onramp: sequence number exceeds uint64" (newSequenceNumber <= 18446744073709551615.0) - let onRampAddr = CCIP.MessageCodecV1.encodeInstanceAddress instanceId ccipOwner - let senderAddr = CCIP.MessageCodecV1.encodePartyAddress routerPartyOwner + let onRampAddr = CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress instanceId ccipOwner + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress routerPartyOwner let resolvedTokenReceiver = if hasTokenTransfer - then CCIP.SendingMessageV1.validateDestChainAddress (if extraArgs.tokenReceiver /= "" then extraArgs.tokenReceiver else message.receiver) destConfig.addressBytesLength + then CCIP.CoreV1.SendingMessage.validateDestChainAddress (if extraArgs.tokenReceiver /= "" then extraArgs.tokenReceiver else message.receiver) destConfig.addressBytesLength else "" let networkFeeUSD = if hasTokenTransfer then destConfig.tokenNetworkFeeUSDCents else destConfig.messageNetworkFeeUSDCents let initialState = if hasTokenTransfer - then CCIP.SendingMessageV1.SendingMessageState_RequirePoolCCVs - else CCIP.SendingMessageV1.SendingMessageState_Prepared + then CCIP.CoreV1.SendingMessage.SendingMessageState_RequirePoolCCVs + else CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared let resolveDefault = case destConfig.defaultExecutor of Some defaultExecutor -> ( Some defaultExecutor , RawInstanceAddress.toInstanceAddress defaultExecutor - , Some CCIP.SendingMessageV1.ExecutionMode_Executor + , Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor ) None -> - (None, noExecutionAddressBytes, Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor) + (None, noExecutionAddressBytes, Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor) let (resolvedRequiredExecutor, resolvedExecutorAddress, executionMode) = case extraArgs.executor of - CCIP.Client.Executor_UseDefault _ -> + CCIP.ClientV1.Executor_UseDefault _ -> resolveDefault - CCIP.Client.Executor_NoExecutor -> - (None, noExecutionAddressBytes, Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor) - CCIP.Client.Executor_WithAddress executorAddress _ -> + CCIP.ClientV1.Executor_NoExecutor -> + (None, noExecutionAddressBytes, Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor) + CCIP.ClientV1.Executor_WithAddress executorAddress _ -> ( Some executorAddress , RawInstanceAddress.toInstanceAddress executorAddress - , Some CCIP.SendingMessageV1.ExecutionMode_Executor + , Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor ) - create CCIP.SendingMessageV1.SendingMessageV1 with + create CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = routerPartyOwner - deps = CCIP.SendingMessageV1.SendingMessageDeps with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with router = RawInstanceAddress.make routerInstanceId routerPartyOwner onRamp = rawInstanceAddress this globalConfig = deps.globalConfig @@ -458,7 +463,7 @@ template OnRamp requiredExecutor = resolvedRequiredExecutor sourceChainSelector = globalConfig.chainSelector senderAddress = senderAddr - receiver = CCIP.SendingMessageV1.validateDestChainAddress message.receiver destConfig.addressBytesLength + receiver = CCIP.CoreV1.SendingMessage.validateDestChainAddress message.receiver destConfig.addressBytesLength payload = message.payload executionGasLimit = 0 ccipReceiveGasLimit = extraArgs.gasLimit -- TODO: does this default to default gas limit if 0? @@ -473,6 +478,7 @@ template OnRamp feeToken = message.feeToken networkFeeUSDCents = networkFeeUSD expectedTokenInstrumentId = tokenInstrumentId + tokenAmountBeforeTokenPoolFees = tokenAmountBeforeTokenPoolFees outboundPoolCCVs = None executorAddress = resolvedExecutorAddress executionMode = executionMode @@ -492,32 +498,32 @@ template OnRamp observingParties = [routerPartyOwner] state = initialState - -- | Quote the fee for an outbound message without creating a SendingMessageV1. + -- | Quote the fee for an outbound message without creating a SendingMessage. nonconsuming choice GetFeeFromRouter : GetFeeFromRouterResult with routerPartyOwner : Party routerInstanceId : Text - globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + feeQuoterCid : ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage - ccvFeeQuotes : [ICCV.CrossChainVerifierFeeQuote] - tokenPoolFeeQuote : Optional CCIP.Interfaces.TokenPool.TokenPoolFeeQuote - executorFeeQuote : Optional CCIP.Interfaces.Executor.ExecutorFeeQuote + message : CCIP.ClientV1.Canton2AnyMessage + ccvFeeQuotes : [CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote] + tokenPoolFeeQuote : Optional CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote + executorFeeQuote : Optional CCIP.InterfacesV1.Executor.ExecutorFeeQuote controller ccipOwner do extraArgs <- case message.extraArgs of - CCIP.Client.V3 v3 -> pure v3 + CCIP.ClientV1.V3 v3 -> pure v3 let senderRequestedCCVs = map (.ccvAddress) extraArgs.ccvs - CCIP.Internal.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs - CCIP.Internal.assertMaxCCVListLength "onramp: CCV fee quotes" ccvFeeQuotes + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "onramp: CCV fee quotes" ccvFeeQuotes assertMsg "onramp: CCVs cannot contain duplicates" (unique senderRequestedCCVs) let executorArgs = case extraArgs.executor of - CCIP.Client.Executor_NoExecutor -> "" - CCIP.Client.Executor_UseDefault expectedExecutorArgs -> + CCIP.ClientV1.Executor_NoExecutor -> "" + CCIP.ClientV1.Executor_UseDefault expectedExecutorArgs -> expectedExecutorArgs - CCIP.Client.Executor_WithAddress _ expectedExecutorArgs -> + CCIP.ClientV1.Executor_WithAddress _ expectedExecutorArgs -> expectedExecutorArgs assertValidHex "payload" message.payload assertValidHex "executorArgs" executorArgs @@ -527,13 +533,13 @@ template OnRamp Some _ -> True) assertMsg "onramp: executor quote inconsistent with extraArgs" (case extraArgs.executor of - CCIP.Client.Executor_NoExecutor -> + CCIP.ClientV1.Executor_NoExecutor -> isNone executorFeeQuote && executorArgs == "" - CCIP.Client.Executor_UseDefault expectedExecutorArgs -> + CCIP.ClientV1.Executor_UseDefault expectedExecutorArgs -> case executorFeeQuote of None -> executorArgs == "" Some _ -> executorArgs == expectedExecutorArgs - CCIP.Client.Executor_WithAddress _ expectedExecutorArgs -> + CCIP.ClientV1.Executor_WithAddress _ expectedExecutorArgs -> isSome executorFeeQuote && executorArgs == expectedExecutorArgs) globalConfig <- fetch globalConfigCid @@ -542,10 +548,10 @@ template OnRamp feeQuoter <- fetch feeQuoterCid RawInstanceAddress.assertEqual "onramp: feequoter instance address mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + feeQuoter.instanceId feeQuoter.ccipOwner deps.feeQuoter destConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetDestChainConfig with + CCIP.CoreV1.GlobalConfig.GetDestChainConfig with destChainSelector = destChainSelector caller = ccipOwner destConfig <- case destConfigOpt of @@ -560,7 +566,7 @@ template OnRamp executorFeeQuote feeDestConfig <- exercise feeQuoterCid - CCIP.FeeQuoter.GetDestChainConfig with + CCIP.CoreV1.FeeQuoter.GetDestChainConfig with destChainSelector = destChainSelector caller = ccipOwner @@ -601,13 +607,13 @@ template OnRamp -- | Finalize execution metadata and fees from the router. Message -- construction remains a separate state-machine transition. - nonconsuming choice FinalizeFeeFromRouter : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice FinalizeFeeFromRouter : ContractId CCIP.CoreV1.SendingMessage.SendingMessage with routerPartyOwner : Party routerInstanceId : Text - globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig - feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + feeQuoterCid : ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter + sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage controller ccipOwner do sendingMsg <- fetch sendingMessageCid @@ -630,10 +636,10 @@ template OnRamp feeQuoter <- fetch feeQuoterCid RawInstanceAddress.assertEqual "onramp: feequoter instance address mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + feeQuoter.instanceId feeQuoter.ccipOwner deps.feeQuoter destConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetDestChainConfig with + CCIP.CoreV1.GlobalConfig.GetDestChainConfig with destChainSelector = sendingMsg.destChainSelector caller = ccipOwner destConfig <- case destConfigOpt of @@ -643,7 +649,7 @@ template OnRamp pure cfg feeDestConfig <- exercise feeQuoterCid - CCIP.FeeQuoter.GetDestChainConfig with + CCIP.CoreV1.FeeQuoter.GetDestChainConfig with destChainSelector = sendingMsg.destChainSelector caller = ccipOwner @@ -660,7 +666,7 @@ template OnRamp Some fee -> fee.destBytesOverhead None -> 0 let executorFlatUSDCents = case sendingMsg.executionMode of - Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor -> 0.0 + Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor -> 0.0 _ -> case sendingMsg.executorFee of Some fee -> fee.feeUSDCents None -> 0.0 @@ -680,7 +686,7 @@ template OnRamp poolBytes = poolBytes executorFeeUSDCents = executorFlatUSDCents hasExecutorFee = case sendingMsg.executionMode of - Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor -> False + Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor -> False _ -> isSome sendingMsg.executorFee feeResult <- calculateFeeResult ccipOwner @@ -693,7 +699,7 @@ template OnRamp inputs finalizedCid <- exercise sendingMessageCid - CCIP.SendingMessageV1.FinalizeFee with + CCIP.CoreV1.SendingMessage.FinalizeFee with feeTokenPrice = tokenPrice.price premiumMultiplier = feeResult.premiumMultiplier totalExecutionGasLimit = feeResult.totalExecutionGasLimit @@ -708,18 +714,18 @@ template OnRamp pure finalizedCid -- | Validate and finalize a CCIP send. - -- Reads accumulated data from SendingMessageV1. Fee collection happens + -- Reads accumulated data from SendingMessage. Fee collection happens -- in PerPartyRouter, not here. nonconsuming choice CCIPSendFromRouter : CCIPSendFromRouterResult with routerPartyOwner : Party routerInstanceId : Text currentSequenceNumber : Numeric 0 - rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote - globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig - tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - tokenConfigCid : Optional (ContractId CCIP.TokenAdminRegistry.TokenConfig) - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + rmnRemoteCid : ContractId CCIP.CoreV1.RMNRemote.RMNRemote + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + tokenAdminRegistryCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry + tokenConfigCid : Optional (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) + sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage controller ccipOwner do sendingMsg <- fetch sendingMessageCid @@ -745,7 +751,7 @@ template OnRamp Some m -> pure m assertMsg "sendingMessage not fee-finalized" - (sendingMsg.state == CCIP.SendingMessageV1.SendingMessageState_FeeFinalized) + (sendingMsg.state == CCIP.CoreV1.SendingMessage.SendingMessageState_FeeFinalized) assertMsg "sequence number mismatch" (sendingMsg.sequenceNumber == currentSequenceNumber + 1.0) @@ -761,17 +767,18 @@ template OnRamp tokenAdminRegistry <- fetch tokenAdminRegistryCid RawInstanceAddress.assertEqual "tar mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner + tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner sendingMsg.deps.tokenAdminRegistry -- Authoritative RMN curse check - isCursed <- exercise rmnRemoteCid CCIP.RMNRemote.IsCursedForChain with - caller = ccipOwner + isCursed <- exercise rmnRemoteCid CCIP.CoreV1.RMNRemote.IsCursedForChain with chainSelector = sendingMsg.destChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner assertMsg "dest chain is cursed" (not isCursed) destConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetDestChainConfig with + CCIP.CoreV1.GlobalConfig.GetDestChainConfig with destChainSelector = sendingMsg.destChainSelector caller = ccipOwner destConfig <- case destConfigOpt of @@ -806,16 +813,17 @@ template OnRamp None -> abort "onramp: missing token config CID" Some cid -> pure cid config <- exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.GetTokenConfigByCid with + CCIP.CoreV1.TokenAdminRegistry.GetTokenConfigByCid with tokenConfigCid = configCid instrumentId = tsd.instrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccipOwner pool <- case config.tokenPool of None -> abort "no pool registered" Some p -> pure p - let expectedPoolAddr = CCIP.MessageCodecV1.encodeInstanceAddress + let expectedPoolAddr = CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress pool.poolInstanceId pool.poolOwner - let expectedTokenAddr = CCIP.MessageCodecV1.encodeInstrumentId + let expectedTokenAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId tsd.instrumentId assertMsg "sourcePoolAddress mismatch" (tt.sourcePoolAddress == expectedPoolAddr) @@ -823,14 +831,14 @@ template OnRamp (tt.sourceTokenAddress == expectedTokenAddr) assertMsg "token amount mismatch" (tt.amount == tsd.amount) - let _ = CCIP.SendingMessageV1.validateDestChainAddress tsd.destTokenAddress destConfig.addressBytesLength + let _ = CCIP.CoreV1.SendingMessage.validateDestChainAddress tsd.destTokenAddress destConfig.addressBytesLength pure() (None, None) -> pure () _ -> abort "token transfer / token send data mismatch" let receipts = assembleReceipts sendingMsg let finalVerifierData = orderedVerifierData sendingMsg - finalizeResult <- exercise sendingMessageCid CCIP.SendingMessageV1.FinalizeSend with + finalizeResult <- exercise sendingMessageCid CCIP.CoreV1.SendingMessage.FinalizeSend with messageSender = routerPartyOwner messageSentObservers = concatMap (.messageSentObservers) finalVerifierData verifierBlobs = map (.verifierBlob) finalVerifierData @@ -869,21 +877,21 @@ template OnRamp data CCIPSendFromRouterResult = CCIPSendFromRouterResult with - ccipMessageSent : ContractId CCIP.Events.CCIPMessageSent + ccipMessageSent : ContractId CCIP.EventsV1.Events.CCIPMessageSent verifierBlobs : [BytesHex] messageSentObservers : [Party] - receipts : [CCIP.Tickets.Receipt] + receipts : [CCIP.EventsV1.Receipts.Receipt] deriving (Eq, Show) orderedVerifierDataByCCVs : [BytesHex] - -> [CCIP.SendingMessageV1.VerifierData] - -> [CCIP.SendingMessageV1.VerifierData] + -> [CCIP.CoreV1.SendingMessage.VerifierData] + -> [CCIP.CoreV1.SendingMessage.VerifierData] orderedVerifierDataByCCVs finalCCVs verifierData = let lookupVerifier ccvAddr = case filter - (\vd -> CCIP.MessageCodecV1.encodeInstanceAddress vd.ccvInstanceId vd.ccvOwner == ccvAddr) + (\vd -> CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress vd.ccvInstanceId vd.ccvOwner == ccvAddr) verifierData of [vd] -> vd [] -> error ("missing verifier data for CCV address " <> ccvAddr) @@ -891,7 +899,7 @@ orderedVerifierDataByCCVs finalCCVs verifierData = in map (\ccv -> lookupVerifier ccv) finalCCVs -orderedVerifierData : CCIP.SendingMessageV1.SendingMessageV1 -> [CCIP.SendingMessageV1.VerifierData] +orderedVerifierData : CCIP.CoreV1.SendingMessage.SendingMessage -> [CCIP.CoreV1.SendingMessage.VerifierData] orderedVerifierData sendingMsg = let finalCCVs = map RawInstanceAddress.toInstanceAddress @@ -902,7 +910,7 @@ orderedVerifierData sendingMsg = -- | Assemble final receipts from the separated fee fields, verifier data, -- token send data, executor fee, and the network fee. Receipt order matches -- EVM: CCV receipts, pool receipt, executor receipt, network fee receipt. -assembleReceipts : CCIP.SendingMessageV1.SendingMessageV1 -> [CCIP.Tickets.Receipt] +assembleReceipts : CCIP.CoreV1.SendingMessage.SendingMessage -> [CCIP.EventsV1.Receipts.Receipt] assembleReceipts sendingMsg = let finalVerifierData = orderedVerifierData sendingMsg @@ -913,15 +921,15 @@ assembleReceipts sendingMsg = poolReceipt = case (sendingMsg.tokenSendData, sendingMsg.tokenSendFee) of (Some tsd, Some fee) -> - let poolAddr = CCIP.MessageCodecV1.encodeInstanceAddress + let poolAddr = CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress tsd.poolInstanceId tsd.poolOwner - in [CCIP.Tickets.Receipt with - issuerType = CCIP.Tickets.IssuerType_Pool + in [CCIP.EventsV1.Receipts.Receipt with + issuerType = CCIP.EventsV1.Receipts.IssuerType_Pool issuerAddress = poolAddr versionTag = None destGasLimit = fee.destGasOverhead destBytesOverhead = fee.destBytesOverhead - feeTokenAmount = CCIP.Math.decimalToNumeric0 sendingMsg.tokenSendFeeTokenAmount + feeTokenAmount = CCIP.CodecV1.Math.decimalToNumeric0 sendingMsg.tokenSendFeeTokenAmount extraArgs = ""] _ -> [] @@ -929,52 +937,52 @@ assembleReceipts sendingMsg = None -> [] Some execMode -> let execAddr = case execMode of - CCIP.SendingMessageV1.ExecutionMode_Executor -> + CCIP.CoreV1.SendingMessage.ExecutionMode_Executor -> case sendingMsg.executorFee of - Some fee -> CCIP.MessageCodecV1.encodeInstanceAddress + Some fee -> CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress fee.executorInstanceId fee.executorOwner None -> error "missing executor fee" - CCIP.SendingMessageV1.ExecutionMode_NoExecutor -> + CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor -> noExecutionAddressBytes - in [CCIP.Tickets.Receipt with - issuerType = CCIP.Tickets.IssuerType_Executor + in [CCIP.EventsV1.Receipts.Receipt with + issuerType = CCIP.EventsV1.Receipts.IssuerType_Executor issuerAddress = execAddr versionTag = None destGasLimit = sendingMsg.executorDestGasLimit destBytesOverhead = sendingMsg.executorDestBytesOverhead - feeTokenAmount = CCIP.Math.decimalToNumeric0 sendingMsg.executorFeeTokenAmount + feeTokenAmount = CCIP.CodecV1.Math.decimalToNumeric0 sendingMsg.executorFeeTokenAmount extraArgs = sendingMsg.executorArgs] - networkReceipt = CCIP.Tickets.Receipt with - issuerType = CCIP.Tickets.IssuerType_Network + networkReceipt = CCIP.EventsV1.Receipts.Receipt with + issuerType = CCIP.EventsV1.Receipts.IssuerType_Network issuerAddress = "" versionTag = None destGasLimit = 0 destBytesOverhead = 0 - feeTokenAmount = CCIP.Math.decimalToNumeric0 sendingMsg.networkFeeTokenAmount + feeTokenAmount = CCIP.CodecV1.Math.decimalToNumeric0 sendingMsg.networkFeeTokenAmount extraArgs = "" in ccvReceipts ++ poolReceipt ++ executorReceipt ++ [networkReceipt] -- | Finds the matching ccvFee by (ccvInstanceId, ccvOwner) and looks up -- the corresponding feeTokenAmount from the parallel ccvFeeTokenAmounts list. -assembleCCVReceipt : [CCIP.SendingMessageV1.CCVFee] -> [Decimal] -> CCIP.SendingMessageV1.VerifierData -> CCIP.Tickets.Receipt +assembleCCVReceipt : [CCIP.CoreV1.SendingMessage.CCVFee] -> [Decimal] -> CCIP.CoreV1.SendingMessage.VerifierData -> CCIP.EventsV1.Receipts.Receipt assembleCCVReceipt ccvFees ccvFeeTokenAmounts vd = - let ccvAddr = CCIP.MessageCodecV1.encodeInstanceAddress vd.ccvInstanceId vd.ccvOwner + let ccvAddr = CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress vd.ccvInstanceId vd.ccvOwner (fee, feeTokenAmt) = findFeeWithAmount ccvFees ccvFeeTokenAmounts (\q -> q.ccvInstanceId == vd.ccvInstanceId && q.ccvOwner == vd.ccvOwner) - in CCIP.Tickets.Receipt with - issuerType = CCIP.Tickets.IssuerType_CCV + in CCIP.EventsV1.Receipts.Receipt with + issuerType = CCIP.EventsV1.Receipts.IssuerType_CCV issuerAddress = ccvAddr versionTag = Some vd.versionTag destGasLimit = fee.destGasLimit destBytesOverhead = fee.destBytesOverhead - feeTokenAmount = CCIP.Math.decimalToNumeric0 feeTokenAmt + feeTokenAmount = CCIP.CodecV1.Math.decimalToNumeric0 feeTokenAmt extraArgs = "" -- | Find a matching fee entry and its corresponding token amount from parallel lists. -findFeeWithAmount : [CCIP.SendingMessageV1.CCVFee] -> [Decimal] -> (CCIP.SendingMessageV1.CCVFee -> Bool) -> (CCIP.SendingMessageV1.CCVFee, Decimal) +findFeeWithAmount : [CCIP.CoreV1.SendingMessage.CCVFee] -> [Decimal] -> (CCIP.CoreV1.SendingMessage.CCVFee -> Bool) -> (CCIP.CoreV1.SendingMessage.CCVFee, Decimal) findFeeWithAmount [] _ _ = error "missing CCV fee" findFeeWithAmount _ [] _ = error "missing CCV fee token amount" findFeeWithAmount (f :: fs) (a :: as) pred = diff --git a/contracts/ccip/runtime/daml/CCIP/OnRampCodecGen.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRampCodecGen.daml similarity index 81% rename from contracts/ccip/runtime/daml/CCIP/OnRampCodecGen.daml rename to contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRampCodecGen.daml index ba202ba97..aca1eb034 100644 --- a/contracts/ccip/runtime/daml/CCIP/OnRampCodecGen.daml +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRampCodecGen.daml @@ -1,17 +1,17 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.OnRampCodecGen where +module CCIP.RuntimeV1.OnRampCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.OnRampTypes (OnRampDeps(..), SetDepsParams(..)) +import CCIP.RuntimeV1.OnRampTypes (OnRampDeps(..), SetDepsParams(..)) import MCMS.Codec ( decodeOptional, encodeOptional ) -import CCIP.Codec (decodeRawInstanceAddressAt, encodeRawInstanceAddress) +import CCIP.CodecV1 (decodeRawInstanceAddressAt, encodeRawInstanceAddress) -- =============================================== @@ -24,7 +24,6 @@ encodeOnRampDeps params = <> encodeRawInstanceAddress params.rmnRemote <> encodeRawInstanceAddress params.tokenAdminRegistry <> encodeRawInstanceAddress params.feeQuoter - <> encodeRawInstanceAddress params.ccvRegistry decodeOnRampDepsAt : BytesHex -> Int -> Optional (OnRampDeps, Int) decodeOnRampDepsAt encoded offset = do @@ -32,7 +31,6 @@ decodeOnRampDepsAt encoded offset = do (rmnRemote, offset) <- decodeRawInstanceAddressAt encoded offset (tokenAdminRegistry, offset) <- decodeRawInstanceAddressAt encoded offset (feeQuoter, offset) <- decodeRawInstanceAddressAt encoded offset - (ccvRegistry, offset) <- decodeRawInstanceAddressAt encoded offset Some (OnRampDeps{..}, offset) @@ -46,7 +44,6 @@ encodeSetDepsParams params = <> encodeOptional params.rmnRemote encodeRawInstanceAddress <> encodeOptional params.tokenAdminRegistry encodeRawInstanceAddress <> encodeOptional params.feeQuoter encodeRawInstanceAddress - <> encodeOptional params.ccvRegistry encodeRawInstanceAddress decodeSetDepsParamsAt : BytesHex -> Int -> Optional (SetDepsParams, Int) decodeSetDepsParamsAt encoded offset = do @@ -54,7 +51,6 @@ decodeSetDepsParamsAt encoded offset = do (rmnRemote, offset) <- decodeOptional encoded offset decodeRawInstanceAddressAt (tokenAdminRegistry, offset) <- decodeOptional encoded offset decodeRawInstanceAddressAt (feeQuoter, offset) <- decodeOptional encoded offset decodeRawInstanceAddressAt - (ccvRegistry, offset) <- decodeOptional encoded offset decodeRawInstanceAddressAt Some (SetDepsParams{..}, offset) diff --git a/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRampTypes.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRampTypes.daml new file mode 100644 index 000000000..82ebeccbe --- /dev/null +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/OnRampTypes.daml @@ -0,0 +1,19 @@ +module CCIP.RuntimeV1.OnRampTypes where + +import qualified Chainlink.InstanceAddress + +data OnRampDeps = OnRampDeps + with + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress + deriving (Eq, Show) + +data SetDepsParams = SetDepsParams + with + globalConfig : Optional Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Optional Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Optional Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Optional Chainlink.InstanceAddress.RawInstanceAddress + deriving (Eq, Show) diff --git a/contracts/ccip/runtime/daml/CCIP/PerPartyRouter.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouter.daml similarity index 66% rename from contracts/ccip/runtime/daml/CCIP/PerPartyRouter.daml rename to contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouter.daml index 7ace556c0..cefb15e4b 100644 --- a/contracts/ccip/runtime/daml/CCIP/PerPartyRouter.daml +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouter.daml @@ -1,5 +1,8 @@ -- | Per-party router for CCIP message sending and receiving. -module CCIP.PerPartyRouter where +module CCIP.RuntimeV1.PerPartyRouter ( + module CCIP.RuntimeV1.PerPartyRouter, + module CCIP.RuntimeV1.PerPartyRouterTypes, +) where import DA.Action (foldlA) import DA.List (dedup, unique) @@ -11,33 +14,41 @@ import DA.Date (date, Month(Dec)) import DA.Optional (fromOptional, isNone) import DA.Time (time) -import qualified CCIP.Client -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.Events -import qualified CCIP.FeeQuoter -import qualified CCIP.FinalityConfig -import qualified CCIP.GlobalConfig -import CCIP.Interfaces.CrossChainVerifier qualified as ICCV -import qualified CCIP.Interfaces.Executor -import qualified CCIP.Interfaces.TokenPool -import qualified CCIP.MessageCodecV1 -import qualified CCIP.OnRamp -import qualified CCIP.OffRamp -import Chainlink.InstanceAddress (RawInstanceAddress, assertValidInstanceId) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.SendingMessageV1 -import qualified CCIP.Tickets -import qualified CCIP.TokenAdminRegistry -import qualified CCIP.Internal -import qualified CCIP.Context -import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import CCIP.PerPartyRouterTypes (PerPartyRouterDeps(..), SetDepsParams(..), AddCustomObserversParams(..), RemoveCustomObserversParams(..)) -import CCIP.PerPartyRouterCodecGen (decodeSetDepsParamsAt, decodeAddCustomObserversParamsAt, decodeRemoveCustomObserversParamsAt) - import qualified Splice.Api.Token.HoldingV1 import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 +import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.GlobalConfig +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.ClientV1 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.SendingMessage +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.EventsV1.Events +import qualified CCIP.InterfacesV1.CrossChainVerifier +import qualified CCIP.InterfacesV1.Executor +import qualified CCIP.InterfacesV1.TokenPool +import qualified CCIP.RuntimeV1.OnRamp +import qualified CCIP.RuntimeV1.OffRamp +import qualified CCIP.TicketsV1 +import qualified CCIP.UtilsV1.Context + +import CCIP.RuntimeV1.PerPartyRouterTypes (PerPartyRouterDeps(..), SetDepsParams(..), AddCustomObserversParams(..), RemoveCustomObserversParams(..)) +import CCIP.RuntimeV1.PerPartyRouterCodecGen (decodeSetDepsParamsAt, decodeAddCustomObserversParamsAt, decodeRemoveCustomObserversParamsAt) + -- | Far-future time used as "never expires" for pending transfers. -- Matches Splice's maxTime pattern: https://github.com/hyperledger-labs/splice/blob/139ee12335f61851d7cbf540a4b56c80622c911f/daml/splice-amulet/daml/Splice/Expiry.daml#L125 maxTime : Time @@ -59,7 +70,7 @@ sumAllocatedFees : Map.Map Party Decimal -> Decimal sumAllocatedFees allocations = sum (map snd (Map.toList allocations)) buildCCVFeeAllocations - : [CCIP.SendingMessageV1.CCVFee] + : [CCIP.CoreV1.SendingMessage.CCVFee] -> [Decimal] -> Map.Map Party Decimal buildCCVFeeAllocations ccvFees ccvAmounts = @@ -172,7 +183,7 @@ template PerPartyRouterFactory registeredRouters : Map.Map Party Text -- partyOwner -> router instanceId where signatory ccipOwner - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId choice FactorySetDeps : ContractId PerPartyRouterFactory with @@ -292,36 +303,135 @@ template PerPartyRouter where signatory ccipOwner observer partyOwner :: customObservers - ensure assertValidInstanceId instanceId && unique customObservers + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && unique customObservers + + interface instance CCIP.ClientV1.PerPartyRouter for PerPartyRouter where + view = CCIP.ClientV1.PerPartyRouterView with + ccipOwner + owner = partyOwner + + perPartyRouter_getSequenceNumberImpl self arg = do + exercise (fromInterfaceContractId @PerPartyRouter self) GetSequenceNumber with + destChainSelector = arg.destChainSelector + context = arg.context + + perPartyRouter_getRequiredCCVsForSendImpl self arg = do + exercise (fromInterfaceContractId @PerPartyRouter self) GetRequiredCCVsForSend with + destChainSelector = arg.destChainSelector + message = arg.message + poolReportedCCVs = arg.poolReportedCCVs + context = arg.context + + perPartyRouter_getFeeImpl self arg = do + result <- exercise (fromInterfaceContractId @PerPartyRouter self) GetFee with + destChainSelector = arg.destChainSelector + message = arg.message + ccvFeeQuotes = arg.ccvFeeQuotes + tokenPoolFeeQuote = arg.tokenPoolFeeQuote + executorFeeQuote = arg.executorFeeQuote + context = arg.context + pure CCIP.ClientV1.GetFeeResult with + feeTokenAmount = result.feeTokenAmount + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + perPartyRouter_prepareSendImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @PerPartyRouter self) PrepareSend with + destinationChainSelector = arg.destinationChainSelector + message = arg.message + context = arg.context + + perPartyRouter_finalizeFeeImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @PerPartyRouter self) FinalizeFee with + sendingMessageCid = coerceContractId arg.sendingMessageCid + context = arg.context + + perPartyRouter_ccipSendImpl self arg = do + result <- exercise (fromInterfaceContractId @PerPartyRouter self) CCIPSend with + sendingMessageCid = coerceContractId arg.sendingMessageCid + feeTokenHoldingCids = arg.feeTokenHoldingCids + feeTokenConfigCid = coerceContractId arg.feeTokenConfigCid + feeTokenTransferFactory = arg.feeTokenTransferFactory + feeTokenExtraArgs = arg.feeTokenExtraArgs + context = arg.context + pure CCIP.ClientV1.CCIPSendResult with + router = coerceContractId result.router + ccipMessageSent = coerceContractId result.ccipMessageSent + messageId = result.messageId + feeChangeCids = result.feeChangeCids + pendingFeeInstructions = result.pendingFeeInstructions + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + + perPartyRouter_getExecutionStateImpl self arg = do + exercise (fromInterfaceContractId @PerPartyRouter self) GetExecutionState with + messageHash = arg.messageHash + context = arg.context + caller = arg.caller + + perPartyRouter_getRequiredCCVsForExecuteImpl self arg = do + exercise (fromInterfaceContractId @PerPartyRouter self) GetRequiredCCVsForExecute with + context = arg.context + message = arg.message + receiverRequiredCCVs = arg.receiverRequiredCCVs + receiverOptionalCCVs = arg.receiverOptionalCCVs + receiverOptionalThreshold = arg.receiverOptionalThreshold + tokenPoolRequiredCCVs = arg.tokenPoolRequiredCCVs + + perPartyRouter_prepareExecuteImpl self arg = do + coerceContractId <$> exercise (fromInterfaceContractId @PerPartyRouter self) PrepareExecute with + context = arg.context + encodedMessage = arg.encodedMessage + receiverParty = arg.receiverParty + tokenReceiverParty = arg.tokenReceiverParty + receiverRequiredCCVs = arg.receiverRequiredCCVs + receiverOptionalCCVs = arg.receiverOptionalCCVs + receiverOptionalThreshold = arg.receiverOptionalThreshold + receiverFinalityConfig = arg.receiverFinalityConfig + caller = arg.caller + + perPartyRouter_executeImpl self arg = do + result <- exercise (fromInterfaceContractId @PerPartyRouter self) Execute with + context = arg.context + executingMessageCid = coerceContractId arg.executingMessageCid + tokenReceiveTicket <- case result.tokenReceiveTicket of + None -> pure None + Some ticketCid -> pure (Some (coerceContractId @_ @CCIP.APIV1.ExecutingMessage.ITokenReceiveTicket ticketCid)) + pure CCIP.ClientV1.ExecuteResult with + router = coerceContractId result.router + tokenReceiveTicket = tokenReceiveTicket + executionStateChanged = coerceContractId result.executionStateChanged + messageId = result.messageId + message = result.message + state = result.state + context = Splice.Api.Token.MetadataV1.emptyChoiceContext - nonconsuming choice GetFee : CCIP.OnRamp.GetFeeFromRouterResult + nonconsuming choice GetFee : CCIP.RuntimeV1.OnRamp.GetFeeFromRouterResult with context : Splice.Api.Token.MetadataV1.ChoiceContext destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage - ccvFeeQuotes : [ICCV.CrossChainVerifierFeeQuote] - tokenPoolFeeQuote : Optional CCIP.Interfaces.TokenPool.TokenPoolFeeQuote - executorFeeQuote : Optional CCIP.Interfaces.Executor.ExecutorFeeQuote + message : CCIP.ClientV1.Canton2AnyMessage + ccvFeeQuotes : [CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote] + tokenPoolFeeQuote : Optional CCIP.InterfacesV1.TokenPool.TokenPoolFeeQuote + executorFeeQuote : Optional CCIP.InterfacesV1.Executor.ExecutorFeeQuote controller partyOwner do - CCIP.Internal.assertMaxCCVListLength "router: CCV fee quotes" ccvFeeQuotes - onRampCid <- CCIP.OnRamp.lookupOnRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - feeQuoterCid <- CCIP.FeeQuoter.lookupFeeQuoterCid context + CCIP.CodecV1.CCVCodec.assertMaxCCVListLength "router: CCV fee quotes" ccvFeeQuotes + onRampCid : ContractId CCIP.RuntimeV1.OnRamp.OnRamp <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RuntimeV1.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey + feeQuoterCid : ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.FeeQuoter.feeQuoterContextKey onRamp <- fetch onRampCid - RawInstanceAddress.assertEqual "router: onramp mismatch" + Chainlink.InstanceAddress.assertEqual "router: onramp mismatch" onRamp.instanceId onRamp.ccipOwner deps.onRamp globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "router: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "router: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig feeQuoter <- fetch feeQuoterCid - RawInstanceAddress.assertEqual "router: feequoter mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + Chainlink.InstanceAddress.assertEqual "router: feequoter mismatch" + feeQuoter.instanceId feeQuoter.ccipOwner deps.feeQuoter - exercise onRampCid CCIP.OnRamp.GetFeeFromRouter with + exercise onRampCid CCIP.RuntimeV1.OnRamp.GetFeeFromRouter with routerPartyOwner = partyOwner routerInstanceId = instanceId globalConfigCid = globalConfigCid @@ -364,44 +474,44 @@ template PerPartyRouter create this with customObservers = filter (`notElem` parties) customObservers - -- | Create SendingMessageV1 via OnRamp. Validates fee token, sets network fee. - nonconsuming choice PrepareSend : ContractId CCIP.SendingMessageV1.SendingMessageV1 + -- | Create SendingMessage via OnRamp. Validates fee token, sets network fee. + nonconsuming choice PrepareSend : ContractId CCIP.CoreV1.SendingMessage.SendingMessage with destinationChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage + message : CCIP.ClientV1.Canton2AnyMessage context : Splice.Api.Token.MetadataV1.ChoiceContext controller partyOwner do - onRampCid <- CCIP.OnRamp.lookupOnRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context - feeQuoterCid <- CCIP.FeeQuoter.lookupFeeQuoterCid context - rmnRemoteCid <- CCIP.Context.lookupRmnRemoteCid context + onRampCid : ContractId CCIP.RuntimeV1.OnRamp.OnRamp <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RuntimeV1.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey + tokenAdminRegistryCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey + feeQuoterCid : ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.FeeQuoter.feeQuoterContextKey + rmnRemoteCid : ContractId CCIP.CoreV1.RMNRemote.RMNRemote <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.RMNRemote.rmnRemoteContextKey onRamp <- fetch onRampCid - RawInstanceAddress.assertEqual "router: onramp mismatch" + Chainlink.InstanceAddress.assertEqual "router: onramp mismatch" onRamp.instanceId onRamp.ccipOwner deps.onRamp globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "router: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "router: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig tokenAdminRegistry <- fetch tokenAdminRegistryCid - RawInstanceAddress.assertEqual "router: tokenadminregistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + Chainlink.InstanceAddress.assertEqual "router: tokenadminregistry mismatch" + tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner deps.tokenAdminRegistry feeQuoter <- fetch feeQuoterCid - RawInstanceAddress.assertEqual "router: feequoter mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + Chainlink.InstanceAddress.assertEqual "router: feequoter mismatch" + feeQuoter.instanceId feeQuoter.ccipOwner deps.feeQuoter rmnRemote <- fetch rmnRemoteCid - RawInstanceAddress.assertEqual "router: rmn mismatch" + Chainlink.InstanceAddress.assertEqual "router: rmn mismatch" rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote let currentSeqNum = fromOptional 0.0 (Map.lookup destinationChainSelector outboundSequenceNumbers) - exercise onRampCid CCIP.OnRamp.PrepareSendFromRouter with + exercise onRampCid CCIP.RuntimeV1.OnRamp.PrepareSendFromRouter with destChainSelector = destinationChainSelector message = message @@ -412,40 +522,41 @@ template PerPartyRouter feeQuoterCid rmnRemoteCid currentSequenceNumber = currentSeqNum + context = context - nonconsuming choice FinalizeFee : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice FinalizeFee : ContractId CCIP.CoreV1.SendingMessage.SendingMessage with + sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage context : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 controller partyOwner do - onRampCid <- CCIP.OnRamp.lookupOnRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - feeQuoterCid <- CCIP.FeeQuoter.lookupFeeQuoterCid context + onRampCid : ContractId CCIP.RuntimeV1.OnRamp.OnRamp <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RuntimeV1.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey + feeQuoterCid : ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.FeeQuoter.feeQuoterContextKey onRamp <- fetch onRampCid - RawInstanceAddress.assertEqual "router: onramp mismatch" + Chainlink.InstanceAddress.assertEqual "router: onramp mismatch" onRamp.instanceId onRamp.ccipOwner deps.onRamp globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "router: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "router: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig feeQuoter <- fetch feeQuoterCid - RawInstanceAddress.assertEqual "router: feequoter mismatch" - feeQuoter.instanceId feeQuoter.owner deps.feeQuoter + Chainlink.InstanceAddress.assertEqual "router: feequoter mismatch" + feeQuoter.instanceId feeQuoter.ccipOwner deps.feeQuoter sendingMsg <- fetch sendingMessageCid - RawInstanceAddress.assertEqual "router instance mismatch" + Chainlink.InstanceAddress.assertEqual "router instance mismatch" instanceId partyOwner sendingMsg.deps.router - RawInstanceAddress.assertEqual "router: onramp sending message mismatch" + Chainlink.InstanceAddress.assertEqual "router: onramp sending message mismatch" onRamp.instanceId onRamp.ccipOwner sendingMsg.deps.onRamp assertMsg "router: feequoter sending message mismatch" (sendingMsg.deps.feeQuoter == deps.feeQuoter) assertMsg "router: globalconfig sending message mismatch" (sendingMsg.deps.globalConfig == deps.globalConfig) - smCid <- exercise onRampCid CCIP.OnRamp.FinalizeFeeFromRouter with + smCid <- exercise onRampCid CCIP.RuntimeV1.OnRamp.FinalizeFeeFromRouter with routerPartyOwner = partyOwner routerInstanceId = instanceId globalConfigCid = globalConfigCid @@ -454,8 +565,8 @@ template PerPartyRouter sm <- fetch smCid if isNone sm.expectedTokenInstrumentId - then exercise smCid CCIP.SendingMessageV1.BuildMessage with - caller = partyOwner + then exercise smCid CCIP.CoreV1.SendingMessage.BuildMessage with + context = context else pure smCid -- | Finalize a CCIP send. Collects total fee from sender, delegates to @@ -464,34 +575,34 @@ template PerPartyRouter -- authorization is needed for the sender-side Splice transfer. choice CCIPSend : CCIPSendResult with - context : Splice.Api.Token.MetadataV1.ChoiceContext - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage feeTokenHoldingCids : [ContractId Splice.Api.Token.HoldingV1.Holding] - feeTokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig + feeTokenConfigCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig feeTokenTransferFactory : ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory feeTokenExtraArgs : Splice.Api.Token.MetadataV1.ExtraArgs + context : Splice.Api.Token.MetadataV1.ChoiceContext controller partyOwner do - onRampCid <- CCIP.OnRamp.lookupOnRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupOptionalTokenConfigCid context - rmnRemoteCid <- CCIP.Context.lookupRmnRemoteCid context + onRampCid : ContractId CCIP.RuntimeV1.OnRamp.OnRamp <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RuntimeV1.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey + tokenAdminRegistryCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey + tokenConfigCid : Optional (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) <- CCIP.UtilsV1.Context.lookupFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenConfigContextKey + rmnRemoteCid : ContractId CCIP.CoreV1.RMNRemote.RMNRemote <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.RMNRemote.rmnRemoteContextKey onRamp <- fetch onRampCid - RawInstanceAddress.assertEqual "router: onramp mismatch" + Chainlink.InstanceAddress.assertEqual "router: onramp mismatch" onRamp.instanceId onRamp.ccipOwner deps.onRamp globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "router: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "router: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig tokenAdminRegistry <- fetch tokenAdminRegistryCid - RawInstanceAddress.assertEqual "router: tokenadminregistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + Chainlink.InstanceAddress.assertEqual "router: tokenadminregistry mismatch" + tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner deps.tokenAdminRegistry rmnRemote <- fetch rmnRemoteCid - RawInstanceAddress.assertEqual "router: rmn mismatch" + Chainlink.InstanceAddress.assertEqual "router: rmn mismatch" rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote sendingMsg <- fetch sendingMessageCid @@ -502,15 +613,17 @@ template PerPartyRouter (Map.lookup destChain outboundSequenceNumbers) totalFee <- exercise sendingMessageCid - CCIP.SendingMessageV1.FeeTokenAmount with + CCIP.CoreV1.SendingMessage.FeeTokenAmount with + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = partyOwner feeTokenConfig <- exercise tokenAdminRegistryCid - CCIP.TokenAdminRegistry.GetTokenConfigByCid with + CCIP.CoreV1.TokenAdminRegistry.GetTokenConfigByCid with tokenConfigCid = feeTokenConfigCid instrumentId = sendingMsg.feeToken + context = context caller = partyOwner - CCIP.TokenAdminRegistry.assertConfiguredTransferFactory + CCIP.CoreV1.TokenAdminRegistry.assertConfiguredTransferFactory "router" feeTokenConfig feeTokenTransferFactory @@ -646,7 +759,7 @@ template PerPartyRouter pure (userFeeChangeCids, pendingInstructions) else pure ([], []) - result <- exercise onRampCid CCIP.OnRamp.CCIPSendFromRouter with + result <- exercise onRampCid CCIP.RuntimeV1.OnRamp.CCIPSendFromRouter with routerPartyOwner = partyOwner routerInstanceId = instanceId currentSequenceNumber = currentSeqNum @@ -672,38 +785,38 @@ template PerPartyRouter -- | Prepare an inbound message for execution. -- Performs early replay check and delegates to OffRamp.PrepareExecute. -- TODO: consider relaxing to allow `controller caller` - nonconsuming choice PrepareExecute : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 + nonconsuming choice PrepareExecute : ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage with - context : Splice.Api.Token.MetadataV1.ChoiceContext encodedMessage : BytesHex receiverParty : Party tokenReceiverParty : Optional Party - receiverRequiredCCVs : [RawInstanceAddress.RawInstanceAddress] - receiverOptionalCCVs : [RawInstanceAddress.RawInstanceAddress] + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] receiverOptionalThreshold : Int - receiverFinalityConfig : CCIP.FinalityConfig.FinalityConfig + receiverFinalityConfig : CCIP.CodecV1.FinalityConfig.FinalityConfig + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller partyOwner do - offRampCid <- CCIP.OffRamp.lookupOffRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context - rmnRemoteCid <- CCIP.Context.lookupRmnRemoteCid context + offRampCid : ContractId CCIP.RuntimeV1.OffRamp.OffRamp <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RuntimeV1.OffRamp.offRampContextKey + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey + tokenAdminRegistryCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey + rmnRemoteCid : ContractId CCIP.CoreV1.RMNRemote.RMNRemote <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.RMNRemote.rmnRemoteContextKey offRamp <- fetch offRampCid - RawInstanceAddress.assertEqual "router: offramp mismatch" + Chainlink.InstanceAddress.assertEqual "router: offramp mismatch" offRamp.instanceId offRamp.ccipOwner deps.offRamp globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "router: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "router: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig tokenAdminRegistry <- fetch tokenAdminRegistryCid - RawInstanceAddress.assertEqual "router: tokenadminregistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + Chainlink.InstanceAddress.assertEqual "router: tokenadminregistry mismatch" + tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner deps.tokenAdminRegistry rmnRemote <- fetch rmnRemoteCid - RawInstanceAddress.assertEqual "router: rmn mismatch" + Chainlink.InstanceAddress.assertEqual "router: rmn mismatch" rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote -- Early replay check (informational; Execute is authoritative) @@ -714,7 +827,7 @@ template PerPartyRouter archivedExecutionContractIds if alreadyExecuted then abort "message already executed successfully" else pure () - exercise offRampCid CCIP.OffRamp.PrepareExecute with + exercise offRampCid CCIP.RuntimeV1.OffRamp.PrepareExecute with encodedMessage = encodedMessage globalConfigCid = globalConfigCid tokenAdminRegistryCid = tokenAdminRegistryCid @@ -731,33 +844,33 @@ template PerPartyRouter -- | Execute an inbound CCIP message. -- Parameters: -- context: The CCIP context for this message, retrieved from EDS. - -- executingMessageCid: The contract ID of the ExecutingMessageV1 that was created in PrepareExecute and is being executed. This is used to read the message data, CCV verifications, and pool verification state for the execute request. + -- executingMessageCid: The contract ID of the ExecutingMessage that was created in PrepareExecute and is being executed. This is used to read the message data, CCV verifications, and pool verification state for the execute request. choice Execute : ExecuteResult with + executingMessageCid : ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage context : Splice.Api.Token.MetadataV1.ChoiceContext - executingMessageCid : ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1 controller partyOwner do - offRampCid <- CCIP.OffRamp.lookupOffRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupOptionalTokenConfigCid context - rmnRemoteCid <- CCIP.Context.lookupRmnRemoteCid context + offRampCid : ContractId CCIP.RuntimeV1.OffRamp.OffRamp <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RuntimeV1.OffRamp.offRampContextKey + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey + tokenAdminRegistryCid : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey + tokenConfigCid : Optional (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) <- CCIP.UtilsV1.Context.lookupFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenConfigContextKey + rmnRemoteCid : ContractId CCIP.CoreV1.RMNRemote.RMNRemote <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.RMNRemote.rmnRemoteContextKey offRamp <- fetch offRampCid - RawInstanceAddress.assertEqual "router: offramp mismatch" + Chainlink.InstanceAddress.assertEqual "router: offramp mismatch" offRamp.instanceId offRamp.ccipOwner deps.offRamp globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "router: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "router: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig tokenAdminRegistry <- fetch tokenAdminRegistryCid - RawInstanceAddress.assertEqual "router: tokenadminregistry mismatch" - tokenAdminRegistry.instanceId tokenAdminRegistry.owner deps.tokenAdminRegistry + Chainlink.InstanceAddress.assertEqual "router: tokenadminregistry mismatch" + tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner deps.tokenAdminRegistry rmnRemote <- fetch rmnRemoteCid - RawInstanceAddress.assertEqual "router: rmn mismatch" + Chainlink.InstanceAddress.assertEqual "router: rmn mismatch" rmnRemote.instanceId rmnRemote.rmnOwner deps.rmnRemote execMsg <- fetch executingMessageCid @@ -770,7 +883,7 @@ template PerPartyRouter if alreadyExecuted then abort "message already executed successfully" else pure () - result <- exercise offRampCid CCIP.OffRamp.ExecuteFromRouter with + result <- exercise offRampCid CCIP.RuntimeV1.OffRamp.ExecuteFromRouter with routerPartyOwner = partyOwner executingMessageCid = executingMessageCid rmnRemoteCid = rmnRemoteCid @@ -800,11 +913,12 @@ template PerPartyRouter executionStateChanged = result.executionStateChanged messageId = result.messageId message = result.message - state = CCIP.Internal.SUCCESS + state = CCIP.APIV1.ExecutingMessage.SUCCESS - nonconsuming choice GetExecutionState : CCIP.Internal.MessageExecutionState + nonconsuming choice GetExecutionState : CCIP.APIV1.ExecutingMessage.MessageExecutionState with messageHash : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -813,65 +927,66 @@ template PerPartyRouter executedMessages archivedExecutionContractIds pure $ if alreadyExecuted - then CCIP.Internal.SUCCESS - else CCIP.Internal.UNTOUCHED + then CCIP.APIV1.ExecutingMessage.SUCCESS + else CCIP.APIV1.ExecutingMessage.UNTOUCHED nonconsuming choice GetSequenceNumber : Numeric 0 with destChainSelector : Numeric 0 + context : Splice.Api.Token.MetadataV1.ChoiceContext controller partyOwner do pure (fromOptional 0.0 (Map.lookup destChainSelector outboundSequenceNumbers)) -- | Get all required CCV raw instance addresses for sending a message. - nonconsuming choice GetRequiredCCVsForSend : [RawInstanceAddress] + nonconsuming choice GetRequiredCCVsForSend : [Chainlink.InstanceAddress.RawInstanceAddress] with - context : Splice.Api.Token.MetadataV1.ChoiceContext destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage - poolReportedCCVs : [RawInstanceAddress] + message : CCIP.ClientV1.Canton2AnyMessage + poolReportedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + context : Splice.Api.Token.MetadataV1.ChoiceContext controller partyOwner do - onRampCid <- CCIP.OnRamp.lookupOnRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context + onRampCid : ContractId CCIP.RuntimeV1.OnRamp.OnRamp <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RuntimeV1.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey onRamp <- fetch onRampCid - RawInstanceAddress.assertEqual "router: onramp mismatch" + Chainlink.InstanceAddress.assertEqual "router: onramp mismatch" onRamp.instanceId onRamp.ccipOwner deps.onRamp globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "router: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "router: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig - exercise onRampCid CCIP.OnRamp.GetRequiredCCVsForSendFromRouter with + exercise onRampCid CCIP.RuntimeV1.OnRamp.GetRequiredCCVsForSendFromRouter with globalConfigCid = globalConfigCid destChainSelector = destChainSelector message = message poolReportedCCVs = poolReportedCCVs -- | Get all required CCV raw instance addresses for executing a message. - nonconsuming choice GetRequiredCCVsForExecute : [RawInstanceAddress] + nonconsuming choice GetRequiredCCVsForExecute : [Chainlink.InstanceAddress.RawInstanceAddress] with - context : Splice.Api.Token.MetadataV1.ChoiceContext - message : CCIP.MessageCodecV1.MessageV1 - receiverRequiredCCVs : [RawInstanceAddress] - receiverOptionalCCVs : [RawInstanceAddress] + message : CCIP.CodecV1.MessageCodecV1.MessageV1 + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] receiverOptionalThreshold : Int - tokenPoolRequiredCCVs : [RawInstanceAddress] + tokenPoolRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + context : Splice.Api.Token.MetadataV1.ChoiceContext controller partyOwner do - offRampCid <- CCIP.OffRamp.lookupOffRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context + offRampCid : ContractId CCIP.RuntimeV1.OffRamp.OffRamp <- CCIP.UtilsV1.Context.getFromContextU context CCIP.RuntimeV1.OffRamp.offRampContextKey + globalConfigCid : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey offRamp <- fetch offRampCid - RawInstanceAddress.assertEqual "router: offramp mismatch" + Chainlink.InstanceAddress.assertEqual "router: offramp mismatch" offRamp.instanceId offRamp.ccipOwner deps.offRamp globalConfig <- fetch globalConfigCid - RawInstanceAddress.assertEqual "router: globalconfig mismatch" + Chainlink.InstanceAddress.assertEqual "router: globalconfig mismatch" globalConfig.instanceId globalConfig.ccipOwner deps.globalConfig - exercise offRampCid CCIP.OffRamp.GetRequiredCCVsForExecuteFromRouter with + exercise offRampCid CCIP.RuntimeV1.OffRamp.GetRequiredCCVsForExecuteFromRouter with globalConfigCid = globalConfigCid message = message receiverRequiredCCVs = receiverRequiredCCVs @@ -923,7 +1038,7 @@ template PerPartyRouter data CCIPSendResult = CCIPSendResult with router : ContractId PerPartyRouter - ccipMessageSent : ContractId CCIP.Events.CCIPMessageSent + ccipMessageSent : ContractId CCIP.EventsV1.Events.CCIPMessageSent messageId : BytesHex feeChangeCids : [ContractId Splice.Api.Token.HoldingV1.Holding] pendingFeeInstructions : [ContractId Splice.Api.Token.TransferInstructionV1.TransferInstruction] @@ -932,9 +1047,9 @@ data CCIPSendResult = CCIPSendResult data ExecuteResult = ExecuteResult with router : ContractId PerPartyRouter - tokenReceiveTicket : Optional (ContractId CCIP.Tickets.TokenReceiveTicket) - executionStateChanged : ContractId CCIP.Events.ExecutionStateChanged + tokenReceiveTicket : Optional (ContractId CCIP.TicketsV1.TokenReceiveTicket) + executionStateChanged : ContractId CCIP.EventsV1.Events.ExecutionStateChanged messageId : BytesHex - message : CCIP.MessageCodecV1.MessageV1 - state : CCIP.Internal.MessageExecutionState + message : CCIP.CodecV1.MessageCodecV1.MessageV1 + state : CCIP.APIV1.ExecutingMessage.MessageExecutionState deriving (Eq, Show) diff --git a/contracts/ccip/runtime/daml/CCIP/PerPartyRouterCodecGen.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouterCodecGen.daml similarity index 93% rename from contracts/ccip/runtime/daml/CCIP/PerPartyRouterCodecGen.daml rename to contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouterCodecGen.daml index f129279d7..3ec9716c6 100644 --- a/contracts/ccip/runtime/daml/CCIP/PerPartyRouterCodecGen.daml +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouterCodecGen.daml @@ -1,10 +1,10 @@ -- AUTO-GENERATED by go-daml codegen. DO NOT EDIT. -module CCIP.PerPartyRouterCodecGen where +module CCIP.RuntimeV1.PerPartyRouterCodecGen where import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import CCIP.PerPartyRouterTypes (PerPartyRouterDeps(..), SetDepsParams(..), AddCustomObserversParams(..), RemoveCustomObserversParams(..)) +import CCIP.RuntimeV1.PerPartyRouterTypes (PerPartyRouterDeps(..), SetDepsParams(..), AddCustomObserversParams(..), RemoveCustomObserversParams(..)) import MCMS.Codec ( decodeOptional, @@ -13,7 +13,7 @@ import MCMS.Codec ( encodePartyList ) -import CCIP.Codec (decodeRawInstanceAddressAt, encodeRawInstanceAddress) +import CCIP.CodecV1 (decodeRawInstanceAddressAt, encodeRawInstanceAddress) -- =============================================== diff --git a/contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouterTypes.daml b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouterTypes.daml new file mode 100644 index 000000000..5c6732c44 --- /dev/null +++ b/contracts/ccip/runtime/daml/CCIP/RuntimeV1/PerPartyRouterTypes.daml @@ -0,0 +1,33 @@ +module CCIP.RuntimeV1.PerPartyRouterTypes where + +import qualified Chainlink.InstanceAddress + +data PerPartyRouterDeps = PerPartyRouterDeps + with + onRamp : Chainlink.InstanceAddress.RawInstanceAddress + offRamp : Chainlink.InstanceAddress.RawInstanceAddress + globalConfig : Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Chainlink.InstanceAddress.RawInstanceAddress + deriving (Eq, Show) + +data SetDepsParams = SetDepsParams + with + onRamp : Optional Chainlink.InstanceAddress.RawInstanceAddress + offRamp : Optional Chainlink.InstanceAddress.RawInstanceAddress + globalConfig : Optional Chainlink.InstanceAddress.RawInstanceAddress + tokenAdminRegistry : Optional Chainlink.InstanceAddress.RawInstanceAddress + feeQuoter : Optional Chainlink.InstanceAddress.RawInstanceAddress + rmnRemote : Optional Chainlink.InstanceAddress.RawInstanceAddress + deriving (Eq, Show) + +data AddCustomObserversParams = AddCustomObserversParams + with + parties : [Party] + deriving (Eq, Show) + +data RemoveCustomObserversParams = RemoveCustomObserversParams + with + parties : [Party] + deriving (Eq, Show) diff --git a/contracts/ccip/sender/daml.yaml b/contracts/ccip/sender/daml.yaml index 39523303c..d148f1c44 100644 --- a/contracts/ccip/sender/daml.yaml +++ b/contracts/ccip/sender/daml.yaml @@ -10,11 +10,13 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar + - ../client-api/.daml/dist/ccip-client-api-2.0.0.dar + - ../utils/.daml/dist/ccip-utils-2.0.0.dar dependencies: - daml-prim - daml-stdlib - - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar - - ../core/.daml/dist/ccip-core-2.0.0.dar - - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar - - ../runtime/.daml/dist/ccip-runtime-2.0.0.dar diff --git a/contracts/ccip/sender/daml/CCIP/CCIPSender.daml b/contracts/ccip/sender/daml/CCIP/CCIPSender.daml index 4213f150a..e7dff15d7 100644 --- a/contracts/ccip/sender/daml/CCIP/CCIPSender.daml +++ b/contracts/ccip/sender/daml/CCIP/CCIPSender.daml @@ -12,34 +12,34 @@ import qualified Splice.Api.Token.HoldingV1 import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 -import qualified CCIP.Client -import qualified CCIP.Context -import qualified CCIP.FeeQuoter -import qualified CCIP.FinalityConfig -import qualified CCIP.GlobalConfig -import qualified CCIP.Math -import CCIP.Interfaces.CrossChainVerifier qualified as ICCV -import qualified CCIP.Interfaces.Executor -import qualified CCIP.Interfaces.TokenPool -import qualified CCIP.PerPartyRouter -import qualified CCIP.TokenAdminRegistry -import qualified CCIP.Uint256 - -import Chainlink.InstanceAddress (assertValidInstanceId) -import Chainlink.InstanceAddress qualified as RawInstanceAddress +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.GlobalConfig +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.Math +import qualified CCIP.CodecV1.Uint256 +import qualified CCIP.ClientV1 +import qualified CCIP.InterfacesV1.CrossChainVerifier +import qualified CCIP.InterfacesV1.Executor +import qualified CCIP.InterfacesV1.TokenPool +import qualified CCIP.UtilsV1.Context + data CCVSendInput = CCVSendInput with -- Used to match this CCV to its verifier args in the client-provided CCVExtraArgs. - ccvAddress : RawInstanceAddress.RawInstanceAddress - ccvCid : ContractId ICCV.ICrossChainVerifier - ccvExtraContext : Splice.Api.Token.MetadataV1.ChoiceContext + ccvAddress : Chainlink.InstanceAddress.RawInstanceAddress + ccvCid : ContractId CCIP.InterfacesV1.CrossChainVerifier.ICrossChainVerifier + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) data FeeTokenInput = FeeTokenInput with senderInputCids : [ContractId Splice.Api.Token.HoldingV1.Holding] - feeTokenConfigCid : ContractId CCIP.TokenAdminRegistry.TokenConfig + feeTokenConfigCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenConfig feeTokenTransferFactory : ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory feeTokenExtraArgs : Splice.Api.Token.MetadataV1.ExtraArgs deriving (Eq, Show) @@ -47,14 +47,14 @@ data FeeTokenInput = FeeTokenInput data TokenTransferInput = TokenTransferInput with senderInputCids : [ContractId Splice.Api.Token.HoldingV1.Holding] - tokenPoolCid : ContractId CCIP.Interfaces.TokenPool.ITokenPool - poolExtraContext : Splice.Api.Token.MetadataV1.ChoiceContext + tokenPoolCid : ContractId CCIP.InterfacesV1.TokenPool.ITokenPool + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) data ExecutorInput = ExecutorInput with - executorCid : ContractId CCIP.Interfaces.Executor.IExecutor - executorExtraContext : Splice.Api.Token.MetadataV1.ChoiceContext + executorCid : ContractId CCIP.InterfacesV1.Executor.IExecutor + context : Splice.Api.Token.MetadataV1.ChoiceContext deriving (Eq, Show) data GetFeeResult = GetFeeResult @@ -67,8 +67,8 @@ data GetFeeResult = GetFeeResult deriving (Eq, Show) lookupVerifierArgs - : [CCIP.Client.CCVExtraArg] - -> RawInstanceAddress.RawInstanceAddress + : [CCIP.ClientV1.CCVExtraArg] + -> Chainlink.InstanceAddress.RawInstanceAddress -> Update BytesHex lookupVerifierArgs ccvExtraArgs ccvAddress = case filter (\arg -> arg.ccvAddress == ccvAddress) ccvExtraArgs of @@ -77,8 +77,8 @@ lookupVerifierArgs ccvExtraArgs ccvAddress = _ -> abort "sender: duplicate verifier args for CCV" assertExactCCVSet - : [RawInstanceAddress.RawInstanceAddress] - -> [RawInstanceAddress.RawInstanceAddress] + : [Chainlink.InstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] -> Update () assertExactCCVSet requiredCCVs providedCCVs = do assertMsg "sender: GetFee required CCVs cannot contain duplicates" @@ -91,11 +91,11 @@ assertExactCCVSet requiredCCVs providedCCVs = do (all ((`elem` requiredCCVs)) providedCCVs) validateCCVFeeQuote - : RawInstanceAddress.RawInstanceAddress - -> ICCV.CrossChainVerifierFeeQuote + : Chainlink.InstanceAddress.RawInstanceAddress + -> CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote -> Update () validateCCVFeeQuote expectedCCV quote = - RawInstanceAddress.assertEqual + Chainlink.InstanceAddress.assertEqual "sender: GetFee CCV quote address mismatch" quote.ccvInstanceId quote.ccvOwner @@ -107,19 +107,19 @@ template CCIPSender owner : Party where signatory owner - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId - nonconsuming choice GetRequiredCCVs : [RawInstanceAddress.RawInstanceAddress] + nonconsuming choice GetRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] with destinationChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage + message : CCIP.ClientV1.Canton2AnyMessage + routerCid : ContractId CCIP.ClientV1.PerPartyRouter + tokenPoolCid : Optional (ContractId CCIP.InterfacesV1.TokenPool.ITokenPool) context : Splice.Api.Token.MetadataV1.ChoiceContext - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter - tokenPoolCid : Optional (ContractId CCIP.Interfaces.TokenPool.ITokenPool) controller owner do extraArgs <- case message.extraArgs of - CCIP.Client.V3 v3 -> pure v3 + CCIP.ClientV1.V3 v3 -> pure v3 _ -> abort "sender: unsupported extraArgs version" poolReportedCCVs <- case (message.tokenTransfer, tokenPoolCid) of (None, None) -> pure [] @@ -130,17 +130,18 @@ template CCIPSender (Some tt, Some tokenPoolCid) -> do let sourceAmount = fromSomeNote "sender: token amount does not fit uint256" - (CCIP.Uint256.numeric0ToUint256Bytes (CCIP.Math.decimalToNumeric0 tt.amount)) + (CCIP.CodecV1.Uint256.numeric0ToUint256Bytes (CCIP.CodecV1.Math.decimalToNumeric0 tt.amount)) exercise tokenPoolCid - CCIP.Interfaces.TokenPool.TokenPool_GetRequiredCCVs with + CCIP.InterfacesV1.TokenPool.TokenPool_GetRequiredCCVs with remoteChainSelector = destinationChainSelector sourceAmount = sourceAmount - finality = CCIP.FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityFlag extraData = extraArgs.tokenArgs - direction = CCIP.Interfaces.TokenPool.Outbound + direction = CCIP.InterfacesV1.TokenPool.Outbound + context = context caller = owner - exercise routerCid CCIP.PerPartyRouter.GetRequiredCCVsForSend with + exercise routerCid CCIP.ClientV1.PerPartyRouter_GetRequiredCCVsForSend with context = context destChainSelector = destinationChainSelector message = message @@ -149,21 +150,22 @@ template CCIPSender nonconsuming choice GetFee : GetFeeResult with destinationChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage - context : Splice.Api.Token.MetadataV1.ChoiceContext - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter + message : CCIP.ClientV1.Canton2AnyMessage + routerCid : ContractId CCIP.ClientV1.PerPartyRouter ccvSendInputs : [CCVSendInput] tokenTransferInput : Optional TokenTransferInput executorInput : Optional ExecutorInput + context : Splice.Api.Token.MetadataV1.ChoiceContext controller owner do - feeQuoterCid <- CCIP.FeeQuoter.lookupFeeQuoterCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context + feeQuoterCid : ContractId CCIP.APIV1.FeeQuoter.IFeeQuoter <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.FeeQuoter.feeQuoterContextKey + globalConfigCid : ContractId CCIP.APIV1.GlobalConfig.IGlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey extraArgs <- case message.extraArgs of - CCIP.Client.V3 v3 -> pure v3 + CCIP.ClientV1.V3 v3 -> pure v3 destConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetDestChainConfig with + CCIP.APIV1.GlobalConfig.GlobalConfig_GetDestChainConfig with destChainSelector = destinationChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner destConfig <- case destConfigOpt of None -> abort "sender: unknown destination chain" @@ -181,8 +183,9 @@ template CCIPSender assertExactCCVSet requiredCCVs providedCCVs quotedCCVFees <- foldlA (\fees input -> do - q <- exercise input.ccvCid ICCV.CrossChainVerifier_GetFee with + q <- exercise input.ccvCid CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifier_GetFee with destChainSelector = destinationChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner validateCCVFeeQuote input.ccvAddress q pure (fees ++ [q]) @@ -195,18 +198,19 @@ template CCIPSender (Some _, None) -> abort "sender: tokenTransferInput required for token transfer" (Some tt, Some tokenTransferInput) -> do - q <- exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_GetFee with + q <- exercise tokenTransferInput.tokenPoolCid CCIP.InterfacesV1.TokenPool.TokenPool_GetFee with feeQuoterCid = feeQuoterCid destChainSelector = destinationChainSelector tokenInstrumentId = tt.token + context = tokenTransferInput.context caller = owner pure (Some q, q.tokenFeeBps) executorFeeQuote <- case extraArgs.executor of - CCIP.Client.Executor_NoExecutor -> do + CCIP.ClientV1.Executor_NoExecutor -> do assertMsg "sender: executorInput not allowed for no-executor mode" (isNone executorInput) pure None - CCIP.Client.Executor_UseDefault _executorArgs -> + CCIP.ClientV1.Executor_UseDefault _executorArgs -> case destConfig.defaultExecutor of None -> do assertMsg "sender: executorInput not allowed when no default executor is configured" @@ -215,28 +219,30 @@ template CCIPSender Some expectedExecutor -> case executorInput of None -> abort "sender: executorInput required for default executor mode" Some executorInput -> do - q <- exercise executorInput.executorCid CCIP.Interfaces.Executor.Executor_GetFee with + q <- exercise executorInput.executorCid CCIP.InterfacesV1.Executor.Executor_GetFee with expectedExecutor = expectedExecutor destChainSelector = destinationChainSelector requiredCCVs = requiredCCVs + context = executorInput.context caller = owner - RawInstanceAddress.assertEqual "sender: executor fee quote executor mismatch" + Chainlink.InstanceAddress.assertEqual "sender: executor fee quote executor mismatch" q.executorInstanceId q.executorOwner expectedExecutor pure (Some q) - CCIP.Client.Executor_WithAddress expectedExecutor _executorArgs -> + CCIP.ClientV1.Executor_WithAddress expectedExecutor _executorArgs -> case executorInput of None -> abort "sender: executorInput required for explicit executor mode" Some executorInput -> do - q <- exercise executorInput.executorCid CCIP.Interfaces.Executor.Executor_GetFee with + q <- exercise executorInput.executorCid CCIP.InterfacesV1.Executor.Executor_GetFee with expectedExecutor = expectedExecutor destChainSelector = destinationChainSelector requiredCCVs = requiredCCVs + context = executorInput.context caller = owner - RawInstanceAddress.assertEqual "sender: executor fee quote executor mismatch" + Chainlink.InstanceAddress.assertEqual "sender: executor fee quote executor mismatch" q.executorInstanceId q.executorOwner expectedExecutor pure (Some q) - quote <- exercise routerCid CCIP.PerPartyRouter.GetFee with + quote <- exercise routerCid CCIP.ClientV1.PerPartyRouter_GetFee with context = context destChainSelector = destinationChainSelector message = message @@ -247,45 +253,46 @@ template CCIPSender let poolFeeTokenAmount = case message.tokenTransfer of None -> 0.0 Some tt -> - let amountN0 = CCIP.Math.decimalToNumeric0 tt.amount - feeN0 = CCIP.Math.mulDivDown amountN0 poolFeeBps 10000.0 - in CCIP.Math.numeric0ToDecimal feeN0 + let amountN0 = CCIP.CodecV1.Math.decimalToNumeric0 tt.amount + feeN0 = CCIP.CodecV1.Math.mulDivDown amountN0 poolFeeBps 10000.0 + in CCIP.CodecV1.Math.numeric0ToDecimal feeN0 pure GetFeeResult with - feeTokenAmount = CCIP.Math.numeric0ToDecimal quote.feeTokenAmount + feeTokenAmount = CCIP.CodecV1.Math.numeric0ToDecimal quote.feeTokenAmount poolFeeTokenAmount = poolFeeTokenAmount - nonconsuming choice Send : CCIP.PerPartyRouter.CCIPSendResult + nonconsuming choice Send : CCIP.ClientV1.CCIPSendResult with destinationChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage - context : Splice.Api.Token.MetadataV1.ChoiceContext - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter + message : CCIP.ClientV1.Canton2AnyMessage + routerCid : ContractId CCIP.ClientV1.PerPartyRouter feeTokenInput : FeeTokenInput ccvSendInputs : [CCVSendInput] tokenTransferInput : Optional TokenTransferInput executorInput : Optional ExecutorInput + context : Splice.Api.Token.MetadataV1.ChoiceContext controller owner do - feeQuoterCid <- CCIP.FeeQuoter.lookupFeeQuoterCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - rmnRemoteCid <- CCIP.Context.lookupRmnRemoteCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context + feeQuoterCid : ContractId CCIP.APIV1.FeeQuoter.IFeeQuoter <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.FeeQuoter.feeQuoterContextKey + globalConfigCid : ContractId CCIP.APIV1.GlobalConfig.IGlobalConfig <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.GlobalConfig.globalConfigContextKey + rmnRemoteCid : ContractId CCIP.APIV1.RMNRemote.IRMNRemote <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.RMNRemote.rmnRemoteContextKey + tokenAdminRegistryCid : ContractId CCIP.APIV1.TokenAdminRegistry.ITokenAdminRegistry <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey extraArgs <- case message.extraArgs of - CCIP.Client.V3 v3 -> pure v3 + CCIP.ClientV1.V3 v3 -> pure v3 destConfigOpt <- exercise globalConfigCid - CCIP.GlobalConfig.GetDestChainConfig with + CCIP.APIV1.GlobalConfig.GlobalConfig_GetDestChainConfig with destChainSelector = destinationChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner destConfig <- case destConfigOpt of None -> abort "sender: unknown destination chain" Some cfg -> pure cfg - smCid <- exercise routerCid CCIP.PerPartyRouter.PrepareSend with - destinationChainSelector = destinationChainSelector - message = message - context + smCid <- exercise routerCid CCIP.ClientV1.PerPartyRouter_PrepareSend with + destinationChainSelector = destinationChainSelector + message = message + context = context smCid <- case message.tokenTransfer of None -> do @@ -295,20 +302,20 @@ template CCIPSender Some tt -> case tokenTransferInput of None -> abort "sender: tokenTransferInput required for token transfer" Some tokenTransferInput -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context - exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_VerifyOutboundCCVs with + tokenConfigCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenConfigContextKey + exercise tokenTransferInput.tokenPoolCid CCIP.InterfacesV1.TokenPool.TokenPool_VerifyOutboundCCVs with tokenAdminRegistryCid = tokenAdminRegistryCid tokenConfigCid = tokenConfigCid - extraContext = tokenTransferInput.poolExtraContext + context = tokenTransferInput.context sendingMessageCid = smCid amount = tt.amount caller = owner - smCid <- foldlA (\cid input -> + smCid <- foldlA (\cid input -> do exercise input.ccvCid - ICCV.CrossChainVerifier_CalculateFee with + CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifier_CalculateFee with sendingMessageCid = cid - extraContext = input.ccvExtraContext + context = input.context caller = owner ) smCid ccvSendInputs @@ -319,22 +326,22 @@ template CCIPSender (Some _, None) -> abort "sender: tokenTransferInput required for token transfer" (Some tt, Some tokenTransferInput) -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context - exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_CalculateFee with + tokenConfigCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenConfigContextKey + exercise tokenTransferInput.tokenPoolCid CCIP.InterfacesV1.TokenPool.TokenPool_CalculateFee with tokenAdminRegistryCid = tokenAdminRegistryCid tokenConfigCid = tokenConfigCid - extraContext = tokenTransferInput.poolExtraContext + context = tokenTransferInput.context sendingMessageCid = smCid feeQuoterCid = feeQuoterCid tokenInstrumentId = tt.token caller = owner smCid <- case extraArgs.executor of - CCIP.Client.Executor_NoExecutor -> do + CCIP.ClientV1.Executor_NoExecutor -> do assertMsg "sender: executorInput not allowed for no-executor mode" (isNone executorInput) pure smCid - CCIP.Client.Executor_UseDefault executorArgs -> + CCIP.ClientV1.Executor_UseDefault executorArgs -> case destConfig.defaultExecutor of None -> do assertMsg "sender: executorInput not allowed when no default executor is configured" @@ -343,27 +350,27 @@ template CCIPSender Some expectedExecutor -> case executorInput of None -> abort "sender: executorInput required for default executor mode" - Some executorInput -> + Some executorInput -> do exercise executorInput.executorCid - CCIP.Interfaces.Executor.Executor_CalculateFee with + CCIP.InterfacesV1.Executor.Executor_CalculateFee with expectedExecutor = expectedExecutor sendingMessageCid = smCid executorArgs = executorArgs - extraContext = executorInput.executorExtraContext + context = executorInput.context caller = owner - CCIP.Client.Executor_WithAddress expectedExecutor executorArgs -> + CCIP.ClientV1.Executor_WithAddress expectedExecutor executorArgs -> case executorInput of None -> abort "sender: executorInput required for explicit executor mode" - Some executorInput -> + Some executorInput -> do exercise executorInput.executorCid - CCIP.Interfaces.Executor.Executor_CalculateFee with + CCIP.InterfacesV1.Executor.Executor_CalculateFee with expectedExecutor = expectedExecutor sendingMessageCid = smCid executorArgs = executorArgs - extraContext = executorInput.executorExtraContext + context = executorInput.context caller = owner - smCid <- exercise routerCid CCIP.PerPartyRouter.FinalizeFee with + smCid <- exercise routerCid CCIP.ClientV1.PerPartyRouter_FinalizeFee with context sendingMessageCid = smCid @@ -374,30 +381,30 @@ template CCIPSender (Some _, None) -> abort "sender: tokenTransferInput required for token transfer" (Some tt, Some tokenTransferInput) -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context - lockResult <- exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_LockOrBurn with + tokenConfigCid <- CCIP.UtilsV1.Context.getFromContextU context CCIP.APIV1.TokenAdminRegistry.tokenConfigContextKey + lockResult <- exercise tokenTransferInput.tokenPoolCid CCIP.InterfacesV1.TokenPool.TokenPool_LockOrBurn with tokenAdminRegistryCid = tokenAdminRegistryCid tokenConfigCid = tokenConfigCid rmnRemoteCid = rmnRemoteCid - extraContext = tokenTransferInput.poolExtraContext + context = tokenTransferInput.context sendingMessageCid = smCid senderInputCids = tokenTransferInput.senderInputCids amount = tt.amount caller = owner - pure lockResult.sendingMessageCid + pure (lockResult.sendingMessageCid) smCid <- foldlA (\cid input -> do - verifierArgs <- lookupVerifierArgs extraArgs.ccvs input.ccvAddress - exercise input.ccvCid - ICCV.CrossChainVerifier_ForwardToVerifier with - rmnRemoteCid = rmnRemoteCid - extraContext = input.ccvExtraContext - sendingMessageCid = cid - verifierArgs = verifierArgs - caller = owner - ) smCid ccvSendInputs + verifierArgs <- lookupVerifierArgs extraArgs.ccvs input.ccvAddress + exercise input.ccvCid + CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifier_ForwardToVerifier with + rmnRemoteCid = rmnRemoteCid + context = input.context + sendingMessageCid = cid + verifierArgs = verifierArgs + caller = owner + ) (smCid) ccvSendInputs - exercise routerCid CCIP.PerPartyRouter.CCIPSend with + exercise routerCid CCIP.ClientV1.PerPartyRouter_CCIPSend with context sendingMessageCid = smCid feeTokenHoldingCids = feeTokenInput.senderInputCids diff --git a/contracts/ccip/test/daml.yaml b/contracts/ccip/test/daml.yaml index 46cc6c25c..1b23f6000 100644 --- a/contracts/ccip/test/daml.yaml +++ b/contracts/ccip/test/daml.yaml @@ -11,6 +11,13 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar + - ../tickets/.daml/dist/ccip-tickets-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../utils/.daml/dist/ccip-utils-2.0.0.dar + - ../events/.daml/dist/ccip-events-2.0.0.dar + - ../rate-limiter/.daml/dist/ccip-rate-limiter-2.0.0.dar + - ../client-api/.daml/dist/ccip-client-api-2.0.0.dar dependencies: - daml-prim - daml-stdlib diff --git a/contracts/ccip/test/daml/BurnMintTokenPoolTest.daml b/contracts/ccip/test/daml/BurnMintTokenPoolTest.daml index f95f376cf..88dc02297 100644 --- a/contracts/ccip/test/daml/BurnMintTokenPoolTest.daml +++ b/contracts/ccip/test/daml/BurnMintTokenPoolTest.daml @@ -7,78 +7,82 @@ import DA.Map qualified as Map import DA.Optional (fromSome, fromSomeNote, isSome) import DA.TextMap qualified as TextMap -import qualified CCIP.Context -import CCIP.BurnMintTokenPool qualified as BurnMintTokenPool -import CCIP.ExecutingMessageV1 qualified as ExecutingMessageV1 -import CCIP.FinalityConfig qualified as FinalityConfig -import CCIP.Interfaces.TokenPool qualified as ITokenPool -import CCIP.MessageCodecV1 qualified as MessageCodecV1 -import CCIP.RMNRemote qualified as RMNRemote -import CCIP.RateLimiter qualified as RateLimiter -import CCIP.SendingMessageV1 qualified as SendingMessageV1 -import CCIP.Tickets qualified as Tickets -import CCIP.TokenAdminRegistry qualified as TokenAdminRegistry -import CCIP.TokenAdminRegistryTypes qualified as TokenAdminRegistryTypes -import CCIP.Uint256 qualified as Uint256 -import Link.Token qualified as Link -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import Splice.Api.Token.BurnMintV1 qualified as BurnMintV1 -import Splice.Api.Token.HoldingV1 qualified as HoldingV1 -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 -import TestToken qualified - -emptyExtraArgs : MetadataV1.ExtraArgs -emptyExtraArgs = MetadataV1.ExtraArgs with - context = MetadataV1.emptyChoiceContext - meta = MetadataV1.emptyMetadata +import Splice.Api.Token.BurnMintV1 +import Splice.Api.Token.HoldingV1 +import Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.BurnMintTokenPoolV1 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CodecV1.Uint256 +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.SendingMessage +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.EventsV1.Events +import qualified CCIP.InterfacesV1.TokenPool +import qualified CCIP.RateLimiterV1 +import qualified CCIP.TicketsV1 +import qualified CCIP.UtilsV1.Context + +import qualified Link.Token + +import qualified TestToken + +emptyExtraArgs : Splice.Api.Token.MetadataV1.ExtraArgs +emptyExtraArgs = Splice.Api.Token.MetadataV1.ExtraArgs with + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + meta = Splice.Api.Token.MetadataV1.emptyMetadata finalityConfig n = if n == 0 - then FinalityConfig.WaitForFinality - else FinalityConfig.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n rawFinalityConfig n = if n == 0 - then FinalityConfig.waitForFinalityFlag + then CCIP.CodecV1.FinalityConfig.waitForFinalityFlag else fromSome do - flagsHex <- MessageCodecV1.encodeUint16 0 - blockConfirmationsHex <- MessageCodecV1.encodeUint16 n + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 n pure (flagsHex <> blockConfirmationsHex) unsafeDecodeRequestedFinality fc = fromSomeNote "unsafeDecodeRequestedFinality: invalid finality config" - (FinalityConfig.decodeRequestedFinality fc) + (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality fc) messageFinality n = unsafeDecodeRequestedFinality (rawFinalityConfig n) -mkPoolContext : ContractId RateLimiter.RateLimiter -> ContractId BurnMintV1.BurnMintFactory -> MetadataV1.ChoiceContext -mkPoolContext rateLimiterCid burnMintFactoryCid = MetadataV1.ChoiceContext with +mkPoolContext : ContractId CCIP.RateLimiterV1.RateLimiter -> ContractId Splice.Api.Token.BurnMintV1.BurnMintFactory -> Splice.Api.Token.MetadataV1.ChoiceContext +mkPoolContext rateLimiterCid burnMintFactoryCid = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (RateLimiter.rateLimiterKey, CCIP.Context.toAnyValue rateLimiterCid) - , (BurnMintTokenPool.burnMintFactoryContextKey, CCIP.Context.toAnyValue burnMintFactoryCid) + [ (CCIP.RateLimiterV1.rateLimiterContextKey, CCIP.UtilsV1.Context.toAnyValue rateLimiterCid) + , (CCIP.BurnMintTokenPoolV1.burnMintFactoryContextKey, CCIP.UtilsV1.Context.toAnyValue burnMintFactoryCid) ] -mkPoolDeps : Text -> Text -> Text -> Party -> Party -> BurnMintTokenPool.BurnMintTokenPoolDeps +mkPoolDeps : Text -> Text -> Text -> Party -> Party -> CCIP.BurnMintTokenPoolV1.BurnMintTokenPoolDeps mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner = - BurnMintTokenPool.BurnMintTokenPoolDeps with - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner + CCIP.BurnMintTokenPoolV1.BurnMintTokenPoolDeps with + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner createRateLimiter : Party -> Text -> Text -> Numeric 0 - -> RateLimiter.RateLimitDirection - -> RateLimiter.RateLimitMode + -> CCIP.RateLimiterV1.RateLimitDirection + -> CCIP.RateLimiterV1.RateLimitMode -> Numeric 0 -> Numeric 0 - -> Script (ContractId RateLimiter.RateLimiter, RawInstanceAddress.RawInstanceAddress) + -> Script (ContractId CCIP.RateLimiterV1.RateLimiter, Chainlink.InstanceAddress.RawInstanceAddress) createRateLimiter poolOwner instanceId poolInstanceId remoteChainSelector direction mode capacity rate = do now <- getTime rateLimiterCid <- submit poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId poolInstanceId poolOwner @@ -90,77 +94,80 @@ createRateLimiter poolOwner instanceId poolInstanceId remoteChainSelector direct rate tokens = capacity lastUpdated = now - pure (rateLimiterCid, RawInstanceAddress.make instanceId poolOwner) + pure (rateLimiterCid, Chainlink.InstanceAddress.make instanceId poolOwner) setupTokenAdminRegistry : Party -> Party -> Text - -> HoldingV1.InstrumentId + -> Splice.Api.Token.HoldingV1.InstrumentId -> Text - -> Script (ContractId TokenAdminRegistry.TokenAdminRegistry, ContractId TokenAdminRegistry.TokenConfig) + -> Script (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry, ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId = do tokenAdminRegistry0 <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with - owner = ccipOwner + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with + ccipOwner = ccipOwner instanceId = tokenAdminRegistryInstanceId entryCount = 0 proposeResult <- submit ccipOwner do - exerciseCmd tokenAdminRegistry0 TokenAdminRegistry.ProposeAdministrator with + exerciseCmd tokenAdminRegistry0 CCIP.CoreV1.TokenAdminRegistry.ProposeAdministrator with tokenConfigCid = None instrumentId = instrumentId newAdmin = poolOwner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccipOwner let tokenAdminRegistry = proposeResult.tokenAdminRegistryCid tokenConfigCid0 = proposeResult.tokenConfigCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry tokenConfigCid1 <- submit (actAs poolOwner <> disclose disclosedTar) do - exerciseCmd tokenAdminRegistry TokenAdminRegistry.AcceptAdminRole with + exerciseCmd tokenAdminRegistry CCIP.CoreV1.TokenAdminRegistry.AcceptAdminRole with tokenConfigCid = tokenConfigCid0 instrumentId = instrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry tokenConfigCid2 <- submit (actAs poolOwner <> disclose disclosedTar) do - exerciseCmd tokenAdminRegistry TokenAdminRegistry.SetPool with + exerciseCmd tokenAdminRegistry CCIP.CoreV1.TokenAdminRegistry.SetPool with tokenConfigCid = tokenConfigCid1 instrumentId = instrumentId - tokenPool = Some TokenAdminRegistryTypes.PoolRegistration with + tokenPool = Some CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner = poolOwner poolInstanceId = tokenPoolInstanceId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner pure (tokenAdminRegistry, tokenConfigCid2) -createLinkRegistry : Party -> HoldingV1.InstrumentId -> Text -> Script (ContractId Link.LinkRegistry) +createLinkRegistry : Party -> Splice.Api.Token.HoldingV1.InstrumentId -> Text -> Script (ContractId Link.Token.LinkRegistry) createLinkRegistry admin instrumentId registryInstanceId = submit admin do - createCmd Link.LinkRegistry with + createCmd Link.Token.LinkRegistry with registryAdmin = admin registryInstrumentId = instrumentId instanceId = registryInstanceId - registryMeta = MetadataV1.emptyMetadata + registryMeta = Splice.Api.Token.MetadataV1.emptyMetadata mintLink : Party -> Party - -> ContractId Link.LinkRegistry - -> HoldingV1.InstrumentId + -> ContractId Link.Token.LinkRegistry + -> Splice.Api.Token.HoldingV1.InstrumentId -> Decimal - -> Script (ContractId HoldingV1.Holding) + -> Script (ContractId Splice.Api.Token.HoldingV1.Holding) mintLink admin owner registryCid instrumentId amount = do result <- submit (actAs admin <> actAs owner) do - exerciseCmd (toInterfaceContractId @BurnMintV1.BurnMintFactory registryCid) BurnMintV1.BurnMintFactory_BurnMint with + exerciseCmd (toInterfaceContractId @Splice.Api.Token.BurnMintV1.BurnMintFactory registryCid) Splice.Api.Token.BurnMintV1.BurnMintFactory_BurnMint with expectedAdmin = admin instrumentId inputHoldingCids = [] outputs = - [BurnMintV1.BurnMintOutput with + [Splice.Api.Token.BurnMintV1.BurnMintOutput with owner amount - context = MetadataV1.emptyChoiceContext] + context = Splice.Api.Token.MetadataV1.emptyChoiceContext] extraActors = if owner == admin then [] else [owner] extraArgs = emptyExtraArgs case result.outputCids of @@ -168,19 +175,19 @@ mintLink admin owner registryCid instrumentId amount = do _ -> abort "expected exactly one minted holding" mkRemoteChainConfig - : [RawInstanceAddress.RawInstanceAddress] - -> [RawInstanceAddress.RawInstanceAddress] - -> RawInstanceAddress.RawInstanceAddress - -> RawInstanceAddress.RawInstanceAddress - -> RawInstanceAddress.RawInstanceAddress - -> BurnMintTokenPool.RemoteChainConfig + : [Chainlink.InstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] + -> Chainlink.InstanceAddress.RawInstanceAddress + -> Chainlink.InstanceAddress.RawInstanceAddress + -> Chainlink.InstanceAddress.RawInstanceAddress + -> CCIP.BurnMintTokenPoolV1.RemoteChainConfig mkRemoteChainConfig inboundCCVs outboundCCVs inboundRateLimiter inboundCustomRateLimiter outboundRateLimiter = - BurnMintTokenPool.RemoteChainConfig with + CCIP.BurnMintTokenPoolV1.RemoteChainConfig with remotePools = ["1111111111111111111111111111111111111111"] remoteTokenAddress = "2222222222222222222222222222222222222222" inboundCCVs outboundCCVs - finalityConfig = FinalityConfig.WaitForFinality + finalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality inboundRateLimiter inboundCustomBlockConfirmationsRateLimiter = inboundCustomRateLimiter outboundRateLimiter @@ -193,30 +200,30 @@ mkSendingMessage -> Text -> Text -> Numeric 0 - -> HoldingV1.InstrumentId - -> Script (ContractId SendingMessageV1.SendingMessageV1) + -> Splice.Api.Token.HoldingV1.InstrumentId + -> Script (ContractId CCIP.CoreV1.SendingMessage.SendingMessage) mkSendingMessage ccipOwner sender rmnOwner rmnInstanceId tokenAdminRegistryInstanceId feeQuoterInstanceId destChainSelector instrumentId = submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router" sender - onRamp = RawInstanceAddress.make "test-onramp" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig" ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner destChainSelector destAddressBytesLength = 20 sequenceNumber = 1.0 destDefaultCCVs = [] requiredCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor" ccipOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor" ccipOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 - senderAddress = MessageCodecV1.encodePartyAddress sender + senderAddress = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender receiver = "0000000000000000000000000000000000000001" payload = "" executionGasLimit = 0 @@ -229,6 +236,7 @@ mkSendingMessage ccipOwner sender rmnOwner rmnInstanceId tokenAdminRegistryInsta feeToken = instrumentId networkFeeUSDCents = 0.0 expectedTokenInstrumentId = Some instrumentId + tokenAmountBeforeTokenPoolFees = 10.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -237,7 +245,7 @@ mkSendingMessage ccipOwner sender rmnOwner rmnInstanceId tokenAdminRegistryInsta executorFeeTokenAmount = 0.0 observingParties = [sender] ccvFees = [] - tokenSendFee = Some (SendingMessageV1.TokenSendFee with + tokenSendFee = Some (CCIP.CoreV1.SendingMessage.TokenSendFee with poolInstanceId = "burn-mint-pool" poolOwner = instrumentId.admin feeUSDCents = 0.0 @@ -252,7 +260,7 @@ mkSendingMessage ccipOwner sender rmnOwner rmnInstanceId tokenAdminRegistryInsta message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_FeeFinalized + state = CCIP.CoreV1.SendingMessage.SendingMessageState_FeeFinalized testBurnMintPoolLockOrBurnBurnsAndMintsOutputs : Script () testBurnMintPoolLockOrBurnBurnsAndMintsOutputs = script do @@ -267,7 +275,7 @@ testBurnMintPoolLockOrBurnBurnsAndMintsOutputs = script do let tokenPoolInstanceId = "burn-mint-pool" let registryInstanceId = "link-registry-bm-lock" let destChainSelector = 456.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" @@ -275,10 +283,11 @@ testBurnMintPoolLockOrBurnBurnsAndMintsOutputs = script do (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId disclosedTarForFactorySet <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistryCid tokenConfigCid <- submit (actAs poolOwner <> disclose disclosedTarForFactorySet) do - exerciseCmd tokenAdminRegistryCid TokenAdminRegistry.SetBurnMintFactory with + exerciseCmd tokenAdminRegistryCid CCIP.CoreV1.TokenAdminRegistry.SetBurnMintFactory with tokenConfigCid instrumentId burnMintFactory = Some (toInterfaceContractId registryCid) + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner badBurnMintFactoryCid <- submit poolOwner do createCmd TestToken.BadBurnMintFactory with @@ -286,7 +295,7 @@ testBurnMintPoolLockOrBurnBurnsAndMintsOutputs = script do outputs = [] rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -300,14 +309,14 @@ testBurnMintPoolLockOrBurnBurnsAndMintsOutputs = script do "rl-bm-lock-out" tokenPoolInstanceId destChainSelector - RateLimiter.RateLimitDirection_Outbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] outboundRateLimiterAddr outboundRateLimiterAddr outboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -316,14 +325,14 @@ testBurnMintPoolLockOrBurnBurnsAndMintsOutputs = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.fromList - [(destChainSelector, BurnMintTokenPool.TokenTransferFeeConfig with + [(destChainSelector, CCIP.BurnMintTokenPoolV1.TokenTransferFeeConfig with isEnabled = True destGasOverhead = 0 destBytesOverhead = 64 feeUSDCents = 0.0 feeBps = 500.0)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid @@ -334,23 +343,23 @@ testBurnMintPoolLockOrBurnBurnsAndMintsOutputs = script do disclosedBadBurnMintFactory <- fromSome <$> queryDisclosure poolOwner badBurnMintFactoryCid submitMustFail (actAs sender <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedBadBurnMintFactory) do - exerciseCmd tokenPoolCid BurnMintTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext outboundRateLimiterCid (toInterfaceContractId badBurnMintFactoryCid) - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext outboundRateLimiterCid (toInterfaceContractId badBurnMintFactoryCid) + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [senderHoldingCid] amount = 7.0 caller = sender result <- submit (actAs sender <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext outboundRateLimiterCid (toInterfaceContractId registryCid) - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = coerceContractId rmnRemoteCid + context = mkPoolContext outboundRateLimiterCid (toInterfaceContractId registryCid) + sendingMessageCid = coerceContractId sendingMessageCid senderInputCids = [senderHoldingCid] amount = 7.0 caller = sender @@ -358,18 +367,18 @@ testBurnMintPoolLockOrBurnBurnsAndMintsOutputs = script do let [senderChangeCid] = result.senderChangeCids let [poolFeeCid] = result.poolChangeCids - Some senderChangeHolding <- queryContractId sender (fromInterfaceContractId @Link.LinkHolding senderChangeCid) - Some poolFeeHolding <- queryContractId poolOwner (fromInterfaceContractId @Link.LinkHolding poolFeeCid) - None <- queryContractId sender (fromInterfaceContractId @Link.LinkHolding senderHoldingCid) - Some updatedSendingMessage <- queryContractId ccipOwner result.sendingMessageCid + Some senderChangeHolding <- queryContractId sender (fromInterfaceContractId @Link.Token.LinkHolding senderChangeCid) + Some poolFeeHolding <- queryContractId poolOwner (fromInterfaceContractId @Link.Token.LinkHolding poolFeeCid) + None <- queryContractId sender (fromInterfaceContractId @Link.Token.LinkHolding senderHoldingCid) + Some updatedSendingMessage <- queryContractId ccipOwner (coerceContractId result.sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) senderChangeHolding.holdingAmount === 3.0 poolFeeHolding.holdingAmount === 0.35 let tokenSendData = fromSomeNote "expected token send data" updatedSendingMessage.tokenSendData - tokenSendData.amount === fromSome (MessageCodecV1.encodeUint256 66500000000.0) + tokenSendData.amount === fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 66500000000.0) tokenSendData.instrumentId === instrumentId - rateLimiters <- query @RateLimiter.RateLimiter poolOwner + rateLimiters <- query @CCIP.RateLimiterV1.RateLimiter poolOwner let [(_, updatedOutboundRateLimiter)] = rateLimiters updatedOutboundRateLimiter.tokens === 33500000000.0 @@ -386,10 +395,10 @@ testBurnMintPoolLockOrBurnRejectsBadInputsAndOutputs = script do let tokenPoolInstanceId = "burn-mint-pool-bad-lock" let registryInstanceId = "link-registry-bm-bad-lock" let destChainSelector = 456.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" - let wrongInstrumentId = HoldingV1.InstrumentId with + let wrongInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "WRONG" @@ -397,7 +406,7 @@ testBurnMintPoolLockOrBurnRejectsBadInputsAndOutputs = script do (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -418,14 +427,14 @@ testBurnMintPoolLockOrBurnRejectsBadInputsAndOutputs = script do "rl-bm-bad-lock-out" tokenPoolInstanceId destChainSelector - RateLimiter.RateLimitDirection_Outbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] outboundRateLimiterAddr outboundRateLimiterAddr outboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -434,14 +443,14 @@ testBurnMintPoolLockOrBurnRejectsBadInputsAndOutputs = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.fromList - [(destChainSelector, BurnMintTokenPool.TokenTransferFeeConfig with + [(destChainSelector, CCIP.BurnMintTokenPoolV1.TokenTransferFeeConfig with isEnabled = True destGasOverhead = 0 destBytesOverhead = 64 feeUSDCents = 0.0 feeBps = 500.0)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner badPoolFeeInstrumentFactoryCid <- submit poolOwner do @@ -485,34 +494,34 @@ testBurnMintPoolLockOrBurnRejectsBadInputsAndOutputs = script do disclosedBadExtraOutputFactory <- fromSome <$> queryDisclosure poolOwner badExtraOutputFactoryCid submitMustFail (actAs sender <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext outboundRateLimiterCid (toInterfaceContractId registryCid) - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext outboundRateLimiterCid (toInterfaceContractId registryCid) + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [toInterfaceContractId wrongInstrumentInputCid] amount = 7.0 caller = sender submitMustFail (actAs sender <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedBadPoolFeeInstrumentFactory) do - exerciseCmd tokenPoolCid BurnMintTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext outboundRateLimiterCid (toInterfaceContractId badPoolFeeInstrumentFactoryCid) - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext outboundRateLimiterCid (toInterfaceContractId badPoolFeeInstrumentFactoryCid) + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [senderHoldingCid] amount = 7.0 caller = sender submitMustFail (actAs sender <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedBadExtraOutputFactory) do - exerciseCmd tokenPoolCid BurnMintTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext outboundRateLimiterCid (toInterfaceContractId badExtraOutputFactoryCid) - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext outboundRateLimiterCid (toInterfaceContractId badExtraOutputFactoryCid) + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [senderHoldingCid] amount = 7.0 caller = sender @@ -530,7 +539,7 @@ testBurnMintPoolReleaseFromTicketMintsReceiver = script do let tokenPoolInstanceId = "burn-mint-pool-release" let registryInstanceId = "link-registry-bm-release" let sourceChainSelector = 123.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" @@ -538,7 +547,7 @@ testBurnMintPoolReleaseFromTicketMintsReceiver = script do (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -550,14 +559,14 @@ testBurnMintPoolReleaseFromTicketMintsReceiver = script do "rl-bm-release-in" tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr inboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -566,27 +575,28 @@ testBurnMintPoolReleaseFromTicketMintsReceiver = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner tokenReceiveTicketCid <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistryCid @@ -596,18 +606,18 @@ testBurnMintPoolReleaseFromTicketMintsReceiver = script do disclosedRegistry <- fromSome <$> queryDisclosure poolOwner registryCid result <- submit (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver case result.output of - ITokenPool.ReleaseOrMintResult_Completed receiverHoldingCids -> do + CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed receiverHoldingCids -> do [receiverHoldingCid] <- pure receiverHoldingCids - Some receiverHolding <- queryContractId receiver (fromInterfaceContractId @Link.LinkHolding receiverHoldingCid) + Some receiverHolding <- queryContractId receiver (fromInterfaceContractId @Link.Token.LinkHolding receiverHoldingCid) receiverHolding.holdingAmount === 3.0 _ -> abort "expected completed release result" @@ -624,17 +634,17 @@ testBurnMintPoolReleaseFromTicketRejectsBadMintOutputs = script do let feeQuoterInstanceId = "fq-bm-bad-mint" let tokenPoolInstanceId = "burn-mint-pool-bad-mint" let sourceChainSelector = 123.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" - let wrongInstrumentId = HoldingV1.InstrumentId with + let wrongInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "WRONG" (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -646,14 +656,14 @@ testBurnMintPoolReleaseFromTicketRejectsBadMintOutputs = script do "rl-bm-bad-mint-in" tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr inboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -662,8 +672,8 @@ testBurnMintPoolReleaseFromTicketRejectsBadMintOutputs = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner badWrongInstrumentFactoryCid <- submit poolOwner do @@ -713,22 +723,23 @@ testBurnMintPoolReleaseFromTicketRejectsBadMintOutputs = script do outputs = [] tokenReceiveTicketCid <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistryCid @@ -742,48 +753,48 @@ testBurnMintPoolReleaseFromTicketRejectsBadMintOutputs = script do disclosedBadNoOutputFactory <- fromSome <$> queryDisclosure poolOwner badNoOutputFactoryCid submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedBadWrongInstrumentFactory) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badWrongInstrumentFactoryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badWrongInstrumentFactoryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedBadWrongOwnerFactory) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badWrongOwnerFactoryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badWrongOwnerFactoryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedBadWrongAmountFactory) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badWrongAmountFactoryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badWrongAmountFactoryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedBadExtraOutputFactory) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badExtraOutputFactoryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badExtraOutputFactoryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedBadNoOutputFactory) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badNoOutputFactoryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId badNoOutputFactoryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver -- Release must accept raw uint256 source amounts above Canton's Numeric 0 range @@ -801,7 +812,7 @@ testBurnMintPoolReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = scrip let tokenPoolInstanceId = "burn-mint-pool-release-raw-uint256" let registryInstanceId = "link-registry-bm-release-raw-uint256" let sourceChainSelector = 123.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" @@ -809,7 +820,7 @@ testBurnMintPoolReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = scrip (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -821,14 +832,14 @@ testBurnMintPoolReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = scrip "rl-bm-release-raw-uint256-in" tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr inboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -837,28 +848,29 @@ testBurnMintPoolReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = scrip rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner - let sourceAmount = fromSome (Uint256.decimalTextToUint256Bytes "100000000000000000000000000000000000000") + let sourceAmount = fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "100000000000000000000000000000000000000") tokenReceiveTicketCid <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId amount = sourceAmount - sourcePoolData = fromSome (MessageCodecV1.encodeUint256 38.0) + sourcePoolData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 38.0) messageId = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistryCid @@ -868,22 +880,22 @@ testBurnMintPoolReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = scrip disclosedRegistry <- fromSome <$> queryDisclosure poolOwner registryCid result <- submit (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver case result.output of - ITokenPool.ReleaseOrMintResult_Completed receiverHoldingCids -> do + CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed receiverHoldingCids -> do [receiverHoldingCid] <- pure receiverHoldingCids - Some receiverHolding <- queryContractId receiver (fromInterfaceContractId @Link.LinkHolding receiverHoldingCid) + Some receiverHolding <- queryContractId receiver (fromInterfaceContractId @Link.Token.LinkHolding receiverHoldingCid) receiverHolding.holdingAmount === 1.0 _ -> abort "expected completed release result" - Some claimedEvent <- queryContractId receiver result.claimedEventCid + Some claimedEvent <- queryContractId receiver (coerceContractId result.claimedEventCid : ContractId CCIP.EventsV1.Events.TokenReceiveTicketClaimed) claimedEvent.event.sourceAmount === sourceAmount claimedEvent.event.localAmount === 10000000000.0 @@ -900,7 +912,7 @@ testBurnMintPoolReleaseFromTicketDecimalConversionTruncatesToZeroFails = script let tokenPoolInstanceId = "burn-mint-pool-release-zero" let registryInstanceId = "link-registry-bm-release-zero" let sourceChainSelector = 123.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" @@ -908,7 +920,7 @@ testBurnMintPoolReleaseFromTicketDecimalConversionTruncatesToZeroFails = script (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -920,14 +932,14 @@ testBurnMintPoolReleaseFromTicketDecimalConversionTruncatesToZeroFails = script "rl-bm-release-zero-in" tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr inboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -936,27 +948,28 @@ testBurnMintPoolReleaseFromTicketDecimalConversionTruncatesToZeroFails = script rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner tokenReceiveTicketCid <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId - amount = fromSome (MessageCodecV1.encodeUint256 99999999.0) - sourcePoolData = fromSome (MessageCodecV1.encodeUint256 18.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 99999999.0) + sourcePoolData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 18.0) messageId = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistryCid @@ -966,15 +979,15 @@ testBurnMintPoolReleaseFromTicketDecimalConversionTruncatesToZeroFails = script disclosedRegistry <- fromSome <$> queryDisclosure poolOwner registryCid submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver - receiverHoldings <- query @Link.LinkHolding receiver + receiverHoldings <- query @Link.Token.LinkHolding receiver length receiverHoldings === 0 ticketAfter <- queryContractId ccipOwner tokenReceiveTicketCid @@ -997,7 +1010,7 @@ testBurnMintPoolReleaseFromTicketDecimalConversionOverflowFails = script do let tokenPoolInstanceId = "burn-mint-pool-release-overflow" let registryInstanceId = "link-registry-bm-release-overflow" let sourceChainSelector = 123.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" @@ -1005,7 +1018,7 @@ testBurnMintPoolReleaseFromTicketDecimalConversionOverflowFails = script do (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1017,14 +1030,14 @@ testBurnMintPoolReleaseFromTicketDecimalConversionOverflowFails = script do "rl-bm-release-overflow-in" tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 9999999999999999999999999999.0 9999999999999999999999999999.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr inboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -1033,27 +1046,28 @@ testBurnMintPoolReleaseFromTicketDecimalConversionOverflowFails = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner tokenReceiveTicketCid <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId - amount = fromSome (MessageCodecV1.encodeUint256 100000000000000000000000000.0) - sourcePoolData = fromSome (MessageCodecV1.encodeUint256 6.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 100000000000000000000000000.0) + sourcePoolData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 6.0) messageId = "9999999999999999999999999999999999999999999999999999999999999999" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistryCid @@ -1063,15 +1077,15 @@ testBurnMintPoolReleaseFromTicketDecimalConversionOverflowFails = script do disclosedRegistry <- fromSome <$> queryDisclosure poolOwner registryCid submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver - receiverHoldings <- query @Link.LinkHolding receiver + receiverHoldings <- query @Link.Token.LinkHolding receiver length receiverHoldings === 0 ticketAfter <- queryContractId ccipOwner tokenReceiveTicketCid @@ -1097,12 +1111,12 @@ testBurnMintPoolReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do let tokenPoolInstanceId = "burn-mint-pool-release-drift" let registryInstanceId = "link-registry-bm-release-drift" let sourceChainSelector = 123.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" - let requiredCcv = RawInstanceAddress.make "required-ccv-drift" ccvOwner - let driftCcv = RawInstanceAddress.make "drift-ccv" driftOwner + let requiredCcv = Chainlink.InstanceAddress.make "required-ccv-drift" ccvOwner + let driftCcv = Chainlink.InstanceAddress.make "drift-ccv" driftOwner let remotePools = ["1111111111111111111111111111111111111111"] let remoteTokenAddress = "2222222222222222222222222222222222222222" @@ -1110,7 +1124,7 @@ testBurnMintPoolReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1122,14 +1136,14 @@ testBurnMintPoolReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do "rl-bm-release-drift-in" tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr inboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -1138,40 +1152,41 @@ testBurnMintPoolReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner tokenReceiveTicketCid <- submit (actAs ccipOwner <> actAs poolOwner <> actAs ccvOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [ccvOwner] verifiedCCVs = [requiredCcv] requiredInboundPoolCCVs = [requiredCcv] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext - let driftUpdate = BurnMintTokenPool.ChainUpdate with + let driftUpdate = CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = sourceChainSelector remotePools = remotePools remoteTokenAddress = remoteTokenAddress inboundCCVs = [driftCcv] outboundCCVs = [] - finalityConfig = FinalityConfig.WaitForFinality + finalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rl-bm-release-drift-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rl-bm-release-drift-out@owner" tokenPoolCid <- submit poolOwner do - exerciseCmd tokenPoolCid BurnMintTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [sourceChainSelector] chainsToAdd = [driftUpdate] @@ -1183,18 +1198,18 @@ testBurnMintPoolReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do disclosedRegistry <- fromSome <$> queryDisclosure poolOwner registryCid result <- submit (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver case result.output of - ITokenPool.ReleaseOrMintResult_Completed receiverHoldingCids -> do + CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed receiverHoldingCids -> do [receiverHoldingCid] <- pure receiverHoldingCids - Some receiverHolding <- queryContractId receiver (fromInterfaceContractId @Link.LinkHolding receiverHoldingCid) + Some receiverHolding <- queryContractId receiver (fromInterfaceContractId @Link.Token.LinkHolding receiverHoldingCid) receiverHolding.holdingAmount === 3.0 _ -> abort "expected completed release result" @@ -1213,18 +1228,18 @@ testBurnMintPoolReleaseFromTicketRejectsWrongCCVInstance = script do let tokenPoolInstanceId = "burn-mint-pool-release-instance" let registryInstanceId = "link-registry-bm-release-instance" let sourceChainSelector = 123.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" - let requiredCcv = RawInstanceAddress.make "required-ccv" ccvOwner - let otherCcv = RawInstanceAddress.make "other-ccv" ccvOwner + let requiredCcv = Chainlink.InstanceAddress.make "required-ccv" ccvOwner + let otherCcv = Chainlink.InstanceAddress.make "other-ccv" ccvOwner registryCid <- createLinkRegistry poolOwner instrumentId registryInstanceId (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1236,14 +1251,14 @@ testBurnMintPoolReleaseFromTicketRejectsWrongCCVInstance = script do "rl-bm-release-instance-in" tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr inboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -1252,45 +1267,47 @@ testBurnMintPoolReleaseFromTicketRejectsWrongCCVInstance = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner tokenReceiveTicketCid <- submit (actAs ccipOwner <> actAs poolOwner <> actAs ccvOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [ccvOwner] verifiedCCVs = [otherCcv] requiredInboundPoolCCVs = [requiredCcv] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext wrongPoolAddressTicketCid <- submit (actAs ccipOwner <> actAs poolOwner <> actAs ccvOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [ccvOwner] verifiedCCVs = [requiredCcv] requiredInboundPoolCCVs = [requiredCcv] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make "stale-burn-mint-pool-instance" poolOwner + poolAddress = Chainlink.InstanceAddress.make "stale-burn-mint-pool-instance" poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistryCid @@ -1301,21 +1318,21 @@ testBurnMintPoolReleaseFromTicketRejectsWrongCCVInstance = script do disclosedRegistry <- fromSome <$> queryDisclosure poolOwner registryCid submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedWrongPoolTicket <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) - tokenReceiveTicketCid = wrongPoolAddressTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) + tokenReceiveTicketCid = coerceContractId wrongPoolAddressTicketCid caller = receiver submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver -- Release must reject verified CCV instances whose owner is not a ticket signatory. @@ -1334,7 +1351,7 @@ testBurnMintPoolReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do let tokenPoolInstanceId = "burn-mint-pool-release-ccv-auth" let registryInstanceId = "link-registry-bm-release-ccv-auth" let sourceChainSelector = 123.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" @@ -1342,7 +1359,7 @@ testBurnMintPoolReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1354,14 +1371,14 @@ testBurnMintPoolReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do "rl-bm-release-ccv-auth-in" tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr inboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -1370,28 +1387,29 @@ testBurnMintPoolReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner - let nonsignatoryVerifiedCCV = RawInstanceAddress.make "ccv-not-signer" wrongCcvOwner + let nonsignatoryVerifiedCCV = Chainlink.InstanceAddress.make "ccv-not-signer" wrongCcvOwner tokenReceiveTicketCid <- submit (actAs ccipOwner <> actAs poolOwner <> actAs ccvOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = ccipOwner ccvOwners = [ccvOwner] verifiedCCVs = [nonsignatoryVerifiedCCV] requiredInboundPoolCCVs = [] tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" sourceChainSelector = sourceChainSelector - finality = FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistryCid @@ -1401,12 +1419,12 @@ testBurnMintPoolReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do disclosedRegistry <- fromSome <$> queryDisclosure poolOwner registryCid submitMustFail (actAs receiver <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket <> disclose disclosedRegistry) do - exerciseCmd tokenPoolCid BurnMintTokenPool.ReleaseFromTicket with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) - tokenReceiveTicketCid = tokenReceiveTicketCid + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ReleaseFromTicket with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = mkPoolContext inboundRateLimiterCid (toInterfaceContractId registryCid) + tokenReceiveTicketCid = coerceContractId tokenReceiveTicketCid caller = receiver testBurnMintPoolRejectsMissingBurnMintFactory : Script () @@ -1422,7 +1440,7 @@ testBurnMintPoolRejectsMissingBurnMintFactory = script do let tokenPoolInstanceId = "burn-mint-pool-missing" let registryInstanceId = "link-registry-bm-missing" let destChainSelector = 456.0 - let instrumentId = HoldingV1.InstrumentId with + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" @@ -1430,7 +1448,7 @@ testBurnMintPoolRejectsMissingBurnMintFactory = script do (tokenAdminRegistryCid, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId rmnRemoteCid <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1444,14 +1462,14 @@ testBurnMintPoolRejectsMissingBurnMintFactory = script do "rl-bm-missing-out" tokenPoolInstanceId destChainSelector - RateLimiter.RateLimitDirection_Outbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] outboundRateLimiterAddr outboundRateLimiterAddr outboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner @@ -1460,8 +1478,8 @@ testBurnMintPoolRejectsMissingBurnMintFactory = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPoolCid @@ -1470,15 +1488,15 @@ testBurnMintPoolRejectsMissingBurnMintFactory = script do disclosedRateLimiter <- fromSome <$> queryDisclosure poolOwner outboundRateLimiterCid submitMustFail (actAs sender <> actAs poolOwner <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPoolCid BurnMintTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistryCid - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemoteCid - extraContext = MetadataV1.ChoiceContext with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (RateLimiter.rateLimiterKey, CCIP.Context.toAnyValue outboundRateLimiterCid) + [ (CCIP.RateLimiterV1.rateLimiterContextKey, CCIP.UtilsV1.Context.toAnyValue outboundRateLimiterCid) ] - sendingMessageCid = sendingMessageCid + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [senderHoldingCid] amount = 2.0 caller = sender @@ -1495,32 +1513,32 @@ testBurnMintTokenPool_ApplyTokenTransferFeeConfigUpdates_RejectsNegativeFeeUSDCe "rl-bm-fee-out" tokenPoolInstanceId destChainSelector - RateLimiter.RateLimitDirection_Outbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] outboundRateLimiterAddr outboundRateLimiterAddr outboundRateLimiterAddr tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = tokenPoolInstanceId poolOwner = poolOwner ccipOwner = ccipOwner - instrumentId = HoldingV1.InstrumentId with + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "LINK" decimals = 10 rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps "tar-bm-fee" "rmn-bm-fee" "fq-bm-fee" ccipOwner ccipOwner submitMustFail poolOwner do - exerciseCmd tokenPoolCid BurnMintTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = - [ BurnMintTokenPool.TokenTransferFeeConfigArgs with + [ CCIP.BurnMintTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = destChainSelector isEnabled = True feeUSDCents = -1.0 @@ -1539,45 +1557,45 @@ testBurnMintTokenPool_RateLimitAdminSetConfigAndCannotRewireLimiters = script do rateLimitAdmin <- allocateParty "rate-limit-admin-bm" let sourceChainSelector = 123.0 - let outbound = RawInstanceAddress.make "outbound-rl-bm" poolOwner + let outbound = Chainlink.InstanceAddress.make "outbound-rl-bm" poolOwner (inboundRateLimiterCid, inboundRateLimiterAddr) <- createRateLimiter poolOwner "rl-bm-admin-in" "burn-mint-pool-rl-admin" sourceChainSelector - RateLimiter.RateLimitDirection_Inbound - RateLimiter.RateLimitMode_DefaultFinality + CCIP.RateLimiterV1.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitMode_DefaultFinality 100000000000.0 10000000.0 let remoteChainConfig = mkRemoteChainConfig [] [] inboundRateLimiterAddr inboundRateLimiterAddr outbound tokenPoolCid <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = "burn-mint-pool-rl-admin" poolOwner = poolOwner ccipOwner = ccipOwner - instrumentId = HoldingV1.InstrumentId with admin = poolOwner; id = "LINK" + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner; id = "LINK" decimals = 8 rateLimitAdmin = Some rateLimitAdmin remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps "tar-bm-rl-admin" "rmn-bm-rl-admin" "fq-bm-rl-admin" ccipOwner ccipOwner submitMustFail rateLimitAdmin do - exerciseCmd tokenPoolCid BurnMintTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = - [ BurnMintTokenPool.RateLimitConfigArgs with + [ CCIP.BurnMintTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = sourceChainSelector - inboundRateLimiter = RawInstanceAddress.make "inbound-rl-bm-new" poolOwner + inboundRateLimiter = Chainlink.InstanceAddress.make "inbound-rl-bm-new" poolOwner inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr outboundRateLimiter = outbound ] submitMustFail rateLimitAdmin do - exerciseCmd inboundRateLimiterCid RateLimiter.SetConfig with + exerciseCmd inboundRateLimiterCid CCIP.RateLimiterV1.SetConfig with newIsEnabled = True newCapacity = 50.0 newRate = 5.0 @@ -1586,7 +1604,7 @@ testBurnMintTokenPool_RateLimitAdminSetConfigAndCannotRewireLimiters = script do disclosedRateLimiter <- fromSome <$> queryDisclosure poolOwner inboundRateLimiterCid updatedInboundCid <- submit (actAs rateLimitAdmin <> disclose disclosedRateLimiter ) do - exerciseCmd tokenPoolCid BurnMintTokenPool.SetRateLimitConfig with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.SetRateLimitConfig with caller = rateLimitAdmin rateLimiterCid = inboundRateLimiterCid newIsEnabled = True @@ -1607,20 +1625,20 @@ testBurnMintTokenPool_RateLimiterPathIsolation = script do rmnOwner <- allocateParty "bm-rl-iso-rmn" tokenPoolCid <- submit owner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId = "bm-pool-rl-iso" poolOwner = owner ccipOwner = ccipOwner - instrumentId = HoldingV1.InstrumentId with admin = owner; id = "LINK" + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner; id = "LINK" decimals = 8 rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps "tar-bm-rl-iso" "rmn-bm-rl-iso" "fq-bm-rl-iso" ccipOwner rmnOwner - let mk updSel fin inboundRl customRl outboundRl = BurnMintTokenPool.ChainUpdate with + let mk updSel fin inboundRl customRl outboundRl = CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = updSel remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" @@ -1632,67 +1650,67 @@ testBurnMintTokenPool_RateLimiterPathIsolation = script do outboundRateLimiter = outboundRl submitMustFail owner do - exerciseCmd tokenPoolCid BurnMintTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = - [ mk 801.0 FinalityConfig.WaitForFinality - (RawInstanceAddress.RawInstanceAddress "in-a@owner") - (RawInstanceAddress.RawInstanceAddress "custom-a@owner") - (RawInstanceAddress.RawInstanceAddress "out-a@owner") - , mk 801.0 FinalityConfig.WaitForFinality - (RawInstanceAddress.RawInstanceAddress "in-b@owner") - (RawInstanceAddress.RawInstanceAddress "custom-b@owner") - (RawInstanceAddress.RawInstanceAddress "out-b@owner") + [ mk 801.0 CCIP.CodecV1.FinalityConfig.WaitForFinality + (Chainlink.InstanceAddress.RawInstanceAddress "in-a@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "custom-a@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "out-a@owner") + , mk 801.0 CCIP.CodecV1.FinalityConfig.WaitForFinality + (Chainlink.InstanceAddress.RawInstanceAddress "in-b@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "custom-b@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "out-b@owner") ] submitMustFail owner do - exerciseCmd tokenPoolCid BurnMintTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = - [ mk 802.0 FinalityConfig.WaitForSafe - (RawInstanceAddress.RawInstanceAddress "shared-in@owner") - (RawInstanceAddress.RawInstanceAddress "shared-in@owner") - (RawInstanceAddress.RawInstanceAddress "out@owner") + [ mk 802.0 CCIP.CodecV1.FinalityConfig.WaitForSafe + (Chainlink.InstanceAddress.RawInstanceAddress "shared-in@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "shared-in@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "out@owner") ] submitMustFail owner do - exerciseCmd tokenPoolCid BurnMintTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = - [ mk 803.0 FinalityConfig.WaitForSafe - (RawInstanceAddress.RawInstanceAddress "in@owner") - (RawInstanceAddress.RawInstanceAddress "out@owner") - (RawInstanceAddress.RawInstanceAddress "out@owner") + [ mk 803.0 CCIP.CodecV1.FinalityConfig.WaitForSafe + (Chainlink.InstanceAddress.RawInstanceAddress "in@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "out@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "out@owner") ] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid BurnMintTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = - [ mk 450.0 (FinalityConfig.BlockDepth 12) - (RawInstanceAddress.RawInstanceAddress "in-450@owner") - (RawInstanceAddress.RawInstanceAddress "custom-450@owner") - (RawInstanceAddress.RawInstanceAddress "out-450@owner") + [ mk 450.0 (CCIP.CodecV1.FinalityConfig.BlockDepth 12) + (Chainlink.InstanceAddress.RawInstanceAddress "in-450@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "custom-450@owner") + (Chainlink.InstanceAddress.RawInstanceAddress "out-450@owner") ] submitMustFail owner do - exerciseCmd tokenPoolCid BurnMintTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = - [ BurnMintTokenPool.RateLimitConfigArgs with + [ CCIP.BurnMintTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 450.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "x@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "x@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "y@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "x@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "x@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "y@owner" ] submitMustFail owner do - exerciseCmd tokenPoolCid BurnMintTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.BurnMintTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = - [ BurnMintTokenPool.RateLimitConfigArgs with + [ CCIP.BurnMintTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 450.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "a@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "b@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "b@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "a@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "b@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "b@owner" ] pure () @@ -1714,25 +1732,25 @@ testBurnMintPoolVerifyInboundMessageAcceptsMatchingSourceToken = script do let allowedSourcePool = "000000000000000000000000aaaaaaaaaaaaaaaa" let configuredRemoteToken = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "TestToken" (tokenAdminRegistry, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId testInstrumentId tokenPoolInstanceId - let ccvAddr = RawInstanceAddress.make "test-ccv-bm-verify" ccipOwner - let existingConfig = BurnMintTokenPool.RemoteChainConfig with + let ccvAddr = Chainlink.InstanceAddress.make "test-ccv-bm-verify" ccipOwner + let existingConfig = CCIP.BurnMintTokenPoolV1.RemoteChainConfig with remotePools = [allowedSourcePool] remoteTokenAddress = configuredRemoteToken inboundCCVs = [ccvAddr] outboundCCVs = [] finalityConfig = finalityConfig 2000 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1741,12 +1759,12 @@ testBurnMintPoolVerifyInboundMessageAcceptsMatchingSourceToken = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner ccipOwner - let destTokenAddr = MessageCodecV1.encodeInstrumentId testInstrumentId - let message = MessageCodecV1.MessageV1 with + let destTokenAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId testInstrumentId + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -1757,21 +1775,21 @@ testBurnMintPoolVerifyInboundMessageAcceptsMatchingSourceToken = script do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 5000000.0) + tokenTransfer = Some CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 5000000.0) sourcePoolAddress = allowedSourcePool sourceTokenAddress = configuredRemoteToken destTokenAddress = destTokenAddr - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "" messageData = "" - let offRampInstanceAddress = RawInstanceAddress.make "test-offramp-bm-verify" ccipOwner - let tarInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampInstanceAddress = Chainlink.InstanceAddress.make "test-offramp-bm-verify" ccipOwner + let tarInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -1787,12 +1805,12 @@ testBurnMintPoolVerifyInboundMessageAcceptsMatchingSourceToken = script do receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampInstanceAddress - globalConfig = RawInstanceAddress.make "test-globalconfig-bm-verify" ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-bm-verify" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId ccipOwner tokenAdminRegistry = tarInstanceAddress - state = ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry @@ -1800,17 +1818,15 @@ testBurnMintPoolVerifyInboundMessageAcceptsMatchingSourceToken = script do disclosedEm <- fromSome <$> queryDisclosure ccipOwner executingMessageCid newEmCid <- submit (actAs receiver <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedEm) do - exerciseCmd tokenPool BurnMintTokenPool.VerifyInboundMessage with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd tokenPool CCIP.BurnMintTokenPoolV1.VerifyInboundMessage with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid caller = receiver - newExecMsg <- queryContractId ccipOwner newEmCid - assertMsg "ExecutingMessageV1 should exist" (isSome newExecMsg) - let em = fromSome newExecMsg - em.inboundPoolVerification === Some (ExecutingMessageV1.InboundPoolVerification with + Some newExecMsg <- queryContractId ccipOwner (coerceContractId @_ @CCIP.CoreV1.ExecutingMessage.ExecutingMessage newEmCid) + newExecMsg.inboundPoolVerification === Some (CCIP.CoreV1.ExecutingMessage.InboundPoolVerification with poolInstanceId = tokenPoolInstanceId poolOwner = poolOwner poolCCVs = [ccvAddr]) @@ -1835,24 +1851,24 @@ testBurnMintPoolVerifyInboundMessageRejectsMismatchedSourceToken = script do let configuredRemoteToken = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" let wrongSourceToken = "ffffffffffffffffffffffffffffffffffffffff" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = poolOwner id = "TestToken" (tokenAdminRegistry, tokenConfigCid) <- setupTokenAdminRegistry ccipOwner poolOwner tokenAdminRegistryInstanceId testInstrumentId tokenPoolInstanceId - let existingConfig = BurnMintTokenPool.RemoteChainConfig with + let existingConfig = CCIP.BurnMintTokenPoolV1.RemoteChainConfig with remotePools = [allowedSourcePool] remoteTokenAddress = configuredRemoteToken inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 2000 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd BurnMintTokenPool.BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1861,12 +1877,12 @@ testBurnMintPoolVerifyInboundMessageRejectsMismatchedSourceToken = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = BurnMintTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner ccipOwner - let destTokenAddr = MessageCodecV1.encodeInstrumentId testInstrumentId - let message = MessageCodecV1.MessageV1 with + let destTokenAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId testInstrumentId + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -1877,21 +1893,21 @@ testBurnMintPoolVerifyInboundMessageRejectsMismatchedSourceToken = script do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 5000000.0) + tokenTransfer = Some CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 5000000.0) sourcePoolAddress = allowedSourcePool sourceTokenAddress = wrongSourceToken destTokenAddress = destTokenAddr - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "" messageData = "" - let offRampInstanceAddress = RawInstanceAddress.make "test-offramp-bm-mismatch" ccipOwner - let tarInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampInstanceAddress = Chainlink.InstanceAddress.make "test-offramp-bm-mismatch" ccipOwner + let tarInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" @@ -1907,12 +1923,12 @@ testBurnMintPoolVerifyInboundMessageRejectsMismatchedSourceToken = script do receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampInstanceAddress - globalConfig = RawInstanceAddress.make "test-globalconfig-bm-mismatch" ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-bm-mismatch" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId ccipOwner tokenAdminRegistry = tarInstanceAddress - state = ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry @@ -1920,11 +1936,11 @@ testBurnMintPoolVerifyInboundMessageRejectsMismatchedSourceToken = script do disclosedEm <- fromSome <$> queryDisclosure ccipOwner executingMessageCid submitMustFail (actAs receiver <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedEm) do - exerciseCmd tokenPool BurnMintTokenPool.VerifyInboundMessage with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd tokenPool CCIP.BurnMintTokenPoolV1.VerifyInboundMessage with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid caller = receiver debug "testBurnMintPoolVerifyInboundMessageRejectsMismatchedSourceToken: PASSED" diff --git a/contracts/ccip/test/daml/CCIP/BurnMintTokenPoolTest/BurnMintTokenPoolCodecTest.daml b/contracts/ccip/test/daml/CCIP/BurnMintTokenPoolTest/BurnMintTokenPoolCodecTest.daml index f237fe377..deb1ef1ac 100644 --- a/contracts/ccip/test/daml/CCIP/BurnMintTokenPoolTest/BurnMintTokenPoolCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/BurnMintTokenPoolTest/BurnMintTokenPoolCodecTest.daml @@ -4,35 +4,22 @@ module CCIP.BurnMintTokenPoolTest.BurnMintTokenPoolCodecTest where import Daml.Script import DA.Assert ((===)) import DA.Optional (fromSome) - -import CCIP.BurnMintTokenPoolCodecGen qualified as BurnMintTokenPoolCodec -import CCIP.BurnMintTokenPoolTypes ( - ChainUpdate(..), - TokenTransferFeeConfigArgs(..), - RateLimitConfigArgs(..), - TransferTimeout(..), - SetDynamicConfigParams(..), - ApplyChainUpdatesParams(..), - ApplyTokenTransferFeeConfigUpdatesParams(..), - SetRateLimiterReferencesParams(..), - SetRateLimitConfigParams(..), - SetTransferTimeoutParams(..), - AddPoolReceiveContextNonContractValueParams(..), - AddPoolReceiveContextContractValueParams(..), - RemovePoolReceiveContextValueParams(..), - ) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.ContextCodec (encodeChoiceContext, decodeChoiceContextAt, encodeAnyValue) import DA.TextMap qualified as TextMap -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.UtilsV1.Context +import qualified CCIP.CodecV1.FinalityConfig -import CCIP.FinalityConfig qualified as FinalityCodec +import qualified CCIP.BurnMintTokenPoolV1 +import qualified CCIP.BurnMintTokenPoolV1CodecGen mkFinalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n -- =============================================== -- | SetDynamicConfig | @@ -42,13 +29,13 @@ testSetDynamicConfigParamsRoundtrip : Script () testSetDynamicConfigParamsRoundtrip = do -- Test with rateLimitAdmin set rateLimitAdmin <- allocateParty "admin" - let args = SetDynamicConfigParams with rateLimitAdmin = Some rateLimitAdmin - encoded = BurnMintTokenPoolCodec.encodeSetDynamicConfigParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeSetDynamicConfigParamsAt encoded 0)) === args + let args = CCIP.BurnMintTokenPoolV1.SetDynamicConfigParams with rateLimitAdmin = Some rateLimitAdmin + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetDynamicConfigParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeSetDynamicConfigParamsAt encoded 0)) === args -- Test with rateLimitAdmin not set - let argsNone = SetDynamicConfigParams with rateLimitAdmin = None - encodedNone = BurnMintTokenPoolCodec.encodeSetDynamicConfigParams argsNone - fst (fromSome (BurnMintTokenPoolCodec.decodeSetDynamicConfigParamsAt encodedNone 0)) === argsNone + let argsNone = CCIP.BurnMintTokenPoolV1.SetDynamicConfigParams with rateLimitAdmin = None + encodedNone = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetDynamicConfigParams argsNone + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeSetDynamicConfigParamsAt encodedNone 0)) === argsNone -- =============================================== @@ -58,42 +45,42 @@ testSetDynamicConfigParamsRoundtrip = do testApplyChainUpdatesParamsRoundtrip : Script () testApplyChainUpdatesParamsRoundtrip = do let chainsToAdd = [ - ChainUpdate with + CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = 1.0 remotePools = ["1234567890abcdef", "fedcba0987654321"] remoteTokenAddress = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" - inboundCCVs = [RawInstanceAddress.RawInstanceAddress "ccv-inbound@party1", RawInstanceAddress.RawInstanceAddress "ccv-inbound2@party2"] - outboundCCVs = [RawInstanceAddress.RawInstanceAddress "ccv-outbound@party1"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv-inbound@party1", Chainlink.InstanceAddress.RawInstanceAddress "ccv-inbound2@party2"] + outboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv-outbound@party1"] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party1" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party1" - , ChainUpdate with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party1" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party1" + , CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = 18446744073709551615.0 -- max uint64 remotePools = [] remoteTokenAddress = "" inboundCCVs = [] outboundCCVs = [] finalityConfig = mkFinalityConfig 7 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party1" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party1" - , ChainUpdate with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party1" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party1" + , CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = 0.0 remotePools = [] remoteTokenAddress = "c44879cc487d6ed2fdda5dfbebace4d430bd3f5a" inboundCCVs = [] outboundCCVs = [] finalityConfig = mkFinalityConfig 3 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party1" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party1" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party1" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party1" ] - args = ApplyChainUpdatesParams with + args = CCIP.BurnMintTokenPoolV1.ApplyChainUpdatesParams with remoteChainSelectorsToRemove = [2.0, 3.0] chainsToAdd - let encoded = BurnMintTokenPoolCodec.encodeApplyChainUpdatesParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeApplyChainUpdatesParamsAt encoded 0)) === args + let encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeApplyChainUpdatesParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeApplyChainUpdatesParamsAt encoded 0)) === args -- =============================================== -- | ApplyTokenTransferFeeConfigUpdates | @@ -102,14 +89,14 @@ testApplyChainUpdatesParamsRoundtrip = do testApplyTokenTransferFeeConfigUpdatesParamsRoundtrip : Script () testApplyTokenTransferFeeConfigUpdatesParamsRoundtrip = do let feeConfigArgs = [ - TokenTransferFeeConfigArgs with + CCIP.BurnMintTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 1.0 isEnabled = True destGasOverhead = 21000 destBytesOverhead = 100 feeUSDCents = 50.0 feeBps = 25.0 - , TokenTransferFeeConfigArgs with + , CCIP.BurnMintTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 18446744073709551615.0 -- max uint64 isEnabled = False destGasOverhead = 30000 @@ -117,11 +104,11 @@ testApplyTokenTransferFeeConfigUpdatesParamsRoundtrip = do feeUSDCents = 100.0 feeBps = 50.0 ] - args = ApplyTokenTransferFeeConfigUpdatesParams with + args = CCIP.BurnMintTokenPoolV1.ApplyTokenTransferFeeConfigUpdatesParams with tokenTransferFeeConfigArgs = feeConfigArgs disableTokenTransferFeeConfigArgs = [2.0, 3.0] - let encoded = BurnMintTokenPoolCodec.encodeApplyTokenTransferFeeConfigUpdatesParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeApplyTokenTransferFeeConfigUpdatesParamsAt encoded 0)) === args + let encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeApplyTokenTransferFeeConfigUpdatesParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeApplyTokenTransferFeeConfigUpdatesParamsAt encoded 0)) === args -- =============================================== -- | SetRateLimiterReferences | @@ -130,26 +117,26 @@ testApplyTokenTransferFeeConfigUpdatesParamsRoundtrip = do testSetRateLimiterReferencesParamsRoundtrip : Script () testSetRateLimiterReferencesParamsRoundtrip = do let rateLimitConfigs = [ - RateLimitConfigArgs with + CCIP.BurnMintTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 1.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party1" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party1" - , RateLimitConfigArgs with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party1" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party1" + , CCIP.BurnMintTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 18446744073709551615.0 -- max uint64 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party2" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party2" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party2" - , RateLimitConfigArgs with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party2" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party2" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party2" + , CCIP.BurnMintTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 0.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party3" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party3" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party3" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party3" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party3" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party3" ] - args = SetRateLimiterReferencesParams with + args = CCIP.BurnMintTokenPoolV1.SetRateLimiterReferencesParams with rateLimitConfigArgs = rateLimitConfigs - let encoded = BurnMintTokenPoolCodec.encodeSetRateLimiterReferencesParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeSetRateLimiterReferencesParamsAt encoded 0)) === args + let encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetRateLimiterReferencesParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeSetRateLimiterReferencesParamsAt encoded 0)) === args pure () -- =============================================== @@ -160,14 +147,14 @@ testSetRateLimitConfigParamsRoundtrip : Script () testSetRateLimitConfigParamsRoundtrip = script do admin <- allocateParty "rate_limit_admin" poolOwner <- allocateParty "pool_owner" - let args = SetRateLimitConfigParams with + let args = CCIP.BurnMintTokenPoolV1.SetRateLimitConfigParams with caller = admin - rateLimiterInstanceAddress = RawInstanceAddress.make "rl-in" poolOwner + rateLimiterInstanceAddress = Chainlink.InstanceAddress.make "rl-in" poolOwner newIsEnabled = True newCapacity = 42.0 newRate = 3.0 - let encoded = BurnMintTokenPoolCodec.encodeSetRateLimitConfigParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeSetRateLimitConfigParamsAt encoded 0)) === args + let encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetRateLimitConfigParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeSetRateLimitConfigParamsAt encoded 0)) === args pure () -- =============================================== @@ -177,22 +164,22 @@ testSetRateLimitConfigParamsRoundtrip = script do testTransferTimeoutRoundtrip : Script () testTransferTimeoutRoundtrip = do -- Test Indefinite - let indefinite = Indefinite - encodedIndefinite = BurnMintTokenPoolCodec.encodeTransferTimeout indefinite - fst (fromSome (BurnMintTokenPoolCodec.decodeTransferTimeoutAt encodedIndefinite 0)) === indefinite + let indefinite = CCIP.BurnMintTokenPoolV1.Indefinite + encodedIndefinite = CCIP.BurnMintTokenPoolV1CodecGen.encodeTransferTimeout indefinite + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeTransferTimeoutAt encodedIndefinite 0)) === indefinite -- Test RelativeHours with various values - let relHours24 = RelativeHours 24 - encodedRelHours24 = BurnMintTokenPoolCodec.encodeTransferTimeout relHours24 - fst (fromSome (BurnMintTokenPoolCodec.decodeTransferTimeoutAt encodedRelHours24 0)) === relHours24 + let relHours24 = CCIP.BurnMintTokenPoolV1.RelativeHours 24 + encodedRelHours24 = CCIP.BurnMintTokenPoolV1CodecGen.encodeTransferTimeout relHours24 + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeTransferTimeoutAt encodedRelHours24 0)) === relHours24 - let relHours0 = RelativeHours 0 - encodedRelHours0 = BurnMintTokenPoolCodec.encodeTransferTimeout relHours0 - fst (fromSome (BurnMintTokenPoolCodec.decodeTransferTimeoutAt encodedRelHours0 0)) === relHours0 + let relHours0 = CCIP.BurnMintTokenPoolV1.RelativeHours 0 + encodedRelHours0 = CCIP.BurnMintTokenPoolV1CodecGen.encodeTransferTimeout relHours0 + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeTransferTimeoutAt encodedRelHours0 0)) === relHours0 - let relHoursLarge = RelativeHours 8760 -- 1 year in hours - encodedRelHoursLarge = BurnMintTokenPoolCodec.encodeTransferTimeout relHoursLarge - fst (fromSome (BurnMintTokenPoolCodec.decodeTransferTimeoutAt encodedRelHoursLarge 0)) === relHoursLarge + let relHoursLarge = CCIP.BurnMintTokenPoolV1.RelativeHours 8760 -- 1 year in hours + encodedRelHoursLarge = CCIP.BurnMintTokenPoolV1CodecGen.encodeTransferTimeout relHoursLarge + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeTransferTimeoutAt encodedRelHoursLarge 0)) === relHoursLarge -- =============================================== -- | Pool receive context MCMS param codecs | @@ -200,24 +187,24 @@ testTransferTimeoutRoundtrip = do testAddPoolReceiveContextNonContractValueParamsRoundtrip : Script () testAddPoolReceiveContextNonContractValueParamsRoundtrip = do - let inner = encodeAnyValue (MetadataV1.AV_Text "hello") - args = AddPoolReceiveContextNonContractValueParams with contextKey = "myKey", valuePayload = inner - encoded = BurnMintTokenPoolCodec.encodeAddPoolReceiveContextNonContractValueParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeAddPoolReceiveContextNonContractValueParamsAt encoded 0)) === args + let inner = CCIP.UtilsV1.Context.encodeAnyValue (Splice.Api.Token.MetadataV1.AV_Text "hello") + args = CCIP.BurnMintTokenPoolV1.AddPoolReceiveContextNonContractValueParams with contextKey = "myKey", valuePayload = inner + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeAddPoolReceiveContextNonContractValueParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeAddPoolReceiveContextNonContractValueParamsAt encoded 0)) === args testAddPoolReceiveContextContractValueParamsRoundtrip : Script () testAddPoolReceiveContextContractValueParamsRoundtrip = script do p <- allocateParty "p" - let ria = RawInstanceAddress.make "other-inst" p - args = AddPoolReceiveContextContractValueParams with contextKey = "refKey", referentInstanceAddress = ria - encoded = BurnMintTokenPoolCodec.encodeAddPoolReceiveContextContractValueParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeAddPoolReceiveContextContractValueParamsAt encoded 0)) === args + let ria = Chainlink.InstanceAddress.make "other-inst" p + args = CCIP.BurnMintTokenPoolV1.AddPoolReceiveContextContractValueParams with contextKey = "refKey", referentInstanceAddress = ria + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeAddPoolReceiveContextContractValueParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeAddPoolReceiveContextContractValueParamsAt encoded 0)) === args testRemovePoolReceiveContextValueParamsRoundtrip : Script () testRemovePoolReceiveContextValueParamsRoundtrip = do - let args = RemovePoolReceiveContextValueParams with contextKey = "toRemove" - encoded = BurnMintTokenPoolCodec.encodeRemovePoolReceiveContextValueParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeRemovePoolReceiveContextValueParamsAt encoded 0)) === args + let args = CCIP.BurnMintTokenPoolV1.RemovePoolReceiveContextValueParams with contextKey = "toRemove" + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeRemovePoolReceiveContextValueParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeRemovePoolReceiveContextValueParamsAt encoded 0)) === args -- =============================================== -- | ChoiceContext (ContextCodec) | @@ -226,24 +213,24 @@ testRemovePoolReceiveContextValueParamsRoundtrip = do testChoiceContextCodecRoundtrip : Script () testChoiceContextCodecRoundtrip = do -- Test empty context - let emptyCtx = MetadataV1.emptyChoiceContext - encodedEmpty = encodeChoiceContext emptyCtx - fst (fromSome (decodeChoiceContextAt encodedEmpty 0)) === emptyCtx + let emptyCtx = Splice.Api.Token.MetadataV1.emptyChoiceContext + encodedEmpty = CCIP.UtilsV1.Context.encodeChoiceContext emptyCtx + fst (fromSome (CCIP.UtilsV1.Context.decodeChoiceContextAt encodedEmpty 0)) === emptyCtx -- Test context with simple text values - let ctxWithText = MetadataV1.ChoiceContext (TextMap.fromList [("key1", MetadataV1.AV_Text "value1"), ("key2", MetadataV1.AV_Text "value2")]) - encodedWithText = encodeChoiceContext ctxWithText - fst (fromSome (decodeChoiceContextAt encodedWithText 0)) === ctxWithText + let ctxWithText = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("key1", Splice.Api.Token.MetadataV1.AV_Text "value1"), ("key2", Splice.Api.Token.MetadataV1.AV_Text "value2")]) + encodedWithText = CCIP.UtilsV1.Context.encodeChoiceContext ctxWithText + fst (fromSome (CCIP.UtilsV1.Context.decodeChoiceContextAt encodedWithText 0)) === ctxWithText -- Test context with int values - let ctxWithInt = MetadataV1.ChoiceContext (TextMap.fromList [("count", MetadataV1.AV_Int 42)]) - encodedWithInt = encodeChoiceContext ctxWithInt - fst (fromSome (decodeChoiceContextAt encodedWithInt 0)) === ctxWithInt + let ctxWithInt = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("count", Splice.Api.Token.MetadataV1.AV_Int 42)]) + encodedWithInt = CCIP.UtilsV1.Context.encodeChoiceContext ctxWithInt + fst (fromSome (CCIP.UtilsV1.Context.decodeChoiceContextAt encodedWithInt 0)) === ctxWithInt -- Test context with bool values - let ctxWithBool = MetadataV1.ChoiceContext (TextMap.fromList [("enabled", MetadataV1.AV_Bool True), ("disabled", MetadataV1.AV_Bool False)]) - encodedWithBool = encodeChoiceContext ctxWithBool - fst (fromSome (decodeChoiceContextAt encodedWithBool 0)) === ctxWithBool + let ctxWithBool = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("enabled", Splice.Api.Token.MetadataV1.AV_Bool True), ("disabled", Splice.Api.Token.MetadataV1.AV_Bool False)]) + encodedWithBool = CCIP.UtilsV1.Context.encodeChoiceContext ctxWithBool + fst (fromSome (CCIP.UtilsV1.Context.decodeChoiceContextAt encodedWithBool 0)) === ctxWithBool -- =============================================== -- | SetTransferTimeout | @@ -252,9 +239,9 @@ testChoiceContextCodecRoundtrip = do testSetTransferTimeoutRoundtrip : Script () testSetTransferTimeoutRoundtrip = do -- Test using the params wrapper - let args = SetTransferTimeoutParams with transferTimeout = RelativeHours 48 - encoded = BurnMintTokenPoolCodec.encodeSetTransferTimeoutParams args - fst (fromSome (BurnMintTokenPoolCodec.decodeSetTransferTimeoutParamsAt encoded 0)) === args + let args = CCIP.BurnMintTokenPoolV1.SetTransferTimeoutParams with transferTimeout = CCIP.BurnMintTokenPoolV1.RelativeHours 48 + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetTransferTimeoutParams args + fst (fromSome (CCIP.BurnMintTokenPoolV1CodecGen.decodeSetTransferTimeoutParamsAt encoded 0)) === args -- =========================================================================== -- INVALID DATA REJECTION TESTS @@ -263,12 +250,12 @@ testSetTransferTimeoutRoundtrip = do testInvalidDataRejection : Script () testInvalidDataRejection = do -- Empty data should fail - case BurnMintTokenPoolCodec.decodeApplyChainUpdatesParamsAt "" 0 of + case CCIP.BurnMintTokenPoolV1CodecGen.decodeApplyChainUpdatesParamsAt "" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeApplyChainUpdatesParams to fail on empty data" -- Invalid tag for TransferTimeout should fail - case BurnMintTokenPoolCodec.decodeTransferTimeoutAt "ff" 0 of + case CCIP.BurnMintTokenPoolV1CodecGen.decodeTransferTimeoutAt "ff" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeTransferTimeoutAt to fail on invalid tag" diff --git a/contracts/ccip/test/daml/CCIP/BurnMintTokenPoolTest/BurnMintTokenPoolMCMSTest.daml b/contracts/ccip/test/daml/CCIP/BurnMintTokenPoolTest/BurnMintTokenPoolMCMSTest.daml index 7c3bcccf8..74dad850c 100644 --- a/contracts/ccip/test/daml/CCIP/BurnMintTokenPoolTest/BurnMintTokenPoolMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/BurnMintTokenPoolTest/BurnMintTokenPoolMCMSTest.daml @@ -10,38 +10,29 @@ import DA.Optional (fromSome) import DA.TextMap qualified as TextMap import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.BurnMintTokenPool -import CCIP.BurnMintTokenPoolCodecGen ( - encodeSetDynamicConfigParams, - encodeApplyChainUpdatesParams, - encodeSetRateLimiterReferencesParams, - encodeSetRateLimitConfigParams, - encodeSetTransferTimeoutParams, - encodeAddPoolReceiveContextNonContractValueParams, - encodeAddPoolReceiveContextContractValueParams, - encodeRemovePoolReceiveContextValueParams, - ) - -import CCIP.ContextCodec (encodeAnyValue) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) -import qualified CCIP.RateLimiter - -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 + +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.BurnMintTokenPoolV1 +import qualified CCIP.BurnMintTokenPoolV1CodecGen +import qualified CCIP.RateLimiterV1 +import qualified CCIP.UtilsV1.Context mkFinalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n -dummyPoolDeps : Party -> BurnMintTokenPoolDeps +dummyPoolDeps : Party -> CCIP.BurnMintTokenPoolV1.BurnMintTokenPoolDeps dummyPoolDeps ccipOwner = - BurnMintTokenPoolDeps with - tokenAdminRegistry = RawInstanceAddress ("dummy-tar@" <> partyToText ccipOwner) - rmnRemote = RawInstanceAddress ("dummy-rmn@" <> partyToText ccipOwner) - feeQuoter = RawInstanceAddress ("dummy-fq@" <> partyToText ccipOwner) + CCIP.BurnMintTokenPoolV1.BurnMintTokenPoolDeps with + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress ("dummy-tar@" <> partyToText ccipOwner) + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress ("dummy-rmn@" <> partyToText ccipOwner) + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress ("dummy-fq@" <> partyToText ccipOwner) -- ======================================================== -- | MCMS Entrypoint - SetDynamicConfig | @@ -55,9 +46,9 @@ testBurnMintTokenPoolMCMSEntrypoint_SetDynamicConfig = script do let instanceId = "pool-dynamic-config-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "USDC" - -- Create BurnMintTokenPool with no rate limit admin + -- Create CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with no rate limit admin poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -66,17 +57,17 @@ testBurnMintTokenPoolMCMSEntrypoint_SetDynamicConfig = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Update rate limit admin via mcmsEntrypoint rateLimitAdmin <- allocateParty "rate_limit_admin" let newRateLimitAdmin = Some rateLimitAdmin - let encodedParams = encodeSetDynamicConfigParams (SetDynamicConfigParams with rateLimitAdmin = newRateLimitAdmin) + let encodedParams = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetDynamicConfigParams (CCIP.BurnMintTokenPoolV1.SetDynamicConfigParams with rateLimitAdmin = newRateLimitAdmin) newContractIds <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -85,7 +76,7 @@ testBurnMintTokenPoolMCMSEntrypoint_SetDynamicConfig = script do contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] -- Verify rate limit admin was updated - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do assertMsg ("rateLimitAdmin mismatch, got: " <> show pool.rateLimitAdmin <> ", expected: " <> show newRateLimitAdmin) (pool.rateLimitAdmin == newRateLimitAdmin) @@ -104,9 +95,9 @@ testBurnMintTokenPoolMCMSEntrypoint_ApplyChainUpdates = script do let instanceId = "pool-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "USDC" - -- Create BurnMintTokenPool with no remote chain configs + -- Create CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with no remote chain configs poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -115,28 +106,28 @@ testBurnMintTokenPoolMCMSEntrypoint_ApplyChainUpdates = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Create remote chain config let args = [ - ChainUpdate with + CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = 123.0 remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4", "d7e508a1d4ba82aed19fadcbf6ebd81d2c9b173a"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner", RawInstanceAddress "in2@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner", Chainlink.InstanceAddress.RawInstanceAddress "in2@owner"] outboundCCVs = [] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-new@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-new@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-new@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-new@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-new@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-new@owner" ] - encoded = encodeApplyChainUpdatesParams (ApplyChainUpdatesParams with + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeApplyChainUpdatesParams (CCIP.BurnMintTokenPoolV1.ApplyChainUpdatesParams with remoteChainSelectorsToRemove = [] chainsToAdd = args) @@ -148,7 +139,7 @@ testBurnMintTokenPoolMCMSEntrypoint_ApplyChainUpdates = script do contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] -- Verify chain pool config was added - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do Map.size pool.remoteChainConfigs === 1 @@ -168,19 +159,19 @@ testBurnMintTokenPoolMCMSEntrypoint_UpdateChainPoolConfigs_Multiple = script do let instanceId = "pool-multi-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "LINK" - existingConfig = RemoteChainConfig with + existingConfig = CCIP.BurnMintTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" - inboundCCVs = [RawInstanceAddress "in1@owner"] - outboundCCVs = [RawInstanceAddress "out1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner"] + outboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "out1@owner"] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" - -- Create BurnMintTokenPool with existing remote chain config + -- Create CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with existing remote chain config poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -189,38 +180,38 @@ testBurnMintTokenPoolMCMSEntrypoint_UpdateChainPoolConfigs_Multiple = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(123.0, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) - transferTimeout = RelativeHours 24 + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) + transferTimeout = CCIP.BurnMintTokenPoolV1.RelativeHours 24 deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Create multiple chain pool configs, one to replace existing let args = [ - ChainUpdate with + CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = 123.0 remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4", "d7e508a1d4ba82aed19fadcbf6ebd81d2c9b173a"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner", RawInstanceAddress "in2@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner", Chainlink.InstanceAddress.RawInstanceAddress "in2@owner"] outboundCCVs = [] finalityConfig = mkFinalityConfig 12 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-new@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-new@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-new@owner" - ,ChainUpdate with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-new@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-new@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-new@owner" + ,CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = 456.0 remotePools = ["d3704b816babab425caa936be1eb5b5a9bfb59c7"] remoteTokenAddress = "cf9a923ab9efa0e261608dbd3c40fc0cfabade92" - inboundCCVs = [RawInstanceAddress "in4@owner", RawInstanceAddress "in5@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in4@owner", Chainlink.InstanceAddress.RawInstanceAddress "in5@owner"] outboundCCVs = [] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-2@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-2@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-2@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-2@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-2@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-2@owner" ] - encoded = encodeApplyChainUpdatesParams (ApplyChainUpdatesParams with + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeApplyChainUpdatesParams (CCIP.BurnMintTokenPoolV1.ApplyChainUpdatesParams with remoteChainSelectorsToRemove = [123.0] -- Remove existing chain (123) and add new ones chainsToAdd = args) @@ -232,7 +223,7 @@ testBurnMintTokenPoolMCMSEntrypoint_UpdateChainPoolConfigs_Multiple = script do contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] -- Verify all configs were added/replaced - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do Map.size pool.remoteChainConfigs === 2 @@ -257,19 +248,19 @@ testBurnMintTokenPoolMCMSEntrypoint_SetRateLimiterReferences = script do let instanceId = "pool-multi-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "LINK" - existingConfig = RemoteChainConfig with + existingConfig = CCIP.BurnMintTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" - inboundCCVs = [RawInstanceAddress "in1@owner"] - outboundCCVs = [RawInstanceAddress "out1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner"] + outboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "out1@owner"] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" - -- Create BurnMintTokenPool with existing config + -- Create CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with existing config poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -278,23 +269,23 @@ testBurnMintTokenPoolMCMSEntrypoint_SetRateLimiterReferences = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(123.0, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Create rate limiter config update for existing chain let args = [ - RateLimitConfigArgs with + CCIP.BurnMintTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 123.0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-updated@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-updated@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-updated@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-updated@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-updated@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-updated@owner" ] - encoded = encodeSetRateLimiterReferencesParams (SetRateLimiterReferencesParams with + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetRateLimiterReferencesParams (CCIP.BurnMintTokenPoolV1.SetRateLimiterReferencesParams with rateLimitConfigArgs = args) -- Call mcmsEntrypoint @@ -305,7 +296,7 @@ testBurnMintTokenPoolMCMSEntrypoint_SetRateLimiterReferences = script do contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] -- Verify config was updated - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do case Map.lookup 123.0 pool.remoteChainConfigs of @@ -332,21 +323,21 @@ testBurnMintTokenPoolMCMSEntrypoint_SetRateLimitConfig = script do now <- getTime rlCid <- submit poolOwner do - createCmd CCIP.RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = rlInstanceId poolInstanceId = instanceId poolOwner remoteChainSelector = 123.0 - direction = CCIP.RateLimiter.RateLimitDirection_Inbound - mode = CCIP.RateLimiter.RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Inbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 100.0 rate = 10.0 tokens = 100.0 lastUpdated = now - let rlAddr = RawInstanceAddress.make rlInstanceId poolOwner - let chainConfig = RemoteChainConfig with + let rlAddr = Chainlink.InstanceAddress.make rlInstanceId poolOwner + let chainConfig = CCIP.BurnMintTokenPoolV1.RemoteChainConfig with remotePools = [] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] @@ -357,7 +348,7 @@ testBurnMintTokenPoolMCMSEntrypoint_SetRateLimitConfig = script do outboundRateLimiter = rlAddr poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -366,15 +357,15 @@ testBurnMintTokenPoolMCMSEntrypoint_SetRateLimitConfig = script do rateLimitAdmin = Some rateLimitAdmin remoteChainConfigs = Map.fromList [(123.0, chainConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.toText rlAddr - let poolAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.toText rlAddr + let poolAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - let encoded = encodeSetRateLimitConfigParams (SetRateLimitConfigParams with + let encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetRateLimitConfigParams (CCIP.BurnMintTokenPoolV1.SetRateLimitConfigParams with caller = poolOwner rateLimiterInstanceAddress = rlAddr newIsEnabled = True @@ -390,14 +381,14 @@ testBurnMintTokenPoolMCMSEntrypoint_SetRateLimitConfig = script do , (instAddr, toAnyContractId rlCid) ] - rlContracts <- query @CCIP.RateLimiter.RateLimiter poolOwner + rlContracts <- query @CCIP.RateLimiterV1.RateLimiter poolOwner case filter (\(_, rl) -> rl.instanceId == rlInstanceId) rlContracts of [(_, rl)] -> do rl.capacity === 50.0 rl.rate === 5.0 _ -> abort "Expected exactly one tuned RateLimiter contract" - pools <- query @BurnMintTokenPool poolOwner + pools <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner assertMsg "pool contract must remain after nonconsuming SetRateLimitConfig" (any (\(_, p) -> p.instanceId == instanceId) pools) @@ -417,7 +408,7 @@ testBurnMintTokenPoolMCMSEntrypoint_UnknownFunction = script do instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "TEST" poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -426,11 +417,11 @@ testBurnMintTokenPoolMCMSEntrypoint_UnknownFunction = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Call with unknown function name - should fail @@ -452,7 +443,7 @@ testBurnMintTokenPoolMCMSEntrypoint_InvalidParams = script do instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "TEST" poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -461,11 +452,11 @@ testBurnMintTokenPoolMCMSEntrypoint_InvalidParams = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Call with invalid operationData - should fail @@ -487,7 +478,7 @@ testBurnMintTokenPoolMCMSEntrypoint_MissingSelfCid = script do instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "TEST" poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -496,27 +487,27 @@ testBurnMintTokenPoolMCMSEntrypoint_MissingSelfCid = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Encode valid params let args = [ - ChainUpdate with + CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = 123.0 remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4", "d7e508a1d4ba82aed19fadcbf6ebd81d2c9b173a"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner", RawInstanceAddress "in2@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner", Chainlink.InstanceAddress.RawInstanceAddress "in2@owner"] outboundCCVs = [] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-new@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-new@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-new@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-new@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-new@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-new@owner" ] - encoded = encodeApplyChainUpdatesParams (ApplyChainUpdatesParams with + encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeApplyChainUpdatesParams (CCIP.BurnMintTokenPoolV1.ApplyChainUpdatesParams with remoteChainSelectorsToRemove = [123.0] chainsToAdd = args) @@ -535,7 +526,7 @@ toAnyContractId = coerceContractId -- Assertion helpers -assertChainUpdateEqual : RemoteChainConfig -> ChainUpdate -> Script () +assertChainUpdateEqual : CCIP.BurnMintTokenPoolV1.RemoteChainConfig -> CCIP.BurnMintTokenPoolV1.ChainUpdate -> Script () assertChainUpdateEqual got expected = do assertMsg ("remotePools mismatch, got: " <> show got.remotePools <> ", expected: " <> show expected.remotePools) (got.remotePools == expected.remotePools) assertMsg ("remoteTokenAddress mismatch, got: " <> show got.remoteTokenAddress <> ", expected: " <> show expected.remoteTokenAddress) (got.remoteTokenAddress == expected.remoteTokenAddress) @@ -544,7 +535,7 @@ assertChainUpdateEqual got expected = do assertMsg ("inboundRateLimiter mismatch, got: " <> show got.inboundRateLimiter <> ", expected: " <> show expected.inboundRateLimiter) (got.inboundRateLimiter == expected.inboundRateLimiter) assertMsg ("outboundRateLimiter mismatch, got: " <> show got.outboundRateLimiter <> ", expected: " <> show expected.outboundRateLimiter) (got.outboundRateLimiter == expected.outboundRateLimiter) -assertTokenTransferFeeConfigEqual : TokenTransferFeeConfig -> TokenTransferFeeConfigArgs -> Script () +assertTokenTransferFeeConfigEqual : CCIP.BurnMintTokenPoolV1.TokenTransferFeeConfig -> CCIP.BurnMintTokenPoolV1.TokenTransferFeeConfigArgs -> Script () assertTokenTransferFeeConfigEqual got expected = do assertMsg ("isEnabled mismatch, got: " <> show got.isEnabled <> ", expected: " <> show expected.isEnabled) (got.isEnabled == expected.isEnabled) assertMsg ("destGasOverhead mismatch, got: " <> show got.destGasOverhead <> ", expected: " <> show expected.destGasOverhead) (got.destGasOverhead == expected.destGasOverhead) @@ -552,7 +543,7 @@ assertTokenTransferFeeConfigEqual got expected = do assertMsg ("feeUSDCents mismatch, got: " <> show got.feeUSDCents <> ", expected: " <> show expected.feeUSDCents) (got.feeUSDCents == expected.feeUSDCents) assertMsg ("feeBps mismatch, got: " <> show got.feeBps <> ", expected: " <> show expected.feeBps) (got.feeBps == expected.feeBps) -assertRateLimitConfigArgsEqual : RemoteChainConfig -> RateLimitConfigArgs -> Script () +assertRateLimitConfigArgsEqual : CCIP.BurnMintTokenPoolV1.RemoteChainConfig -> CCIP.BurnMintTokenPoolV1.RateLimitConfigArgs -> Script () assertRateLimitConfigArgsEqual got expected = do assertMsg ("inboundRateLimiter mismatch, got: " <> show got.inboundRateLimiter <> ", expected: " <> show expected.inboundRateLimiter) (got.inboundRateLimiter == expected.inboundRateLimiter) assertMsg ("outboundRateLimiter mismatch, got: " <> show got.outboundRateLimiter <> ", expected: " <> show expected.outboundRateLimiter) (got.outboundRateLimiter == expected.outboundRateLimiter) @@ -570,7 +561,7 @@ testBurnMintTokenPoolMCMSEntrypoint_AddPoolReceiveContextNonContractValue = scri instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "USDC" poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -579,31 +570,31 @@ testBurnMintTokenPoolMCMSEntrypoint_AddPoolReceiveContextNonContractValue = scri rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - let newContext = MetadataV1.ChoiceContext (TextMap.fromList [("key1", MetadataV1.AV_Text "value1"), ("key2", MetadataV1.AV_Int 42)]) - let encoded1 = encodeAddPoolReceiveContextNonContractValueParams (AddPoolReceiveContextNonContractValueParams with contextKey = "key1", valuePayload = encodeAnyValue (MetadataV1.AV_Text "value1")) + let newContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("key1", Splice.Api.Token.MetadataV1.AV_Text "value1"), ("key2", Splice.Api.Token.MetadataV1.AV_Int 42)]) + let encoded1 = CCIP.BurnMintTokenPoolV1CodecGen.encodeAddPoolReceiveContextNonContractValueParams (CCIP.BurnMintTokenPoolV1.AddPoolReceiveContextNonContractValueParams with contextKey = "key1", valuePayload = CCIP.UtilsV1.Context.encodeAnyValue (Splice.Api.Token.MetadataV1.AV_Text "value1")) cidMap1 <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "AddPoolReceiveContextNonContractValue" operationData = encoded1 contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] - let poolCid2 = coerceContractId (fromSome (Map.lookup instAddr cidMap1)) : ContractId BurnMintTokenPool + let poolCid2 = coerceContractId (fromSome (Map.lookup instAddr cidMap1)) : ContractId CCIP.BurnMintTokenPoolV1.BurnMintTokenPool let target2 = toInterfaceContractId @MCMSReceiver poolCid2 - let encoded2 = encodeAddPoolReceiveContextNonContractValueParams (AddPoolReceiveContextNonContractValueParams with contextKey = "key2", valuePayload = encodeAnyValue (MetadataV1.AV_Int 42)) + let encoded2 = CCIP.BurnMintTokenPoolV1CodecGen.encodeAddPoolReceiveContextNonContractValueParams (CCIP.BurnMintTokenPoolV1.AddPoolReceiveContextNonContractValueParams with contextKey = "key2", valuePayload = CCIP.UtilsV1.Context.encodeAnyValue (Splice.Api.Token.MetadataV1.AV_Int 42)) _ <- submit poolOwner do exerciseCmd target2 MCMSReceiver_Entrypoint with functionName = "AddPoolReceiveContextNonContractValue" operationData = encoded2 contractIds = Map.fromList [(instAddr, toAnyContractId poolCid2)] - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do assertMsg ("poolReceiveContext mismatch, got: " <> show pool.poolReceiveContext <> ", expected: " <> show newContext) (pool.poolReceiveContext == newContext) @@ -616,10 +607,10 @@ testBurnMintTokenPoolMCMSEntrypoint_ClearPoolReceiveContext = script do let instanceId = "pool-context-empty-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "LINK" - initialContext = MetadataV1.ChoiceContext (TextMap.fromList [("existing", MetadataV1.AV_Text "data")]) + initialContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("existing", Splice.Api.Token.MetadataV1.AV_Text "data")]) poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -629,20 +620,20 @@ testBurnMintTokenPoolMCMSEntrypoint_ClearPoolReceiveContext = script do remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty poolReceiveContext = initialContext - transferTimeout = Indefinite + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - let emptyContext = MetadataV1.emptyChoiceContext + let emptyContext = Splice.Api.Token.MetadataV1.emptyChoiceContext _ <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "ClearPoolReceiveContext" operationData = "" contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do assertMsg ("poolReceiveContext should be empty") (pool.poolReceiveContext == emptyContext) @@ -657,7 +648,7 @@ testBurnMintTokenPoolMCMSEntrypoint_AddPoolReceiveContextContractValue = script instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "USDC" poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -666,13 +657,13 @@ testBurnMintTokenPoolMCMSEntrypoint_AddPoolReceiveContextContractValue = script rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - let encoded = encodeAddPoolReceiveContextContractValueParams (AddPoolReceiveContextContractValueParams with contextKey = "selfRef", referentInstanceAddress = RawInstanceAddress instAddr) + let encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeAddPoolReceiveContextContractValueParams (CCIP.BurnMintTokenPoolV1.AddPoolReceiveContextContractValueParams with contextKey = "selfRef", referentInstanceAddress = Chainlink.InstanceAddress.RawInstanceAddress instAddr) _ <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -680,10 +671,10 @@ testBurnMintTokenPoolMCMSEntrypoint_AddPoolReceiveContextContractValue = script operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do - let expected = MetadataV1.ChoiceContext (TextMap.fromList [("selfRef", MetadataV1.AV_ContractId (coerceContractId poolCid))]) + let expected = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("selfRef", Splice.Api.Token.MetadataV1.AV_ContractId (coerceContractId poolCid))]) assertMsg ("poolReceiveContext mismatch, got: " <> show pool.poolReceiveContext) (pool.poolReceiveContext == expected) _ -> abort "Expected exactly one BurnMintTokenPool contract" @@ -694,10 +685,10 @@ testBurnMintTokenPoolMCMSEntrypoint_RemovePoolReceiveContextValue = script do let instanceId = "pool-context-remove-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "USDC" - initialContext = MetadataV1.ChoiceContext (TextMap.fromList [("keep", MetadataV1.AV_Text "me"), ("remove", MetadataV1.AV_Int 99)]) + initialContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("keep", Splice.Api.Token.MetadataV1.AV_Text "me"), ("remove", Splice.Api.Token.MetadataV1.AV_Int 99)]) poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -707,12 +698,12 @@ testBurnMintTokenPoolMCMSEntrypoint_RemovePoolReceiveContextValue = script do remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty poolReceiveContext = initialContext - transferTimeout = Indefinite + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - let encoded = encodeRemovePoolReceiveContextValueParams (RemovePoolReceiveContextValueParams with contextKey = "remove") + let encoded = CCIP.BurnMintTokenPoolV1CodecGen.encodeRemovePoolReceiveContextValueParams (CCIP.BurnMintTokenPoolV1.RemovePoolReceiveContextValueParams with contextKey = "remove") _ <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -720,10 +711,10 @@ testBurnMintTokenPoolMCMSEntrypoint_RemovePoolReceiveContextValue = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do - let expected = MetadataV1.ChoiceContext (TextMap.fromList [("keep", MetadataV1.AV_Text "me")]) + let expected = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("keep", Splice.Api.Token.MetadataV1.AV_Text "me")]) assertMsg ("poolReceiveContext mismatch, got: " <> show pool.poolReceiveContext) (pool.poolReceiveContext == expected) _ -> abort "Expected exactly one BurnMintTokenPool contract" @@ -739,9 +730,9 @@ testBurnMintTokenPoolMCMSEntrypoint_SetTransferTimeout_Indefinite = script do let instanceId = "pool-timeout-indefinite-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "USDC" - -- Create BurnMintTokenPool with RelativeHours timeout + -- Create CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with RelativeHours timeout poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -750,16 +741,16 @@ testBurnMintTokenPoolMCMSEntrypoint_SetTransferTimeout_Indefinite = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = RelativeHours 24 + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.RelativeHours 24 deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - -- Change to Indefinite - let newTimeout = Indefinite - let encodedParams = encodeSetTransferTimeoutParams (SetTransferTimeoutParams with transferTimeout = newTimeout) + -- Change to CCIP.BurnMintTokenPoolV1.Indefinite + let newTimeout = CCIP.BurnMintTokenPoolV1.Indefinite + let encodedParams = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetTransferTimeoutParams (CCIP.BurnMintTokenPoolV1.SetTransferTimeoutParams with transferTimeout = newTimeout) newContractIds <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -768,7 +759,7 @@ testBurnMintTokenPoolMCMSEntrypoint_SetTransferTimeout_Indefinite = script do contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] -- Verify timeout was updated - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do assertMsg ("transferTimeout mismatch, got: " <> show pool.transferTimeout <> ", expected: " <> show newTimeout) (pool.transferTimeout == newTimeout) @@ -782,9 +773,9 @@ testBurnMintTokenPoolMCMSEntrypoint_SetTransferTimeout_RelativeHours = script do let instanceId = "pool-timeout-hours-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "LINK" - -- Create BurnMintTokenPool with Indefinite timeout + -- Create CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with CCIP.BurnMintTokenPoolV1.Indefinite timeout poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -793,16 +784,16 @@ testBurnMintTokenPoolMCMSEntrypoint_SetTransferTimeout_RelativeHours = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Change to RelativeHours 48 - let newTimeout = RelativeHours 48 - let encodedParams = encodeSetTransferTimeoutParams (SetTransferTimeoutParams with transferTimeout = newTimeout) + let newTimeout = CCIP.BurnMintTokenPoolV1.RelativeHours 48 + let encodedParams = CCIP.BurnMintTokenPoolV1CodecGen.encodeSetTransferTimeoutParams (CCIP.BurnMintTokenPoolV1.SetTransferTimeoutParams with transferTimeout = newTimeout) newContractIds <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -811,7 +802,7 @@ testBurnMintTokenPoolMCMSEntrypoint_SetTransferTimeout_RelativeHours = script do contractIds = Map.fromList [(instAddr, toAnyContractId poolCid)] -- Verify timeout was updated - contracts <- query @BurnMintTokenPool poolOwner + contracts <- query @CCIP.BurnMintTokenPoolV1.BurnMintTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do assertMsg ("transferTimeout mismatch, got: " <> show pool.transferTimeout <> ", expected: " <> show newTimeout) (pool.transferTimeout == newTimeout) @@ -827,7 +818,7 @@ testBurnMintTokenPoolMCMSEntrypoint_SetTransferTimeout_InvalidData = script do instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "TEST" poolCid <- submit poolOwner do - createCmd BurnMintTokenPool with + createCmd CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -836,11 +827,11 @@ testBurnMintTokenPoolMCMSEntrypoint_SetTransferTimeout_InvalidData = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Call with invalid tag byte - should fail @@ -859,16 +850,16 @@ testBurnMintTokenPool_RejectsInvalidBlockDepthConfig = script do let instanceId = "pool-blockdepth-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "USDC" - mkRemoteConfig finality = RemoteChainConfig with + mkRemoteConfig finality = CCIP.BurnMintTokenPoolV1.RemoteChainConfig with remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner"] outboundCCVs = [] finalityConfig = finality - inboundRateLimiter = RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out@owner" - mkPool remoteChainConfigs = BurnMintTokenPool with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + mkPool remoteChainConfigs = CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -877,44 +868,44 @@ testBurnMintTokenPool_RejectsInvalidBlockDepthConfig = script do rateLimitAdmin = None remoteChainConfigs tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner submitMustFail poolOwner do - createCmd (mkPool (Map.fromList [(123.0, mkRemoteConfig (FinalityCodec.BlockDepth 0))])) + createCmd (mkPool (Map.fromList [(123.0, mkRemoteConfig (CCIP.CodecV1.FinalityConfig.BlockDepth 0))])) submitMustFail poolOwner do - createCmd (mkPool (Map.fromList [(123.0, mkRemoteConfig (FinalityCodec.BlockDepth (-1)))])) + createCmd (mkPool (Map.fromList [(123.0, mkRemoteConfig (CCIP.CodecV1.FinalityConfig.BlockDepth (-1)))])) poolCid <- submit poolOwner do createCmd (mkPool Map.empty) - let mkUpdate finality = ChainUpdate with + let mkUpdate finality = CCIP.BurnMintTokenPoolV1.ChainUpdate with remoteChainSelector = 123.0 remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner"] outboundCCVs = [] finalityConfig = finality - inboundRateLimiter = RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" submitMustFail poolOwner do - exerciseCmd poolCid ApplyChainUpdates with + exerciseCmd poolCid CCIP.BurnMintTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] - chainsToAdd = [mkUpdate (FinalityCodec.BlockDepth 0)] + chainsToAdd = [mkUpdate (CCIP.CodecV1.FinalityConfig.BlockDepth 0)] submitMustFail poolOwner do - exerciseCmd poolCid ApplyChainUpdates with + exerciseCmd poolCid CCIP.BurnMintTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] - chainsToAdd = [mkUpdate (FinalityCodec.BlockDepth (-1))] + chainsToAdd = [mkUpdate (CCIP.CodecV1.FinalityConfig.BlockDepth (-1))] _ <- submit poolOwner do - exerciseCmd poolCid ApplyChainUpdates with + exerciseCmd poolCid CCIP.BurnMintTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] - chainsToAdd = [mkUpdate (FinalityCodec.BlockDepth 1)] + chainsToAdd = [mkUpdate (CCIP.CodecV1.FinalityConfig.BlockDepth 1)] pure () @@ -925,7 +916,7 @@ testBurnMintTokenPool_RejectsInvalidDecimals = script do let instanceId = "pool-decimals-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId poolOwner "USDC" - mkPool decimals = BurnMintTokenPool with + mkPool decimals = CCIP.BurnMintTokenPoolV1.BurnMintTokenPool with instanceId poolOwner ccipOwner @@ -934,8 +925,8 @@ testBurnMintTokenPool_RejectsInvalidDecimals = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite deps = dummyPoolDeps ccipOwner submitMustFail poolOwner do diff --git a/contracts/ccip/test/daml/CCIP/CommitteeVerifierTest/CommitteeVerifierCodecTest.daml b/contracts/ccip/test/daml/CCIP/CommitteeVerifierTest/CommitteeVerifierCodecTest.daml index 97277517d..706717480 100644 --- a/contracts/ccip/test/daml/CCIP/CommitteeVerifierTest/CommitteeVerifierCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/CommitteeVerifierTest/CommitteeVerifierCodecTest.daml @@ -4,8 +4,10 @@ import Daml.Script import DA.Assert ((===)) import DA.Optional (fromSome) -import CCIP.CommitteeVerifierCodecGen qualified as CommitteeVerifierCodec -import CCIP.CommitteeVerifierTypes ( +import qualified Chainlink.InstanceAddress + +import CCIP.CommitteeVerifierV1.CommitteeVerifierCodecGen qualified as CommitteeVerifierCodec +import CCIP.CommitteeVerifierV1.CommitteeVerifierTypes ( SignatureConfig(..), DynamicConfig(..), RemoteChainConfigArgs(..), @@ -18,7 +20,6 @@ import CCIP.CommitteeVerifierTypes ( TransferStorageLocationsAdminParams(..), UpdateStorageLocationsParams(..), ) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -- =============================================== -- | ApplySignatureConfigs | @@ -166,6 +167,6 @@ testSetDepsParamsRoundtrip = do encoded = CommitteeVerifierCodec.encodeSetDepsParams args fst (fromSome (CommitteeVerifierCodec.decodeSetDepsParamsAt encoded 0)) === args -- non-empty args - let args = SetDepsParams with rmnRemote = Some (RawInstanceAddress.RawInstanceAddress "0x1234567890abcdef") + let args = SetDepsParams with rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "0x1234567890abcdef") encoded = CommitteeVerifierCodec.encodeSetDepsParams args fst (fromSome (CommitteeVerifierCodec.decodeSetDepsParamsAt encoded 0)) === args diff --git a/contracts/ccip/test/daml/CCIP/ExecutorTest/ExecutorCodecTest.daml b/contracts/ccip/test/daml/CCIP/ExecutorTest/ExecutorCodecTest.daml index 0e358abdf..8b8a49db1 100644 --- a/contracts/ccip/test/daml/CCIP/ExecutorTest/ExecutorCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/ExecutorTest/ExecutorCodecTest.daml @@ -5,22 +5,16 @@ import Daml.Script import DA.Assert ((===)) import DA.Optional (fromSome) -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.ExecutorCodecGen qualified as ExecutorCodecGen -import CCIP.ExecutorTypes ( - RemoteChainConfig(..), - RemoteChainConfigArgs(..), - DynamicConfig(..), - ApplyDestChainUpdatesParams(..), - SetDynamicConfigParams(..), - ApplyAllowedCCVUpdatesParams(..), - ) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.ExecutorV1 +import qualified CCIP.ExecutorV1.ExecutorCodecGen finalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n -- =============================================== -- | ApplyDestChainUpdates | @@ -29,33 +23,33 @@ finalityConfig n = testApplyDestChainUpdatesParamsRoundtrip : Script () testApplyDestChainUpdatesParamsRoundtrip = do -- empty args - let args = ApplyDestChainUpdatesParams with + let args = CCIP.ExecutorV1.ApplyDestChainUpdatesParams with destChainSelectorsToRemove = [] destChainSelectorsToAdd = [] - encoded = ExecutorCodecGen.encodeApplyDestChainUpdatesParams args - fst (fromSome (ExecutorCodecGen.decodeApplyDestChainUpdatesParamsAt encoded 0)) === args + encoded = CCIP.ExecutorV1.ExecutorCodecGen.encodeApplyDestChainUpdatesParams args + fst (fromSome (CCIP.ExecutorV1.ExecutorCodecGen.decodeApplyDestChainUpdatesParamsAt encoded 0)) === args -- non-empty args - let args = ApplyDestChainUpdatesParams with + let args = CCIP.ExecutorV1.ApplyDestChainUpdatesParams with destChainSelectorsToRemove = [2.0, 3.0] destChainSelectorsToAdd = - [ RemoteChainConfigArgs with + [ CCIP.ExecutorV1.RemoteChainConfigArgs with destChainSelector = 1.0 - config = RemoteChainConfig with + config = CCIP.ExecutorV1.RemoteChainConfig with feeUSDCents = 100.0 enabled = True - , RemoteChainConfigArgs with + , CCIP.ExecutorV1.RemoteChainConfigArgs with destChainSelector = 18446744073709551615.0 -- max uint64 - config = RemoteChainConfig with + config = CCIP.ExecutorV1.RemoteChainConfig with feeUSDCents = 0.0 enabled = False - , RemoteChainConfigArgs with + , CCIP.ExecutorV1.RemoteChainConfigArgs with destChainSelector = 0.0 - config = RemoteChainConfig with + config = CCIP.ExecutorV1.RemoteChainConfig with feeUSDCents = 999.0 enabled = True ] - encoded = ExecutorCodecGen.encodeApplyDestChainUpdatesParams args - fst (fromSome (ExecutorCodecGen.decodeApplyDestChainUpdatesParamsAt encoded 0)) === args + encoded = CCIP.ExecutorV1.ExecutorCodecGen.encodeApplyDestChainUpdatesParams args + fst (fromSome (CCIP.ExecutorV1.ExecutorCodecGen.decodeApplyDestChainUpdatesParamsAt encoded 0)) === args -- =============================================== -- | SetDynamicConfig | @@ -64,40 +58,40 @@ testApplyDestChainUpdatesParamsRoundtrip = do testSetDynamicConfigParamsRoundtrip : Script () testSetDynamicConfigParamsRoundtrip = do -- with feeAggregator = None - let args = SetDynamicConfigParams with - newDynamicConfig = DynamicConfig with + let args = CCIP.ExecutorV1.SetDynamicConfigParams with + newDynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None allowedFinalityConfig = finalityConfig 0 ccvAllowlistEnabled = False - encoded = ExecutorCodecGen.encodeSetDynamicConfigParams args - fst (fromSome (ExecutorCodecGen.decodeSetDynamicConfigParamsAt encoded 0)) === args + encoded = CCIP.ExecutorV1.ExecutorCodecGen.encodeSetDynamicConfigParams args + fst (fromSome (CCIP.ExecutorV1.ExecutorCodecGen.decodeSetDynamicConfigParamsAt encoded 0)) === args -- with feeAggregator = Some feeAgg <- allocateParty "fee_aggregator" - let args = SetDynamicConfigParams with - newDynamicConfig = DynamicConfig with + let args = CCIP.ExecutorV1.SetDynamicConfigParams with + newDynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = Some feeAgg allowedFinalityConfig = finalityConfig 7 ccvAllowlistEnabled = True - encoded = ExecutorCodecGen.encodeSetDynamicConfigParams args - fst (fromSome (ExecutorCodecGen.decodeSetDynamicConfigParamsAt encoded 0)) === args + encoded = CCIP.ExecutorV1.ExecutorCodecGen.encodeSetDynamicConfigParams args + fst (fromSome (CCIP.ExecutorV1.ExecutorCodecGen.decodeSetDynamicConfigParamsAt encoded 0)) === args testSetDynamicConfigParamsRejectsInvalidBlockDepth : Script () testSetDynamicConfigParamsRejectsInvalidBlockDepth = do let encodeWith finality = - ExecutorCodecGen.encodeSetDynamicConfigParams (SetDynamicConfigParams with - newDynamicConfig = DynamicConfig with + CCIP.ExecutorV1.ExecutorCodecGen.encodeSetDynamicConfigParams (CCIP.ExecutorV1.SetDynamicConfigParams with + newDynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None allowedFinalityConfig = finality ccvAllowlistEnabled = False) assertDecodeFails finality = - case ExecutorCodecGen.decodeSetDynamicConfigParamsAt (encodeWith finality) 0 of + case CCIP.ExecutorV1.ExecutorCodecGen.decodeSetDynamicConfigParamsAt (encodeWith finality) 0 of None -> pure () Some _ -> abort "expected SetDynamicConfig decode to reject invalid BlockDepth" - assertDecodeFails (FinalityCodec.BlockDepth 0) - assertDecodeFails (FinalityCodec.BlockDepth (-1)) - assertDecodeFails (FinalityCodec.BlockDepth 65536) - assertDecodeFails (FinalityCodec.BlockDepth 70000) + assertDecodeFails (CCIP.CodecV1.FinalityConfig.BlockDepth 0) + assertDecodeFails (CCIP.CodecV1.FinalityConfig.BlockDepth (-1)) + assertDecodeFails (CCIP.CodecV1.FinalityConfig.BlockDepth 65536) + assertDecodeFails (CCIP.CodecV1.FinalityConfig.BlockDepth 70000) -- =============================================== -- | ApplyAllowedCCVUpdates | @@ -106,16 +100,16 @@ testSetDynamicConfigParamsRejectsInvalidBlockDepth = do testApplyAllowedCCVUpdatesParamsRoundtrip : Script () testApplyAllowedCCVUpdatesParamsRoundtrip = do -- empty args - let args = ApplyAllowedCCVUpdatesParams with + let args = CCIP.ExecutorV1.ApplyAllowedCCVUpdatesParams with ccvsToRemove = [] ccvsToAdd = [] ccvAllowlistEnabled = False - encoded = ExecutorCodecGen.encodeApplyAllowedCCVUpdatesParams args - fst (fromSome (ExecutorCodecGen.decodeApplyAllowedCCVUpdatesParamsAt encoded 0)) === args + encoded = CCIP.ExecutorV1.ExecutorCodecGen.encodeApplyAllowedCCVUpdatesParams args + fst (fromSome (CCIP.ExecutorV1.ExecutorCodecGen.decodeApplyAllowedCCVUpdatesParamsAt encoded 0)) === args -- non-empty args - let args = ApplyAllowedCCVUpdatesParams with - ccvsToRemove = [RawInstanceAddress "ccv-remove-1@party1", RawInstanceAddress "ccv-remove-2@party2"] - ccvsToAdd = [RawInstanceAddress "ccv-add-1@party3", RawInstanceAddress "ccv-add-2@party4"] + let args = CCIP.ExecutorV1.ApplyAllowedCCVUpdatesParams with + ccvsToRemove = [Chainlink.InstanceAddress.RawInstanceAddress "ccv-remove-1@party1", Chainlink.InstanceAddress.RawInstanceAddress "ccv-remove-2@party2"] + ccvsToAdd = [Chainlink.InstanceAddress.RawInstanceAddress "ccv-add-1@party3", Chainlink.InstanceAddress.RawInstanceAddress "ccv-add-2@party4"] ccvAllowlistEnabled = True - encoded = ExecutorCodecGen.encodeApplyAllowedCCVUpdatesParams args - fst (fromSome (ExecutorCodecGen.decodeApplyAllowedCCVUpdatesParamsAt encoded 0)) === args + encoded = CCIP.ExecutorV1.ExecutorCodecGen.encodeApplyAllowedCCVUpdatesParams args + fst (fromSome (CCIP.ExecutorV1.ExecutorCodecGen.decodeApplyAllowedCCVUpdatesParamsAt encoded 0)) === args diff --git a/contracts/ccip/test/daml/CCIP/ExecutorTest/ExecutorFinalityValidationTest.daml b/contracts/ccip/test/daml/CCIP/ExecutorTest/ExecutorFinalityValidationTest.daml index e61ce197e..2f569c150 100644 --- a/contracts/ccip/test/daml/CCIP/ExecutorTest/ExecutorFinalityValidationTest.daml +++ b/contracts/ccip/test/daml/CCIP/ExecutorTest/ExecutorFinalityValidationTest.daml @@ -3,16 +3,15 @@ module ExecutorTest.ExecutorFinalityValidationTest where import Daml.Script import DA.Map qualified as Map -import qualified CCIP.Executor -import qualified CCIP.FinalityConfig -import CCIP.ExecutorTypes (DynamicConfig(..)) +import qualified CCIP.ExecutorV1 +import qualified CCIP.CodecV1.FinalityConfig -mkExecutorWith : Party -> CCIP.FinalityConfig.FinalityConfig -> CCIP.Executor.Executor -mkExecutorWith owner finality = CCIP.Executor.Executor with +mkExecutorWith : Party -> CCIP.CodecV1.FinalityConfig.FinalityConfig -> CCIP.ExecutorV1.Executor +mkExecutorWith owner finality = CCIP.ExecutorV1.Executor with instanceId = "executor-finality-test" owner maxCCVsPerMsg = 10 - dynamicConfig = DynamicConfig with + dynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None allowedFinalityConfig = finality ccvAllowlistEnabled = False @@ -24,13 +23,13 @@ testExecutor_Create_RejectsInvalidBlockDepth = script do owner <- allocateParty "executor_owner" submitMustFail owner do - createCmd (mkExecutorWith owner (CCIP.FinalityConfig.BlockDepth 0)) + createCmd (mkExecutorWith owner (CCIP.CodecV1.FinalityConfig.BlockDepth 0)) submitMustFail owner do - createCmd (mkExecutorWith owner (CCIP.FinalityConfig.BlockDepth (-1))) + createCmd (mkExecutorWith owner (CCIP.CodecV1.FinalityConfig.BlockDepth (-1))) _ <- submit owner do - createCmd (mkExecutorWith owner (CCIP.FinalityConfig.BlockDepth 1)) + createCmd (mkExecutorWith owner (CCIP.CodecV1.FinalityConfig.BlockDepth 1)) pure () testExecutor_SetDynamicConfig_RejectsInvalidBlockDepth : Script () @@ -38,25 +37,25 @@ testExecutor_SetDynamicConfig_RejectsInvalidBlockDepth = script do owner <- allocateParty "executor_owner" executorCid <- submit owner do - createCmd (mkExecutorWith owner CCIP.FinalityConfig.WaitForFinality) + createCmd (mkExecutorWith owner CCIP.CodecV1.FinalityConfig.WaitForFinality) - let baseConfig = DynamicConfig with + let baseConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None - allowedFinalityConfig = CCIP.FinalityConfig.WaitForFinality + allowedFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality ccvAllowlistEnabled = False submitMustFail owner do - exerciseCmd executorCid CCIP.Executor.SetDynamicConfig with + exerciseCmd executorCid CCIP.ExecutorV1.SetDynamicConfig with newDynamicConfig = baseConfig with - allowedFinalityConfig = CCIP.FinalityConfig.BlockDepth 0 + allowedFinalityConfig = CCIP.CodecV1.FinalityConfig.BlockDepth 0 submitMustFail owner do - exerciseCmd executorCid CCIP.Executor.SetDynamicConfig with + exerciseCmd executorCid CCIP.ExecutorV1.SetDynamicConfig with newDynamicConfig = baseConfig with - allowedFinalityConfig = CCIP.FinalityConfig.BlockDepth (-7) + allowedFinalityConfig = CCIP.CodecV1.FinalityConfig.BlockDepth (-7) _ <- submit owner do - exerciseCmd executorCid CCIP.Executor.SetDynamicConfig with + exerciseCmd executorCid CCIP.ExecutorV1.SetDynamicConfig with newDynamicConfig = baseConfig with - allowedFinalityConfig = CCIP.FinalityConfig.BlockDepth 42 + allowedFinalityConfig = CCIP.CodecV1.FinalityConfig.BlockDepth 42 pure () diff --git a/contracts/ccip/test/daml/CCIP/FactoryTest/FactoryCodecTest.daml b/contracts/ccip/test/daml/CCIP/FactoryTest/FactoryCodecTest.daml index 73e591e24..0be52f9fa 100644 --- a/contracts/ccip/test/daml/CCIP/FactoryTest/FactoryCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/FactoryTest/FactoryCodecTest.daml @@ -6,6 +6,9 @@ import DA.Assert ((===)) import DA.Optional (fromSome) import DA.Crypto.Text (BytesHex) +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + import MCMS.Codec ( encodeText , encodeNumeric0 @@ -19,89 +22,83 @@ import MCMS.Codec , encodeList , encodeOptional ) -import CCIP.Codec - ( encodeInstrumentId - , encodeRawInstanceAddress - ) -import qualified Splice.Api.Token.HoldingV1 -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.Factory -import qualified CCIP.CommitteeVerifier -import Chainlink.InstanceAddress (RawInstanceAddress(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.RateLimiter (RateLimitDirection(..), RateLimitMode(..)) -import CCIP.ContextCodec (encodeChoiceContext) -import CCIP.LockReleaseTokenPoolCodecGen (encodeTransferTimeout) -import qualified CCIP.BurnMintTokenPoolCodecGen -import qualified CCIP.BurnMintTokenPoolTypes -import CCIP.LockReleaseTokenPoolTypes (TransferTimeout(..)) -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 +import qualified Chainlink.InstanceAddress + +import qualified CCIP.BurnMintTokenPoolV1 +import qualified CCIP.BurnMintTokenPoolV1CodecGen +import qualified CCIP.CodecV1 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CommitteeVerifierV1 +import qualified CCIP.FactoryV1 +import qualified CCIP.LockReleaseTokenPoolV1 +import qualified CCIP.LockReleaseTokenPoolV1CodecGen +import qualified CCIP.RateLimiterV1 +import qualified CCIP.UtilsV1.Context finalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n -encodeRequestedFinality : FinalityCodec.FinalityConfig -> BytesHex +encodeRequestedFinality : CCIP.CodecV1.FinalityConfig.FinalityConfig -> BytesHex encodeRequestedFinality requestedFinality = case requestedFinality of - FinalityCodec.WaitForFinality -> fromSome (encodeUint8 0) - FinalityCodec.WaitForSafe -> fromSome (encodeUint8 1) - FinalityCodec.BlockDepth depth -> + CCIP.CodecV1.FinalityConfig.WaitForFinality -> fromSome (encodeUint8 0) + CCIP.CodecV1.FinalityConfig.WaitForSafe -> fromSome (encodeUint8 1) + CCIP.CodecV1.FinalityConfig.BlockDepth depth -> fromSome (encodeUint8 2) <> fromSome (encodeInt64 depth) -- =========================================================================== -- ENCODER FUNCTIONS FOR DEPLOY PARAMS -- =========================================================================== -encodeDeployGlobalConfigParams : DeployGlobalConfigParams -> BytesHex +encodeDeployGlobalConfigParams : CCIP.FactoryV1.DeployGlobalConfigParams -> BytesHex encodeDeployGlobalConfigParams params = encodeText params.instanceId <> encodeNumeric0 params.chainSelector -encodeDeployFeeQuoterParams : DeployFeeQuoterParams -> BytesHex +encodeDeployFeeQuoterParams : CCIP.FactoryV1.DeployFeeQuoterParams -> BytesHex encodeDeployFeeQuoterParams params = encodeText params.instanceId - <> encodeInstrumentId params.linkTokenInstrumentId + <> CCIP.CodecV1.encodeInstrumentId params.linkTokenInstrumentId -encodeDeployLinkTokenParams : DeployLinkTokenParams -> BytesHex +encodeDeployLinkTokenParams : CCIP.FactoryV1.DeployLinkTokenParams -> BytesHex encodeDeployLinkTokenParams params = encodeText params.instanceId - <> encodeInstrumentId params.instrumentId + <> CCIP.CodecV1.encodeInstrumentId params.instrumentId -encodeDeployTokenAdminRegistryParams : DeployTokenAdminRegistryParams -> BytesHex +encodeDeployTokenAdminRegistryParams : CCIP.FactoryV1.DeployTokenAdminRegistryParams -> BytesHex encodeDeployTokenAdminRegistryParams params = encodeText params.instanceId -encodeDeployOnRampParams : DeployOnRampParams -> BytesHex +encodeDeployOnRampParams : CCIP.FactoryV1.DeployOnRampParams -> BytesHex encodeDeployOnRampParams params = encodeText params.instanceId - <> encodeRawInstanceAddress params.globalConfig - <> encodeRawInstanceAddress params.rmnRemote - <> encodeRawInstanceAddress params.tokenAdminRegistry - <> encodeRawInstanceAddress params.feeQuoter - <> encodeRawInstanceAddress params.ccvRegistry + <> CCIP.CodecV1.encodeRawInstanceAddress params.globalConfig + <> CCIP.CodecV1.encodeRawInstanceAddress params.rmnRemote + <> CCIP.CodecV1.encodeRawInstanceAddress params.tokenAdminRegistry + <> CCIP.CodecV1.encodeRawInstanceAddress params.feeQuoter <> encodeNumeric0 params.maxUSDCentsPerMsg -encodeDeployOffRampParams : DeployOffRampParams -> BytesHex +encodeDeployOffRampParams : CCIP.FactoryV1.DeployOffRampParams -> BytesHex encodeDeployOffRampParams params = encodeText params.instanceId - <> encodeRawInstanceAddress params.globalConfig - <> encodeRawInstanceAddress params.rmnRemote - <> encodeRawInstanceAddress params.tokenAdminRegistry + <> CCIP.CodecV1.encodeRawInstanceAddress params.globalConfig + <> CCIP.CodecV1.encodeRawInstanceAddress params.rmnRemote + <> CCIP.CodecV1.encodeRawInstanceAddress params.tokenAdminRegistry -encodeDeployPerPartyRouterFactoryParams : DeployPerPartyRouterFactoryParams -> BytesHex +encodeDeployPerPartyRouterFactoryParams : CCIP.FactoryV1.DeployPerPartyRouterFactoryParams -> BytesHex encodeDeployPerPartyRouterFactoryParams params = encodeText params.instanceId - <> encodeRawInstanceAddress params.onRamp - <> encodeRawInstanceAddress params.offRamp - <> encodeRawInstanceAddress params.globalConfig - <> encodeRawInstanceAddress params.tokenAdminRegistry - <> encodeRawInstanceAddress params.feeQuoter - <> encodeRawInstanceAddress params.rmnRemote - -encodeDeployRMNRemoteParams : DeployRMNRemoteParams -> BytesHex + <> CCIP.CodecV1.encodeRawInstanceAddress params.onRamp + <> CCIP.CodecV1.encodeRawInstanceAddress params.offRamp + <> CCIP.CodecV1.encodeRawInstanceAddress params.globalConfig + <> CCIP.CodecV1.encodeRawInstanceAddress params.tokenAdminRegistry + <> CCIP.CodecV1.encodeRawInstanceAddress params.feeQuoter + <> CCIP.CodecV1.encodeRawInstanceAddress params.rmnRemote + +encodeDeployRMNRemoteParams : CCIP.FactoryV1.DeployRMNRemoteParams -> BytesHex encodeDeployRMNRemoteParams params = encodeText params.instanceId <> encodeParty params.rmnOwner @@ -109,7 +106,7 @@ encodeDeployRMNRemoteParams params = <> encodePartyList params.customObservers <> encodeBytesHexList params.cursedSubjects -encodeDeployCommitteeVerifierParams : DeployCommitteeVerifierParams -> BytesHex +encodeDeployCommitteeVerifierParams : CCIP.FactoryV1.DeployCommitteeVerifierParams -> BytesHex encodeDeployCommitteeVerifierParams params = encodeText params.instanceId <> encodeParty params.owner @@ -117,12 +114,12 @@ encodeDeployCommitteeVerifierParams params = <> encodeBytesHex params.versionTag <> encodeOptional params.allowListAdmin encodeParty <> encodePartyList params.messageSentObservers - <> encodeRawInstanceAddress params.rmnRemote + <> CCIP.CodecV1.encodeRawInstanceAddress params.rmnRemote <> encodeList params.storageLocations encodeText <> encodeParty params.storageLocationsAdmin <> encodeParty params.pendingStorageLocationsAdmin -encodeDeployExecutorParams : DeployExecutorParams -> BytesHex +encodeDeployExecutorParams : CCIP.FactoryV1.DeployExecutorParams -> BytesHex encodeDeployExecutorParams params = encodeText params.instanceId <> encodeParty params.owner @@ -130,43 +127,43 @@ encodeDeployExecutorParams params = <> encodeRequestedFinality params.allowedFinalityConfig <> encodeBool params.ccvAllowlistEnabled -encodeDeployLockReleaseTokenPoolParams : DeployLockReleaseTokenPoolParams -> BytesHex +encodeDeployLockReleaseTokenPoolParams : CCIP.FactoryV1.DeployLockReleaseTokenPoolParams -> BytesHex encodeDeployLockReleaseTokenPoolParams params = encodeText params.instanceId <> encodeParty params.poolOwner <> encodeParty params.ccipOwner - <> encodeInstrumentId params.instrumentId + <> CCIP.CodecV1.encodeInstrumentId params.instrumentId <> fromSome (encodeInt64 params.decimals) <> encodeOptional params.rateLimitAdmin encodeParty - <> encodeRawInstanceAddress params.tokenAdminRegistry - <> encodeRawInstanceAddress params.feeQuoter - <> encodeRawInstanceAddress params.rmnRemote - <> encodeChoiceContext params.poolReceiveContext - <> encodeTransferTimeout params.transferTimeout + <> CCIP.CodecV1.encodeRawInstanceAddress params.tokenAdminRegistry + <> CCIP.CodecV1.encodeRawInstanceAddress params.feeQuoter + <> CCIP.CodecV1.encodeRawInstanceAddress params.rmnRemote + <> CCIP.UtilsV1.Context.encodeChoiceContext params.poolReceiveContext + <> CCIP.LockReleaseTokenPoolV1CodecGen.encodeTransferTimeout params.transferTimeout -encodeDeployBurnMintTokenPoolParams : DeployBurnMintTokenPoolParams -> BytesHex +encodeDeployBurnMintTokenPoolParams : CCIP.FactoryV1.DeployBurnMintTokenPoolParams -> BytesHex encodeDeployBurnMintTokenPoolParams params = encodeText params.instanceId <> encodeParty params.poolOwner <> encodeParty params.ccipOwner - <> encodeInstrumentId params.instrumentId + <> CCIP.CodecV1.encodeInstrumentId params.instrumentId <> fromSome (encodeInt64 params.decimals) <> encodeOptional params.rateLimitAdmin encodeParty - <> encodeRawInstanceAddress params.tokenAdminRegistry - <> encodeRawInstanceAddress params.feeQuoter - <> encodeRawInstanceAddress params.rmnRemote - <> encodeChoiceContext params.poolReceiveContext - <> CCIP.BurnMintTokenPoolCodecGen.encodeTransferTimeout params.transferTimeout + <> CCIP.CodecV1.encodeRawInstanceAddress params.tokenAdminRegistry + <> CCIP.CodecV1.encodeRawInstanceAddress params.feeQuoter + <> CCIP.CodecV1.encodeRawInstanceAddress params.rmnRemote + <> CCIP.UtilsV1.Context.encodeChoiceContext params.poolReceiveContext + <> CCIP.BurnMintTokenPoolV1CodecGen.encodeTransferTimeout params.transferTimeout -encodeRateLimitDirection : RateLimitDirection -> BytesHex -encodeRateLimitDirection RateLimitDirection_Outbound = fromSome (encodeUint8 0) -encodeRateLimitDirection RateLimitDirection_Inbound = fromSome (encodeUint8 1) +encodeRateLimitDirection : CCIP.RateLimiterV1.RateLimitDirection -> BytesHex +encodeRateLimitDirection CCIP.RateLimiterV1.RateLimitDirection_Outbound = fromSome (encodeUint8 0) +encodeRateLimitDirection CCIP.RateLimiterV1.RateLimitDirection_Inbound = fromSome (encodeUint8 1) -encodeRateLimitMode : RateLimitMode -> BytesHex -encodeRateLimitMode RateLimitMode_DefaultFinality = fromSome (encodeUint8 0) -encodeRateLimitMode RateLimitMode_CustomFinality = fromSome (encodeUint8 1) +encodeRateLimitMode : CCIP.RateLimiterV1.RateLimitMode -> BytesHex +encodeRateLimitMode CCIP.RateLimiterV1.RateLimitMode_DefaultFinality = fromSome (encodeUint8 0) +encodeRateLimitMode CCIP.RateLimiterV1.RateLimitMode_CustomFinality = fromSome (encodeUint8 1) -encodeDeployRateLimiterParams : DeployRateLimiterParams -> BytesHex +encodeDeployRateLimiterParams : CCIP.FactoryV1.DeployRateLimiterParams -> BytesHex encodeDeployRateLimiterParams params = encodeText params.instanceId <> encodeText params.poolInstanceId @@ -184,12 +181,12 @@ encodeDeployRateLimiterParams params = testDecodeDeployGlobalConfigParams : Script () testDecodeDeployGlobalConfigParams = script do - let params = DeployGlobalConfigParams with + let params = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-1" chainSelector = 123.0 encoded = encodeDeployGlobalConfigParams params - case decodeDeployGlobalConfigParams encoded of + case CCIP.FactoryV1.decodeDeployGlobalConfigParams encoded of None -> abort "Failed to decode DeployGlobalConfigParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -201,12 +198,12 @@ testDecodeDeployGlobalConfigParams_LargeChainSelector : Script () testDecodeDeployGlobalConfigParams_LargeChainSelector = script do -- Test with large CCIP-style chain selector let largeSelector : Numeric 0 = 16015286601757825753.0 -- Avalanche Fuji - params = DeployGlobalConfigParams with + params = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-large" chainSelector = largeSelector encoded = encodeDeployGlobalConfigParams params - case decodeDeployGlobalConfigParams encoded of + case CCIP.FactoryV1.decodeDeployGlobalConfigParams encoded of None -> abort "Failed to decode with large chain selector" Some decoded -> decoded.chainSelector === largeSelector @@ -216,12 +213,12 @@ testDecodeDeployFeeQuoterParams : Script () testDecodeDeployFeeQuoterParams = script do tokenAdmin <- allocateParty "TokenAdmin" - let params = DeployFeeQuoterParams with + let params = CCIP.FactoryV1.DeployFeeQuoterParams with instanceId = "fq-1" linkTokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" encoded = encodeDeployFeeQuoterParams params - case decodeDeployFeeQuoterParams encoded of + case CCIP.FactoryV1.decodeDeployFeeQuoterParams encoded of None -> abort "Failed to decode DeployFeeQuoterParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -233,12 +230,12 @@ testDecodeDeployLinkTokenParams : Script () testDecodeDeployLinkTokenParams = script do tokenAdmin <- allocateParty "LinkTokenAdmin" - let params = DeployLinkTokenParams with + let params = CCIP.FactoryV1.DeployLinkTokenParams with instanceId = "link-token-1" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" encoded = encodeDeployLinkTokenParams params - case decodeDeployLinkTokenParams encoded of + case CCIP.FactoryV1.decodeDeployLinkTokenParams encoded of None -> abort "Failed to decode DeployLinkTokenParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -248,11 +245,11 @@ testDecodeDeployLinkTokenParams = script do testDecodeDeployTokenAdminRegistryParams : Script () testDecodeDeployTokenAdminRegistryParams = script do - let params = DeployTokenAdminRegistryParams with + let params = CCIP.FactoryV1.DeployTokenAdminRegistryParams with instanceId = "tar-1" encoded = encodeDeployTokenAdminRegistryParams params - case decodeDeployTokenAdminRegistryParams encoded of + case CCIP.FactoryV1.decodeDeployTokenAdminRegistryParams encoded of None -> abort "Failed to decode DeployTokenAdminRegistryParams" Some decoded -> decoded.instanceId === params.instanceId @@ -260,17 +257,16 @@ testDecodeDeployTokenAdminRegistryParams = script do testDecodeDeployOnRampParams : Script () testDecodeDeployOnRampParams = script do - let params = DeployOnRampParams with + let params = CCIP.FactoryV1.DeployOnRampParams with instanceId = "onramp-1" - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - ccvRegistry = RawInstanceAddress "ccv@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" maxUSDCentsPerMsg = 12345.0 encoded = encodeDeployOnRampParams params - case decodeDeployOnRampParams encoded of + case CCIP.FactoryV1.decodeDeployOnRampParams encoded of None -> abort "Failed to decode DeployOnRampParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -278,21 +274,20 @@ testDecodeDeployOnRampParams = script do decoded.rmnRemote === params.rmnRemote decoded.tokenAdminRegistry === params.tokenAdminRegistry decoded.feeQuoter === params.feeQuoter - decoded.ccvRegistry === params.ccvRegistry decoded.maxUSDCentsPerMsg === params.maxUSDCentsPerMsg pure () testDecodeDeployOffRampParams : Script () testDecodeDeployOffRampParams = script do - let params = DeployOffRampParams with + let params = CCIP.FactoryV1.DeployOffRampParams with instanceId = "offramp-1" - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" encoded = encodeDeployOffRampParams params - case decodeDeployOffRampParams encoded of + case CCIP.FactoryV1.decodeDeployOffRampParams encoded of None -> abort "Failed to decode DeployOffRampParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -304,17 +299,17 @@ testDecodeDeployOffRampParams = script do testDecodeDeployPerPartyRouterFactoryParams : Script () testDecodeDeployPerPartyRouterFactoryParams = script do - let params = DeployPerPartyRouterFactoryParams with + let params = CCIP.FactoryV1.DeployPerPartyRouterFactoryParams with instanceId = "ppr-factory-1" - onRamp = RawInstanceAddress "onramp@owner" - offRamp = RawInstanceAddress "offramp@owner" - globalConfig = RawInstanceAddress "gc@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - rmnRemote = RawInstanceAddress "rmn@owner" + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" encoded = encodeDeployPerPartyRouterFactoryParams params - case decodeDeployPerPartyRouterFactoryParams encoded of + case CCIP.FactoryV1.decodeDeployPerPartyRouterFactoryParams encoded of None -> abort "Failed to decode DeployPerPartyRouterFactoryParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -334,7 +329,7 @@ testDecodeDeployRMNRemoteParams = script do observer1 <- allocateParty "observer1" observer2 <- allocateParty "observer2" - let params = DeployRMNRemoteParams with + let params = CCIP.FactoryV1.DeployRMNRemoteParams with instanceId = "rmn-1" rmnOwner ccipOwner @@ -342,7 +337,7 @@ testDecodeDeployRMNRemoteParams = script do cursedSubjects = ["deadbeef", "cafebabe"] encoded = encodeDeployRMNRemoteParams params - case decodeDeployRMNRemoteParams encoded of + case CCIP.FactoryV1.decodeDeployRMNRemoteParams encoded of None -> abort "Failed to decode DeployRMNRemoteParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -358,7 +353,7 @@ testDecodeDeployRMNRemoteParams_EmptyLists = script do rmnOwner <- allocateParty "rmn_owner" ccipOwner <- allocateParty "ccip_owner" - let params = DeployRMNRemoteParams with + let params = CCIP.FactoryV1.DeployRMNRemoteParams with instanceId = "rmn-empty" rmnOwner ccipOwner @@ -366,7 +361,7 @@ testDecodeDeployRMNRemoteParams_EmptyLists = script do cursedSubjects = [] encoded = encodeDeployRMNRemoteParams params - case decodeDeployRMNRemoteParams encoded of + case CCIP.FactoryV1.decodeDeployRMNRemoteParams encoded of None -> abort "Failed to decode with empty lists" Some decoded -> do decoded.customObservers === [] @@ -383,21 +378,21 @@ testDecodeDeployCommitteeVerifierParams = script do pendingAdmin <- allocateParty "pending_admin" allowListAdmin <- allocateParty "allow_list_admin" - let params = DeployCommitteeVerifierParams with + let params = CCIP.FactoryV1.DeployCommitteeVerifierParams with instanceId = "ccv-1" owner ccipOwner - versionTag = CCIP.CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = Some allowListAdmin --allowListAdmin = None messageSentObservers = [messageSentObserver] - rmnRemote = RawInstanceAddress "rmn@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" storageLocations = ["loc1", "loc2", "loc3"] storageLocationsAdmin = storageAdmin pendingStorageLocationsAdmin = pendingAdmin encoded = encodeDeployCommitteeVerifierParams params - case decodeDeployCommitteeVerifierParams encoded of + case CCIP.FactoryV1.decodeDeployCommitteeVerifierParams encoded of None -> abort "Failed to decode DeployCommitteeVerifierParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -420,20 +415,20 @@ testDecodeDeployCommitteeVerifierParams_EmptyStorageLocations = script do messageSentObserver <- allocateParty "msg_observer" storageAdmin <- allocateParty "storage_admin" - let params = DeployCommitteeVerifierParams with + let params = CCIP.FactoryV1.DeployCommitteeVerifierParams with instanceId = "ccv-empty" owner ccipOwner versionTag = "" allowListAdmin = None messageSentObservers = [messageSentObserver] - rmnRemote = RawInstanceAddress "rmn@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" storageLocations = [] storageLocationsAdmin = storageAdmin pendingStorageLocationsAdmin = storageAdmin encoded = encodeDeployCommitteeVerifierParams params - case decodeDeployCommitteeVerifierParams encoded of + case CCIP.FactoryV1.decodeDeployCommitteeVerifierParams encoded of None -> abort "Failed to decode with empty storage locations" Some decoded -> do decoded.storageLocations === [] @@ -445,7 +440,7 @@ testDecodeDeployExecutorParams : Script () testDecodeDeployExecutorParams = script do owner <- allocateParty "ExecutorOwner" - let params = DeployExecutorParams with + let params = CCIP.FactoryV1.DeployExecutorParams with instanceId = "executor-1" owner maxCCVsPerMsg = 10 @@ -453,7 +448,7 @@ testDecodeDeployExecutorParams = script do ccvAllowlistEnabled = False encoded = encodeDeployExecutorParams params - case decodeDeployExecutorParams encoded of + case CCIP.FactoryV1.decodeDeployExecutorParams encoded of None -> abort "Failed to decode DeployExecutorParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -469,19 +464,19 @@ testDecodeDeployExecutorParamsRejectsNonPositiveBlockDepth = script do owner <- allocateParty "ExecutorOwner" let encodeWith finality = - encodeDeployExecutorParams (DeployExecutorParams with + encodeDeployExecutorParams (CCIP.FactoryV1.DeployExecutorParams with instanceId = "executor-1" owner maxCCVsPerMsg = 10 allowedFinalityConfig = finality ccvAllowlistEnabled = False) assertDecodeFails finality = - case decodeDeployExecutorParams (encodeWith finality) of + case CCIP.FactoryV1.decodeDeployExecutorParams (encodeWith finality) of None -> pure () Some _ -> abort "expected DeployExecutorParams decode to reject non-positive BlockDepth" - assertDecodeFails (FinalityCodec.BlockDepth 0) - assertDecodeFails (FinalityCodec.BlockDepth (-1)) + assertDecodeFails (CCIP.CodecV1.FinalityConfig.BlockDepth 0) + assertDecodeFails (CCIP.CodecV1.FinalityConfig.BlockDepth (-1)) testDecodeDeployLockReleaseTokenPoolParams : Script () testDecodeDeployLockReleaseTokenPoolParams = script do @@ -492,21 +487,21 @@ testDecodeDeployLockReleaseTokenPoolParams = script do feeOwner <- allocateParty "fee_owner" rmnOwner <- allocateParty "rmn_owner" - let params = DeployLockReleaseTokenPoolParams with + let params = CCIP.FactoryV1.DeployLockReleaseTokenPoolParams with instanceId = "lrtp-1" poolOwner ccipOwner instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "USDC" decimals = 6 rateLimitAdmin = Some rateLimitAdmin - tokenAdminRegistry = RawInstanceAddress.make "tar-1" tokenAdmin - feeQuoter = RawInstanceAddress.make "fq-1" feeOwner - rmnRemote = RawInstanceAddress.make "rmn-1" rmnOwner - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = RelativeHours 24 + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-1" tokenAdmin + feeQuoter = Chainlink.InstanceAddress.make "fq-1" feeOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-1" rmnOwner + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.RelativeHours 24 encoded = encodeDeployLockReleaseTokenPoolParams params - case decodeDeployLockReleaseTokenPoolParams encoded of + case CCIP.FactoryV1.decodeDeployLockReleaseTokenPoolParams encoded of None -> abort "Failed to decode DeployLockReleaseTokenPoolParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -531,25 +526,25 @@ testDecodeDeployLockReleaseTokenPoolParams_Indefinite = script do feeOwner <- allocateParty "fee_owner" rmnOwner <- allocateParty "rmn_owner" - let params = DeployLockReleaseTokenPoolParams with + let params = CCIP.FactoryV1.DeployLockReleaseTokenPoolParams with instanceId = "lrtp-indefinite" poolOwner ccipOwner instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" decimals = 18 rateLimitAdmin = None - tokenAdminRegistry = RawInstanceAddress.make "tar-1" tokenAdmin - feeQuoter = RawInstanceAddress.make "fq-1" feeOwner - rmnRemote = RawInstanceAddress.make "rmn-1" rmnOwner - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = Indefinite + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-1" tokenAdmin + feeQuoter = Chainlink.InstanceAddress.make "fq-1" feeOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-1" rmnOwner + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite encoded = encodeDeployLockReleaseTokenPoolParams params - case decodeDeployLockReleaseTokenPoolParams encoded of + case CCIP.FactoryV1.decodeDeployLockReleaseTokenPoolParams encoded of None -> abort "Failed to decode DeployLockReleaseTokenPoolParams with Indefinite" Some decoded -> do - decoded.transferTimeout === Indefinite - decoded.poolReceiveContext === MetadataV1.emptyChoiceContext + decoded.transferTimeout === CCIP.LockReleaseTokenPoolV1.Indefinite + decoded.poolReceiveContext === Splice.Api.Token.MetadataV1.emptyChoiceContext decoded.rateLimitAdmin === None pure () @@ -563,21 +558,21 @@ testDecodeDeployBurnMintTokenPoolParams = script do feeOwner <- allocateParty "fee_owner" rmnOwner <- allocateParty "rmn_owner" - let params = DeployBurnMintTokenPoolParams with + let params = CCIP.FactoryV1.DeployBurnMintTokenPoolParams with instanceId = "bmtp-1" poolOwner ccipOwner instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "USDC" decimals = 6 rateLimitAdmin = Some rateLimitAdmin - tokenAdminRegistry = RawInstanceAddress.make "tar-1" tokenAdmin - feeQuoter = RawInstanceAddress.make "fq-1" feeOwner - rmnRemote = RawInstanceAddress.make "rmn-1" rmnOwner - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = CCIP.BurnMintTokenPoolTypes.RelativeHours 24 + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-1" tokenAdmin + feeQuoter = Chainlink.InstanceAddress.make "fq-1" feeOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-1" rmnOwner + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.RelativeHours 24 encoded = encodeDeployBurnMintTokenPoolParams params - case decodeDeployBurnMintTokenPoolParams encoded of + case CCIP.FactoryV1.decodeDeployBurnMintTokenPoolParams encoded of None -> abort "Failed to decode DeployBurnMintTokenPoolParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -602,25 +597,25 @@ testDecodeDeployBurnMintTokenPoolParams_Indefinite = script do feeOwner <- allocateParty "fee_owner" rmnOwner <- allocateParty "rmn_owner" - let params = DeployBurnMintTokenPoolParams with + let params = CCIP.FactoryV1.DeployBurnMintTokenPoolParams with instanceId = "bmtp-indefinite" poolOwner ccipOwner instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" decimals = 18 rateLimitAdmin = None - tokenAdminRegistry = RawInstanceAddress.make "tar-1" tokenAdmin - feeQuoter = RawInstanceAddress.make "fq-1" feeOwner - rmnRemote = RawInstanceAddress.make "rmn-1" rmnOwner - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = CCIP.BurnMintTokenPoolTypes.Indefinite + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-1" tokenAdmin + feeQuoter = Chainlink.InstanceAddress.make "fq-1" feeOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-1" rmnOwner + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.Indefinite encoded = encodeDeployBurnMintTokenPoolParams params - case decodeDeployBurnMintTokenPoolParams encoded of + case CCIP.FactoryV1.decodeDeployBurnMintTokenPoolParams encoded of None -> abort "Failed to decode DeployBurnMintTokenPoolParams with Indefinite" Some decoded -> do - decoded.transferTimeout === CCIP.BurnMintTokenPoolTypes.Indefinite - decoded.poolReceiveContext === MetadataV1.emptyChoiceContext + decoded.transferTimeout === CCIP.BurnMintTokenPoolV1.Indefinite + decoded.poolReceiveContext === Splice.Api.Token.MetadataV1.emptyChoiceContext decoded.rateLimitAdmin === None pure () @@ -629,19 +624,19 @@ testDecodeDeployRateLimiterParams : Script () testDecodeDeployRateLimiterParams = script do poolOwner <- allocateParty "pool_owner" - let params = DeployRateLimiterParams with + let params = CCIP.FactoryV1.DeployRateLimiterParams with instanceId = "rl-1" poolInstanceId = "pool-1" poolOwner remoteChainSelector = 137.0 - direction = RateLimitDirection_Outbound - mode = RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 1000000.0 rate = 100.0 encoded = encodeDeployRateLimiterParams params - case decodeDeployRateLimiterParams encoded of + case CCIP.FactoryV1.decodeDeployRateLimiterParams encoded of None -> abort "Failed to decode DeployRateLimiterParams" Some decoded -> do decoded.instanceId === params.instanceId @@ -660,23 +655,23 @@ testDecodeDeployRateLimiterParams_Inbound : Script () testDecodeDeployRateLimiterParams_Inbound = script do poolOwner <- allocateParty "pool_owner" - let params = DeployRateLimiterParams with + let params = CCIP.FactoryV1.DeployRateLimiterParams with instanceId = "rl-inbound" poolInstanceId = "pool-1" poolOwner remoteChainSelector = 1.0 - direction = RateLimitDirection_Inbound - mode = RateLimitMode_CustomFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Inbound + mode = CCIP.RateLimiterV1.RateLimitMode_CustomFinality isEnabled = False capacity = 500000.0 rate = 50.0 encoded = encodeDeployRateLimiterParams params - case decodeDeployRateLimiterParams encoded of + case CCIP.FactoryV1.decodeDeployRateLimiterParams encoded of None -> abort "Failed to decode inbound rate limiter params" Some decoded -> do - decoded.direction === RateLimitDirection_Inbound - decoded.mode === RateLimitMode_CustomFinality + decoded.direction === CCIP.RateLimiterV1.RateLimitDirection_Inbound + decoded.mode === CCIP.RateLimiterV1.RateLimitMode_CustomFinality decoded.isEnabled === False pure () @@ -688,11 +683,11 @@ testDecodeDeployRateLimiterParams_Inbound = script do testRateLimitDirection_Enum : Script () testRateLimitDirection_Enum = script do -- Test Outbound = 0 - let outboundEncoded = encodeRateLimitDirection RateLimitDirection_Outbound + let outboundEncoded = encodeRateLimitDirection CCIP.RateLimiterV1.RateLimitDirection_Outbound outboundEncoded === "00" -- Test Inbound = 1 - let inboundEncoded = encodeRateLimitDirection RateLimitDirection_Inbound + let inboundEncoded = encodeRateLimitDirection CCIP.RateLimiterV1.RateLimitDirection_Inbound inboundEncoded === "01" pure () @@ -700,11 +695,11 @@ testRateLimitDirection_Enum = script do testRateLimitMode_Enum : Script () testRateLimitMode_Enum = script do -- Test DefaultFinality = 0 - let defaultEncoded = encodeRateLimitMode RateLimitMode_DefaultFinality + let defaultEncoded = encodeRateLimitMode CCIP.RateLimiterV1.RateLimitMode_DefaultFinality defaultEncoded === "00" -- Test CustomFinality = 1 - let customEncoded = encodeRateLimitMode RateLimitMode_CustomFinality + let customEncoded = encodeRateLimitMode CCIP.RateLimiterV1.RateLimitMode_CustomFinality customEncoded === "01" pure () @@ -712,31 +707,31 @@ testRateLimitMode_Enum = script do testChainSelectorEdgeCases : Script () testChainSelectorEdgeCases = script do -- Test zero selector - let zeroParams = DeployGlobalConfigParams with + let zeroParams = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-zero" chainSelector = 0.0 zeroEncoded = encodeDeployGlobalConfigParams zeroParams - case decodeDeployGlobalConfigParams zeroEncoded of + case CCIP.FactoryV1.decodeDeployGlobalConfigParams zeroEncoded of None -> abort "Failed to decode zero selector" Some decoded -> decoded.chainSelector === 0.0 -- Test max Int64 boundary let maxInt64 : Numeric 0 = 9223372036854775807.0 - maxInt64Params = DeployGlobalConfigParams with + maxInt64Params = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-max-int64" chainSelector = maxInt64 maxInt64Encoded = encodeDeployGlobalConfigParams maxInt64Params - case decodeDeployGlobalConfigParams maxInt64Encoded of + case CCIP.FactoryV1.decodeDeployGlobalConfigParams maxInt64Encoded of None -> abort "Failed to decode max Int64 selector" Some decoded -> decoded.chainSelector === maxInt64 -- Test max uint64 let maxUint64 : Numeric 0 = 18446744073709551615.0 - maxUint64Params = DeployGlobalConfigParams with + maxUint64Params = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-max-uint64" chainSelector = maxUint64 maxUint64Encoded = encodeDeployGlobalConfigParams maxUint64Params - case decodeDeployGlobalConfigParams maxUint64Encoded of + case CCIP.FactoryV1.decodeDeployGlobalConfigParams maxUint64Encoded of None -> abort "Failed to decode max uint64 selector" Some decoded -> decoded.chainSelector === maxUint64 diff --git a/contracts/ccip/test/daml/CCIP/FactoryTest/FactoryMCMSTest.daml b/contracts/ccip/test/daml/CCIP/FactoryTest/FactoryMCMSTest.daml index 42a39d2a9..08817261a 100644 --- a/contracts/ccip/test/daml/CCIP/FactoryTest/FactoryMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/FactoryTest/FactoryMCMSTest.daml @@ -6,15 +6,22 @@ import Daml.Script import DA.Assert ((===)) import DA.Map qualified as Map -import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.Factory -import qualified CCIP.CommitteeVerifier -import CCIP.FinalityConfig qualified as FinalityCodec import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) + +import qualified Chainlink.InstanceAddress + import qualified Link.Token +import qualified CCIP.BurnMintTokenPoolV1 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CommitteeVerifierV1 +import qualified CCIP.FactoryV1 +import qualified CCIP.LockReleaseTokenPoolV1 +import qualified CCIP.RateLimiterV1 + import CCIP.FactoryTest.FactoryCodecTest ( encodeDeployGlobalConfigParams , encodeDeployFeeQuoterParams @@ -31,16 +38,10 @@ import CCIP.FactoryTest.FactoryCodecTest , encodeDeployRateLimiterParams ) -import CCIP.RateLimiter (RateLimitDirection(..), RateLimitMode(..)) -import CCIP.LockReleaseTokenPoolTypes (TransferTimeout(..)) -import qualified CCIP.BurnMintTokenPoolTypes - -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 - finalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n -- =========================================================================== -- INITIALIZATION & OWNERSHIP TESTS @@ -55,7 +56,7 @@ testFactoryCreate = script do let instanceId = "factory-1" factoryCid <- submit bootstrapOwner do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId owner = bootstrapOwner mcmsParty @@ -63,7 +64,7 @@ testFactoryCreate = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - contracts <- query @CCIPFactory bootstrapOwner + contracts <- query @CCIP.FactoryV1.CCIPFactory bootstrapOwner case filter (\(_, f) -> f.instanceId == instanceId) contracts of [(_, factory)] -> do factory.owner === bootstrapOwner @@ -89,7 +90,7 @@ testSetOwnerToMCMS = script do -- Create factory with bootstrapOwner as owner and also as mcmsParty -- This allows us to test the SetOwnerToMCMS choice without cross-party auth issues factoryCid <- submit bootstrapOwner do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId owner = bootstrapOwner mcmsParty = bootstrapOwner -- Same party to avoid authorization issues @@ -100,10 +101,10 @@ testSetOwnerToMCMS = script do -- SetOwnerToMCMS should fail when owner == mcmsParty -- This verifies the assertion logic works submitMustFail bootstrapOwner do - exerciseCmd factoryCid SetOwnerToMCMS + exerciseCmd factoryCid CCIP.FactoryV1.SetOwnerToMCMS -- Verify factory state remains unchanged - contracts <- query @CCIPFactory bootstrapOwner + contracts <- query @CCIP.FactoryV1.CCIPFactory bootstrapOwner case filter (\(_, f) -> f.instanceId == instanceId) contracts of [(_, factory)] -> do factory.owner === bootstrapOwner @@ -121,7 +122,7 @@ testSetOwnerToMCMS_AlreadyMCMS = script do -- Create factory with owner == mcmsParty factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId owner = mcmsParty mcmsParty @@ -131,7 +132,7 @@ testSetOwnerToMCMS_AlreadyMCMS = script do -- SetOwnerToMCMS should fail since already MCMS-controlled submitMustFail mcmsParty do - exerciseCmd factoryCid SetOwnerToMCMS + exerciseCmd factoryCid CCIP.FactoryV1.SetOwnerToMCMS pure () @@ -145,7 +146,7 @@ testGetFactoryState = script do usedIds = Map.fromList [("inst-1", True), ("inst-2", True)] factoryCid <- submit bootstrapOwner do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId owner = bootstrapOwner mcmsParty @@ -154,7 +155,7 @@ testGetFactoryState = script do perPartyRouterFactoryDeployed = False state <- submit bootstrapOwner do - exerciseCmd factoryCid GetFactoryState with caller = bootstrapOwner + exerciseCmd factoryCid CCIP.FactoryV1.GetFactoryState with caller = bootstrapOwner state.instanceId === instanceId state.owner === bootstrapOwner @@ -176,7 +177,7 @@ testDeployGlobalConfig_MCMS = script do gcInstanceId = "global-config-1" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -184,9 +185,9 @@ testDeployGlobalConfig_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployGlobalConfigParams with + let params = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = gcInstanceId chainSelector = 123.0 encoded = encodeDeployGlobalConfigParams params @@ -208,7 +209,7 @@ testDeployGlobalConfig_PreMCMS_Rejected = script do let factoryInstanceId = "factory-gc-reject" factoryCid <- submit bootstrapOwner do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = bootstrapOwner mcmsParty @@ -216,9 +217,9 @@ testDeployGlobalConfig_PreMCMS_Rejected = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId bootstrapOwner + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId bootstrapOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployGlobalConfigParams with + let params = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-1" chainSelector = 123.0 encoded = encodeDeployGlobalConfigParams params @@ -239,7 +240,7 @@ testDeployGlobalConfig_Duplicate_Rejected = script do let factoryInstanceId = "factory-gc-dup" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -247,9 +248,9 @@ testDeployGlobalConfig_Duplicate_Rejected = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params1 = DeployGlobalConfigParams with + let params1 = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-1" chainSelector = 123.0 encoded1 = encodeDeployGlobalConfigParams params1 @@ -262,11 +263,11 @@ testDeployGlobalConfig_Duplicate_Rejected = script do contractIds = Map.fromList [(instAddr, toAnyContractId factoryCid)] -- Get updated factory CID - factories <- query @CCIPFactory mcmsParty + factories <- query @CCIP.FactoryV1.CCIPFactory mcmsParty case filter (\(_, f) -> f.instanceId == factoryInstanceId) factories of [(newCid, _)] -> do let targetAsMcmsReceiver2 = toInterfaceContractId @MCMSReceiver newCid - let params2 = DeployGlobalConfigParams with + let params2 = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-2" chainSelector = 456.0 encoded2 = encodeDeployGlobalConfigParams params2 @@ -291,7 +292,7 @@ testInstanceIdCollision_Rejected = script do sharedInstanceId = "shared-inst-id" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -299,9 +300,9 @@ testInstanceIdCollision_Rejected = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployGlobalConfigParams with + let params = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = sharedInstanceId chainSelector = 123.0 encoded = encodeDeployGlobalConfigParams params @@ -323,7 +324,7 @@ testDeployFeeQuoter_MCMS = script do let factoryInstanceId = "factory-fq" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -331,9 +332,9 @@ testDeployFeeQuoter_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployFeeQuoterParams with + let params = CCIP.FactoryV1.DeployFeeQuoterParams with instanceId = "fee-quoter-1" linkTokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" encoded = encodeDeployFeeQuoterParams params @@ -357,7 +358,7 @@ testDeployLinkToken_MCMS = script do instrumentId = Splice.Api.Token.HoldingV1.InstrumentId mcmsParty "LINK" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -365,9 +366,9 @@ testDeployLinkToken_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployLinkTokenParams with + let params = CCIP.FactoryV1.DeployLinkTokenParams with instanceId = linkInstanceId instrumentId encoded = encodeDeployLinkTokenParams params @@ -396,7 +397,7 @@ testDeployLinkToken_AdminMismatch_Rejected = script do let factoryInstanceId = "factory-link-admin-mismatch" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -404,9 +405,9 @@ testDeployLinkToken_AdminMismatch_Rejected = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployLinkTokenParams with + let params = CCIP.FactoryV1.DeployLinkTokenParams with instanceId = "link-token-bad-admin" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" encoded = encodeDeployLinkTokenParams params @@ -427,7 +428,7 @@ testDeployTokenAdminRegistry_MCMS = script do let factoryInstanceId = "factory-tar" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -435,9 +436,9 @@ testDeployTokenAdminRegistry_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployTokenAdminRegistryParams with + let params = CCIP.FactoryV1.DeployTokenAdminRegistryParams with instanceId = "tar-1" encoded = encodeDeployTokenAdminRegistryParams params @@ -457,7 +458,7 @@ testDeployOnRamp_MCMS = script do let factoryInstanceId = "factory-onramp" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -465,15 +466,14 @@ testDeployOnRamp_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployOnRampParams with + let params = CCIP.FactoryV1.DeployOnRampParams with instanceId = "onramp-1" - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - ccvRegistry = RawInstanceAddress "ccv@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" maxUSDCentsPerMsg = 12345.0 encoded = encodeDeployOnRampParams params @@ -493,7 +493,7 @@ testDeployOffRamp_MCMS = script do let factoryInstanceId = "factory-offramp" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -501,13 +501,13 @@ testDeployOffRamp_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployOffRampParams with + let params = CCIP.FactoryV1.DeployOffRampParams with instanceId = "offramp-1" - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" encoded = encodeDeployOffRampParams params submit mcmsParty do @@ -526,7 +526,7 @@ testDeployPerPartyRouterFactory_MCMS = script do let factoryInstanceId = "factory-ppr" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -534,16 +534,16 @@ testDeployPerPartyRouterFactory_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployPerPartyRouterFactoryParams with + let params = CCIP.FactoryV1.DeployPerPartyRouterFactoryParams with instanceId = "ppr-factory-1" - onRamp = RawInstanceAddress "onramp@owner" - offRamp = RawInstanceAddress "offramp@owner" - globalConfig = RawInstanceAddress "gc@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - rmnRemote = RawInstanceAddress "rmn@owner" + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" encoded = encodeDeployPerPartyRouterFactoryParams params submit mcmsParty do @@ -567,7 +567,7 @@ testDeployRMNRemote_MCMS = script do let factoryInstanceId = "factory-rmn" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -575,10 +575,10 @@ testDeployRMNRemote_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid -- Use mcmsParty as rmnOwner so authorization works within single party - let params = DeployRMNRemoteParams with + let params = CCIP.FactoryV1.DeployRMNRemoteParams with instanceId = "rmn-1" rmnOwner = mcmsParty ccipOwner = mcmsParty @@ -603,7 +603,7 @@ testDeployCommitteeVerifier_MCMS = script do let factoryInstanceId = "factory-ccv" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -611,17 +611,17 @@ testDeployCommitteeVerifier_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid -- Use mcmsParty for all signatory roles to avoid authorization issues - let params = DeployCommitteeVerifierParams with + let params = CCIP.FactoryV1.DeployCommitteeVerifierParams with instanceId = "ccv-1" owner = mcmsParty ccipOwner = mcmsParty - versionTag = CCIP.CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [mcmsParty] - rmnRemote = RawInstanceAddress "rmn@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" storageLocations = ["loc1", "loc2"] storageLocationsAdmin = mcmsParty pendingStorageLocationsAdmin = mcmsParty @@ -645,7 +645,7 @@ testDeployLockReleaseTokenPool_MCMS = script do let factoryInstanceId = "factory-lrtp" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -653,21 +653,21 @@ testDeployLockReleaseTokenPool_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid -- Use mcmsParty as poolOwner so authorization works within single party - let params = DeployLockReleaseTokenPoolParams with + let params = CCIP.FactoryV1.DeployLockReleaseTokenPoolParams with instanceId = "lrtp-1" poolOwner = mcmsParty ccipOwner = mcmsParty instrumentId = Splice.Api.Token.HoldingV1.InstrumentId mcmsParty "USDC" decimals = 6 rateLimitAdmin = Some rateLimitAdmin - tokenAdminRegistry = RawInstanceAddress.make "tar-1" mcmsParty - feeQuoter = RawInstanceAddress.make "fq-1" mcmsParty - rmnRemote = RawInstanceAddress.make "rmn-1" mcmsParty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = RelativeHours 24 + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-1" mcmsParty + feeQuoter = Chainlink.InstanceAddress.make "fq-1" mcmsParty + rmnRemote = Chainlink.InstanceAddress.make "rmn-1" mcmsParty + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.RelativeHours 24 encoded = encodeDeployLockReleaseTokenPoolParams params submit mcmsParty do @@ -688,7 +688,7 @@ testDeployBurnMintTokenPool_MCMS = script do let factoryInstanceId = "factory-bmtp" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -696,20 +696,20 @@ testDeployBurnMintTokenPool_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployBurnMintTokenPoolParams with + let params = CCIP.FactoryV1.DeployBurnMintTokenPoolParams with instanceId = "bmtp-1" poolOwner = mcmsParty ccipOwner = mcmsParty instrumentId = Splice.Api.Token.HoldingV1.InstrumentId mcmsParty "USDC" decimals = 6 rateLimitAdmin = Some rateLimitAdmin - tokenAdminRegistry = RawInstanceAddress.make "tar-1" mcmsParty - feeQuoter = RawInstanceAddress.make "fq-1" mcmsParty - rmnRemote = RawInstanceAddress.make "rmn-1" mcmsParty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = CCIP.BurnMintTokenPoolTypes.RelativeHours 24 + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-1" mcmsParty + feeQuoter = Chainlink.InstanceAddress.make "fq-1" mcmsParty + rmnRemote = Chainlink.InstanceAddress.make "rmn-1" mcmsParty + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.BurnMintTokenPoolV1.RelativeHours 24 encoded = encodeDeployBurnMintTokenPoolParams params submit mcmsParty do @@ -728,7 +728,7 @@ testDeployExecutor_MCMS = script do let factoryInstanceId = "factory-executor" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -736,9 +736,9 @@ testDeployExecutor_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployExecutorParams with + let params = CCIP.FactoryV1.DeployExecutorParams with instanceId = "executor-1" owner = mcmsParty maxCCVsPerMsg = 10 @@ -763,7 +763,7 @@ testDeployRateLimiter_MCMS = script do let factoryInstanceId = "factory-rl" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -771,16 +771,16 @@ testDeployRateLimiter_MCMS = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid -- Use mcmsParty as poolOwner so authorization works within single party - let params = DeployRateLimiterParams with + let params = CCIP.FactoryV1.DeployRateLimiterParams with instanceId = "rl-1" poolInstanceId = "pool-1" poolOwner = mcmsParty remoteChainSelector = 137.0 - direction = RateLimitDirection_Outbound - mode = RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 1000000.0 rate = 100.0 @@ -803,7 +803,7 @@ testMultipleNonSingletonDeployments = script do let factoryInstanceId = "factory-multi" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -811,17 +811,17 @@ testMultipleNonSingletonDeployments = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty -- Deploy first rate limiter let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params1 = DeployRateLimiterParams with + let params1 = CCIP.FactoryV1.DeployRateLimiterParams with instanceId = "rl-outbound" poolInstanceId = "pool-1" poolOwner = mcmsParty remoteChainSelector = 137.0 - direction = RateLimitDirection_Outbound - mode = RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 1000000.0 rate = 100.0 @@ -834,18 +834,18 @@ testMultipleNonSingletonDeployments = script do contractIds = Map.fromList [(instAddr, toAnyContractId factoryCid)] -- Get updated factory - factories <- query @CCIPFactory mcmsParty + factories <- query @CCIP.FactoryV1.CCIPFactory mcmsParty case filter (\(_, f) -> f.instanceId == factoryInstanceId) factories of [(newCid, _)] -> do -- Deploy second rate limiter with different instanceId let targetAsMcmsReceiver2 = toInterfaceContractId @MCMSReceiver newCid - let params2 = DeployRateLimiterParams with + let params2 = CCIP.FactoryV1.DeployRateLimiterParams with instanceId = "rl-inbound" poolInstanceId = "pool-1" poolOwner = mcmsParty remoteChainSelector = 137.0 - direction = RateLimitDirection_Inbound - mode = RateLimitMode_CustomFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Inbound + mode = CCIP.RateLimiterV1.RateLimitMode_CustomFinality isEnabled = False capacity = 500000.0 rate = 50.0 @@ -873,7 +873,7 @@ testUnknownFunction_Rejected = script do let factoryInstanceId = "factory-unknown" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -881,7 +881,7 @@ testUnknownFunction_Rejected = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid submitMustFail mcmsParty do @@ -900,7 +900,7 @@ testInvalidParams_Rejected = script do let factoryInstanceId = "factory-invalid" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -908,7 +908,7 @@ testInvalidParams_Rejected = script do deployedContracts = Map.empty perPartyRouterFactoryDeployed = False - let instAddr = RawInstanceAddress.makeText factoryInstanceId mcmsParty + let instAddr = Chainlink.InstanceAddress.makeText factoryInstanceId mcmsParty let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid submitMustFail mcmsParty do @@ -927,7 +927,7 @@ testMissingSelfCid_Rejected = script do let factoryInstanceId = "factory-missing-cid" factoryCid <- submit mcmsParty do - createCmd CCIPFactory with + createCmd CCIP.FactoryV1.CCIPFactory with instanceId = factoryInstanceId owner = mcmsParty mcmsParty @@ -936,7 +936,7 @@ testMissingSelfCid_Rejected = script do perPartyRouterFactoryDeployed = False let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let params = DeployGlobalConfigParams with + let params = CCIP.FactoryV1.DeployGlobalConfigParams with instanceId = "gc-1" chainSelector = 123.0 encoded = encodeDeployGlobalConfigParams params diff --git a/contracts/ccip/test/daml/CCIP/FeeQuoterTest/FeeQuoterCodecTest.daml b/contracts/ccip/test/daml/CCIP/FeeQuoterTest/FeeQuoterCodecTest.daml index 23760e1f3..0d86a113c 100644 --- a/contracts/ccip/test/daml/CCIP/FeeQuoterTest/FeeQuoterCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/FeeQuoterTest/FeeQuoterCodecTest.daml @@ -7,18 +7,8 @@ import DA.Optional (fromSome) import qualified Splice.Api.Token.HoldingV1 -import CCIP.FeeQuoterCodecGen qualified as FeeQuoterCodec -import CCIP.FeeQuoterTypes ( - PriceUpdates(..), - TokenPriceUpdate(..), - GasPriceUpdate(..), - FeeQuoterDestChainConfigArgs(..), - FeeQuoterDestChainConfig(..), - ApplyPriceUpdatersUpdateParams(..), - UpdatePricesParams(..), - RemoveFeeTokensParams(..), - ApplyFeeQuoterDestChainConfigUpdatesParams(..), - ) +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.FeeQuoterCodecGen usdToCents : Decimal -> Numeric 0 usdToCents d = intToNumeric (truncate (d * 100.0)) @@ -30,20 +20,20 @@ usdToCents d = intToNumeric (truncate (d * 100.0)) testApplyPriceUpdatersUpdateRoundtrip : Script () testApplyPriceUpdatersUpdateRoundtrip = do -- Empty lists - let args = ApplyPriceUpdatersUpdateParams with + let args = CCIP.CoreV1.FeeQuoter.ApplyPriceUpdatersUpdateParams with addedPriceUpdaters = [] removedPriceUpdaters = [] - let encoded = FeeQuoterCodec.encodeApplyPriceUpdatersUpdateParams args - fst (fromSome (FeeQuoterCodec.decodeApplyPriceUpdatersUpdateParamsAt encoded 0)) === args + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeApplyPriceUpdatersUpdateParams args + fst (fromSome (CCIP.CoreV1.FeeQuoterCodecGen.decodeApplyPriceUpdatersUpdateParamsAt encoded 0)) === args -- Non-empty lists party1 <- allocateParty "party1" party2 <- allocateParty "party2" party3 <- allocateParty "party3" - let args = ApplyPriceUpdatersUpdateParams with + let args = CCIP.CoreV1.FeeQuoter.ApplyPriceUpdatersUpdateParams with addedPriceUpdaters = [party1, party2] removedPriceUpdaters = [party3] - let encoded = FeeQuoterCodec.encodeApplyPriceUpdatersUpdateParams args - fst (fromSome (FeeQuoterCodec.decodeApplyPriceUpdatersUpdateParamsAt encoded 0)) === args + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeApplyPriceUpdatersUpdateParams args + fst (fromSome (CCIP.CoreV1.FeeQuoterCodecGen.decodeApplyPriceUpdatersUpdateParamsAt encoded 0)) === args -- =============================================== -- | UpdatePrices | @@ -53,38 +43,38 @@ testApplyUpdatePricesRoundtrip : Script () testApplyUpdatePricesRoundtrip = do caller <- allocateParty "caller" -- Empty updates - let args = UpdatePricesParams with - priceUpdates = PriceUpdates with + let args = CCIP.CoreV1.FeeQuoter.UpdatePricesParams with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller - let encoded = FeeQuoterCodec.encodeUpdatePricesParams args - fst (fromSome (FeeQuoterCodec.decodeUpdatePricesParamsAt encoded 0)) === args + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeUpdatePricesParams args + fst (fromSome (CCIP.CoreV1.FeeQuoterCodecGen.decodeUpdatePricesParamsAt encoded 0)) === args -- Non-empty updates issuer1 <- allocateParty "issuer1" issuer2 <- allocateParty "issuer2" - let args = UpdatePricesParams with - priceUpdates = PriceUpdates with + let args = CCIP.CoreV1.FeeQuoter.UpdatePricesParams with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [ - TokenPriceUpdate with + CCIP.CoreV1.FeeQuoter.TokenPriceUpdate with instrumentId = Splice.Api.Token.HoldingV1.InstrumentId issuer1 "USDC" usdPerToken = 1.0 - , TokenPriceUpdate with + , CCIP.CoreV1.FeeQuoter.TokenPriceUpdate with instrumentId = Splice.Api.Token.HoldingV1.InstrumentId issuer2 "LINK" usdPerToken = 25.0 ] gasPriceUpdates = [ - GasPriceUpdate with + CCIP.CoreV1.FeeQuoter.GasPriceUpdate with destChainSelector = 1.0 usdPerUnitGas = 0.00000002 - , GasPriceUpdate with + , CCIP.CoreV1.FeeQuoter.GasPriceUpdate with destChainSelector = 18446744073709551615.0 -- max uint64 usdPerUnitGas = 0.00000003 ] caller - let encoded = FeeQuoterCodec.encodeUpdatePricesParams args - fst (fromSome (FeeQuoterCodec.decodeUpdatePricesParamsAt encoded 0)) === args + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeUpdatePricesParams args + fst (fromSome (CCIP.CoreV1.FeeQuoterCodecGen.decodeUpdatePricesParamsAt encoded 0)) === args -- =============================================== -- | RemoveFeeTokens | @@ -93,20 +83,20 @@ testApplyUpdatePricesRoundtrip = do testRemoveFeeTokensRoundtrip : Script () testRemoveFeeTokensRoundtrip = do -- Empty list - let args = RemoveFeeTokensParams with + let args = CCIP.CoreV1.FeeQuoter.RemoveFeeTokensParams with feeTokensToRemove = [] - let encoded = FeeQuoterCodec.encodeRemoveFeeTokensParams args - fst (fromSome (FeeQuoterCodec.decodeRemoveFeeTokensParamsAt encoded 0)) === args + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeRemoveFeeTokensParams args + fst (fromSome (CCIP.CoreV1.FeeQuoterCodecGen.decodeRemoveFeeTokensParamsAt encoded 0)) === args -- Non-empty list issuer1 <- allocateParty "issuer1" issuer2 <- allocateParty "issuer2" - let args = RemoveFeeTokensParams with + let args = CCIP.CoreV1.FeeQuoter.RemoveFeeTokensParams with feeTokensToRemove = [ Splice.Api.Token.HoldingV1.InstrumentId issuer1 "USDC" , Splice.Api.Token.HoldingV1.InstrumentId issuer2 "LINK" ] - let encoded = FeeQuoterCodec.encodeRemoveFeeTokensParams args - fst (fromSome (FeeQuoterCodec.decodeRemoveFeeTokensParamsAt encoded 0)) === args + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeRemoveFeeTokensParams args + fst (fromSome (CCIP.CoreV1.FeeQuoterCodecGen.decodeRemoveFeeTokensParamsAt encoded 0)) === args -- =============================================== -- | ApplyFeeQuoterDestChainConfigUpdates | @@ -114,14 +104,14 @@ testRemoveFeeTokensRoundtrip = do testApplyFeeQuoterDestChainConfigUpdatesRoundtrip : Script () testApplyFeeQuoterDestChainConfigUpdatesRoundtrip = do - let config1 = FeeQuoterDestChainConfig True 1024 500000 21000 16 300000 90.0 (usdToCents 0.50) 25000 - config2 = FeeQuoterDestChainConfig False 2048 1000000 30000 32 500000 100.0 (usdToCents 1.00) 35000 - configArgs1 = FeeQuoterDestChainConfigArgs 1.0 config1 - configArgs2 = FeeQuoterDestChainConfigArgs 18446744073709551615.0 config2 -- max uint64 - args = ApplyFeeQuoterDestChainConfigUpdatesParams with + let config1 = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig True 1024 500000 21000 16 300000 90.0 (usdToCents 0.50) 25000 + config2 = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig False 2048 1000000 30000 32 500000 100.0 (usdToCents 1.00) 35000 + configArgs1 = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs 1.0 config1 + configArgs2 = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs 18446744073709551615.0 config2 -- max uint64 + args = CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdatesParams with destChainConfigArgs = [configArgs1, configArgs2] - let encoded = FeeQuoterCodec.encodeApplyFeeQuoterDestChainConfigUpdatesParams args - fst (fromSome (FeeQuoterCodec.decodeApplyFeeQuoterDestChainConfigUpdatesParamsAt encoded 0)) === args + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeApplyFeeQuoterDestChainConfigUpdatesParams args + fst (fromSome (CCIP.CoreV1.FeeQuoterCodecGen.decodeApplyFeeQuoterDestChainConfigUpdatesParamsAt encoded 0)) === args -- =========================================================================== -- INVALID DATA REJECTION TESTS @@ -130,13 +120,13 @@ testApplyFeeQuoterDestChainConfigUpdatesRoundtrip = do testInvalidDataRejection : Script () testInvalidDataRejection = do -- Empty data should fail - case FeeQuoterCodec.decodeRemoveFeeTokensParamsAt "" 0 of + case CCIP.CoreV1.FeeQuoterCodecGen.decodeRemoveFeeTokensParamsAt "" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeRemoveFeeTokensParams to fail on empty data" -- Truncated data should fail - case FeeQuoterCodec.decodeApplyFeeQuoterDestChainConfigUpdatesParamsAt "00" 0 of + case CCIP.CoreV1.FeeQuoterCodecGen.decodeApplyFeeQuoterDestChainConfigUpdatesParamsAt "00" 0 of None -> pure () -- Expected - count says 0 items but might be truncated - Some (ApplyFeeQuoterDestChainConfigUpdatesParams{..}, _) -> destChainConfigArgs === [] -- Also valid - 0 items + Some (CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdatesParams{..}, _) -> destChainConfigArgs === [] -- Also valid - 0 items pure () diff --git a/contracts/ccip/test/daml/CCIP/FeeQuoterTest/FeeQuoterMCMSTest.daml b/contracts/ccip/test/daml/CCIP/FeeQuoterTest/FeeQuoterMCMSTest.daml index 36329b2bd..a5c9e5018 100644 --- a/contracts/ccip/test/daml/CCIP/FeeQuoterTest/FeeQuoterMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/FeeQuoterTest/FeeQuoterMCMSTest.daml @@ -8,14 +8,14 @@ import DA.Map qualified as Map import DA.Set qualified as Set import qualified Splice.Api.Token.HoldingV1 + +import MCMS.Codec (encodePartyList) import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) + import Chainlink.InstanceAddress qualified as RawInstanceAddress -import MCMS.Codec (encodePartyList) -import CCIP.FeeQuoter -import CCIP.FeeQuoterCodecGen ( - encodeRemoveFeeTokensParams, - encodeApplyFeeQuoterDestChainConfigUpdatesParams, - ) + +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.FeeQuoterCodecGen usd : Decimal -> Numeric 0 usd d = intToNumeric (truncate (d * 100000000.0)) @@ -42,9 +42,9 @@ testFeeQuoterMCMSEntrypoint_RemoveFeeTokens = script do -- Create FeeQuoter with one existing fee token fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.fromList [instrumentId1] destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -57,7 +57,7 @@ testFeeQuoterMCMSEntrypoint_RemoveFeeTokens = script do let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver fqCid -- Encode RemoveFeeTokens params: remove USDC - let encoded = encodeRemoveFeeTokensParams (RemoveFeeTokensParams with + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeRemoveFeeTokensParams (CCIP.CoreV1.FeeQuoter.RemoveFeeTokensParams with feeTokensToRemove = [instrumentId1]) -- Call mcmsEntrypoint @@ -68,7 +68,7 @@ testFeeQuoterMCMSEntrypoint_RemoveFeeTokens = script do contractIds = Map.fromList [(instAddr, toAnyContractId fqCid)] -- Verify state changed - contracts <- query @FeeQuoter owner + contracts <- query @CCIP.CoreV1.FeeQuoter.FeeQuoter owner case filter (\(_, fq) -> fq.instanceId == instanceId) contracts of [(_, fq)] -> do -- USDC should be removed @@ -91,9 +91,9 @@ testFeeQuoterMCMSEntrypoint_RemoveFeeTokens_Multiple = script do -- Create FeeQuoter with multiple fee tokens fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.fromList [instrumentId1, instrumentId2, instrumentId3] destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -106,7 +106,7 @@ testFeeQuoterMCMSEntrypoint_RemoveFeeTokens_Multiple = script do let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver fqCid -- Remove multiple fee tokens - let encoded = encodeRemoveFeeTokensParams (RemoveFeeTokensParams with + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeRemoveFeeTokensParams (CCIP.CoreV1.FeeQuoter.RemoveFeeTokensParams with feeTokensToRemove = [instrumentId1, instrumentId2, instrumentId3]) -- Call mcmsEntrypoint @@ -117,7 +117,7 @@ testFeeQuoterMCMSEntrypoint_RemoveFeeTokens_Multiple = script do contractIds = Map.fromList [(instAddr, toAnyContractId fqCid)] -- Verify all tokens removed - contracts <- query @FeeQuoter owner + contracts <- query @CCIP.CoreV1.FeeQuoter.FeeQuoter owner case filter (\(_, fq) -> fq.instanceId == instanceId) contracts of [(_, fq)] -> do Set.size fq.feeTokens === 0 @@ -141,9 +141,9 @@ testFeeQuoterMCMSEntrypoint_ApplyFeeQuoterDestChainConfigUpdates = script do -- Create FeeQuoter with no dest chain configs fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -156,7 +156,7 @@ testFeeQuoterMCMSEntrypoint_ApplyFeeQuoterDestChainConfigUpdates = script do let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver fqCid -- Create dest chain config - let destConfig = FeeQuoterDestChainConfig with + let destConfig = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 65535 maxPerMsgGasLimit = 3000000 @@ -167,8 +167,8 @@ testFeeQuoterMCMSEntrypoint_ApplyFeeQuoterDestChainConfigUpdates = script do defaultTokenFeeUSD = usdToCents 0.5 defaultTokenDestGasOverhead = 50000 - encoded = encodeApplyFeeQuoterDestChainConfigUpdatesParams (ApplyFeeQuoterDestChainConfigUpdatesParams with - destChainConfigArgs = [FeeQuoterDestChainConfigArgs 1.0 destConfig]) + encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeApplyFeeQuoterDestChainConfigUpdatesParams (CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdatesParams with + destChainConfigArgs = [CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs 1.0 destConfig]) -- Call mcmsEntrypoint newContractIds <- submit owner do @@ -178,7 +178,7 @@ testFeeQuoterMCMSEntrypoint_ApplyFeeQuoterDestChainConfigUpdates = script do contractIds = Map.fromList [(instAddr, toAnyContractId fqCid)] -- Verify dest chain config was added - contracts <- query @FeeQuoter owner + contracts <- query @CCIP.CoreV1.FeeQuoter.FeeQuoter owner case filter (\(_, fq) -> fq.instanceId == instanceId) contracts of [(_, fq)] -> do Map.size fq.destChainConfigs === 1 @@ -201,9 +201,9 @@ testFeeQuoterMCMSEntrypoint_ApplyFeeQuoterDestChainConfigUpdates_Multiple = scri -- Create FeeQuoter fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -216,10 +216,10 @@ testFeeQuoterMCMSEntrypoint_ApplyFeeQuoterDestChainConfigUpdates_Multiple = scri let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver fqCid -- Create multiple dest chain configs - let config1 = FeeQuoterDestChainConfig True 65535 3000000 100000 16 200000 100.0 (usdToCents 0.5) 50000 - config2 = FeeQuoterDestChainConfig True 32768 1500000 50000 8 100000 90.0 (usdToCents 1.0) 25000 - configArgs = [FeeQuoterDestChainConfigArgs 1.0 config1, FeeQuoterDestChainConfigArgs 137.0 config2] - encoded = encodeApplyFeeQuoterDestChainConfigUpdatesParams (ApplyFeeQuoterDestChainConfigUpdatesParams with + let config1 = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig True 65535 3000000 100000 16 200000 100.0 (usdToCents 0.5) 50000 + config2 = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig True 32768 1500000 50000 8 100000 90.0 (usdToCents 1.0) 25000 + configArgs = [CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs 1.0 config1, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs 137.0 config2] + encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeApplyFeeQuoterDestChainConfigUpdatesParams (CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdatesParams with destChainConfigArgs = configArgs) -- Call mcmsEntrypoint @@ -230,7 +230,7 @@ testFeeQuoterMCMSEntrypoint_ApplyFeeQuoterDestChainConfigUpdates_Multiple = scri contractIds = Map.fromList [(instAddr, toAnyContractId fqCid)] -- Verify both configs were added - contracts <- query @FeeQuoter owner + contracts <- query @CCIP.CoreV1.FeeQuoter.FeeQuoter owner case filter (\(_, fq) -> fq.instanceId == instanceId) contracts of [(_, fq)] -> do Map.size fq.destChainConfigs === 2 @@ -259,9 +259,9 @@ testFeeQuoterMCMSEntrypoint_AddPriceUpdaters = script do -- Create FeeQuoter with no price updaters fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -284,7 +284,7 @@ testFeeQuoterMCMSEntrypoint_AddPriceUpdaters = script do contractIds = Map.fromList [(instAddr, toAnyContractId fqCid)] -- Verify updaters were added - contracts <- query @FeeQuoter owner + contracts <- query @CCIP.CoreV1.FeeQuoter.FeeQuoter owner case filter (\(_, fq) -> fq.instanceId == instanceId) contracts of [(_, fq)] -> do length fq.priceUpdaters === 2 @@ -305,9 +305,9 @@ testFeeQuoterMCMSEntrypoint_RemovePriceUpdaters = script do -- Create FeeQuoter with two price updaters fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -331,7 +331,7 @@ testFeeQuoterMCMSEntrypoint_RemovePriceUpdaters = script do contractIds = Map.fromList [(instAddr, toAnyContractId fqCid)] -- Verify updater1 was removed - contracts <- query @FeeQuoter owner + contracts <- query @CCIP.CoreV1.FeeQuoter.FeeQuoter owner case filter (\(_, fq) -> fq.instanceId == instanceId) contracts of [(_, fq)] -> do length fq.priceUpdaters === 1 @@ -350,9 +350,9 @@ testFeeQuoterMCMSEntrypoint_AddPriceUpdaters_FiltersOwner = script do let instanceId = "feequoter-filter-owner-test" fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -374,7 +374,7 @@ testFeeQuoterMCMSEntrypoint_AddPriceUpdaters_FiltersOwner = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId fqCid)] - contracts <- query @FeeQuoter owner + contracts <- query @CCIP.CoreV1.FeeQuoter.FeeQuoter owner case filter (\(_, fq) -> fq.instanceId == instanceId) contracts of [(_, fq)] -> do length fq.priceUpdaters === 1 @@ -396,9 +396,9 @@ testFeeQuoterMCMSEntrypoint_UnknownFunction = script do let instanceId = "feequoter-error-test" fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -427,9 +427,9 @@ testFeeQuoterMCMSEntrypoint_InvalidParams = script do let instanceId = "feequoter-invalid-test" fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -458,9 +458,9 @@ testFeeQuoterMCMSEntrypoint_MissingSelfCid = script do let instanceId = "feequoter-missing-cid-test" fqCid <- submit owner do - createCmd FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId - owner + ccipOwner = owner feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty @@ -472,7 +472,7 @@ testFeeQuoterMCMSEntrypoint_MissingSelfCid = script do let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver fqCid -- Encode valid params - let encoded = encodeApplyFeeQuoterDestChainConfigUpdatesParams (ApplyFeeQuoterDestChainConfigUpdatesParams with + let encoded = CCIP.CoreV1.FeeQuoterCodecGen.encodeApplyFeeQuoterDestChainConfigUpdatesParams (CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdatesParams with destChainConfigArgs = []) -- Call with empty contractIds map - should fail diff --git a/contracts/ccip/test/daml/CCIP/GlobalConfigTest/GlobalConfigCodecTest.daml b/contracts/ccip/test/daml/CCIP/GlobalConfigTest/GlobalConfigCodecTest.daml index 9366e3fc0..d65dfc466 100644 --- a/contracts/ccip/test/daml/CCIP/GlobalConfigTest/GlobalConfigCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/GlobalConfigTest/GlobalConfigCodecTest.daml @@ -5,14 +5,10 @@ import Daml.Script import DA.Assert ((===)) import DA.Optional (fromSome) -import CCIP.GlobalConfigCodecGen qualified as GlobalConfigCodec -import CCIP.GlobalConfigTypes ( - DestChainConfigArgs(..), - SourceChainConfigArgs(..), - ApplyDestChainConfigUpdatesParams(..), - ApplySourceChainConfigUpdatesParams(..), - ) -import Chainlink.InstanceAddress qualified as RawInstanceAddress +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.GlobalConfigCodecGen cents : Decimal -> Numeric 0 cents c = intToNumeric (truncate c) @@ -24,46 +20,46 @@ cents c = intToNumeric (truncate c) testApplyDestChainConfigUpdatesParamsRoundtrip : Script () testApplyDestChainConfigUpdatesParamsRoundtrip = do let destChainConfigs = [ - DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 1.0 isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "e95aad72f136c035ecc1cabf477fcdeedace3bce" - defaultExecutor = Some (RawInstanceAddress.RawInstanceAddress "default-executor@party") - laneMandatedCCVs = [RawInstanceAddress.RawInstanceAddress "ccv1@party1", RawInstanceAddress.RawInstanceAddress "ccv2@party2"] - defaultCCVs = [RawInstanceAddress.RawInstanceAddress "default-ccv@party3"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv1@party1", Chainlink.InstanceAddress.RawInstanceAddress "ccv2@party2"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "default-ccv@party3"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 5.0 - ,DestChainConfigArgs with + ,CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 18446744073709551615.0 -- max uint64 isEnabled = False addressBytesLength = 32 tokenReceiverAllowed = True baseExecutionGasCost = 0 offRampAddress = "78d10cee9ec94b0bc1da62fa3eaeca1bc85c78abee0eafeab7a20bd12c877cd1" - defaultExecutor = Some (RawInstanceAddress.RawInstanceAddress "default-executor@party") - laneMandatedCCVs = [RawInstanceAddress.RawInstanceAddress "ccv2@party2"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv2@party2"] defaultCCVs = [] messageNetworkFeeUSDCents = 1.0 tokenNetworkFeeUSDCents = 1000.0 - ,DestChainConfigArgs with + ,CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 0.0 -- edge case: zero selector isEnabled = False addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "41c8c7184de518bcaaf75f3aea14c3bccb256f97" - defaultExecutor = Some (RawInstanceAddress.RawInstanceAddress "default-executor@party") - laneMandatedCCVs = [RawInstanceAddress.RawInstanceAddress "ccv2@party2"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv2@party2"] defaultCCVs = [] messageNetworkFeeUSDCents = 1.0 tokenNetworkFeeUSDCents = 1000.0 ] - args = ApplyDestChainConfigUpdatesParams with destChainConfigArgs = destChainConfigs - let encoded = GlobalConfigCodec.encodeApplyDestChainConfigUpdatesParams args - fst (fromSome (GlobalConfigCodec.decodeApplyDestChainConfigUpdatesParamsAt encoded 0)) === args + args = CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdatesParams with destChainConfigArgs = destChainConfigs + let encoded = CCIP.CoreV1.GlobalConfigCodecGen.encodeApplyDestChainConfigUpdatesParams args + fst (fromSome (CCIP.CoreV1.GlobalConfigCodecGen.decodeApplyDestChainConfigUpdatesParamsAt encoded 0)) === args -- =============================================== -- | ApplySourceChainConfigUpdates | @@ -72,28 +68,28 @@ testApplyDestChainConfigUpdatesParamsRoundtrip = do testApplySourceChainConfigUpdatesParamsRoundtrip : Script () testApplySourceChainConfigUpdatesParamsRoundtrip = do let sourceChainConfigs = [ - SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 1.0 isEnabled = True onRampAddresses = ["abcdef1234567890"] - laneMandatedCCVs = [RawInstanceAddress.RawInstanceAddress "src-ccv1@partyA", RawInstanceAddress.RawInstanceAddress "src-ccv2@partyB"] - defaultCCVs = [RawInstanceAddress.RawInstanceAddress "src-default@partyC"] - ,SourceChainConfigArgs with + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-ccv1@partyA", Chainlink.InstanceAddress.RawInstanceAddress "src-ccv2@partyB"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-default@partyC"] + ,CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 18446744073709551615.0 -- max uint64 isEnabled = False onRampAddresses = ["feedface"] - laneMandatedCCVs = [RawInstanceAddress.RawInstanceAddress "src-ccv2@partyB"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-ccv2@partyB"] defaultCCVs = [] - ,SourceChainConfigArgs with + ,CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 0.0 -- edge case: zero selector isEnabled = False onRampAddresses = ["feedface"] - laneMandatedCCVs = [RawInstanceAddress.RawInstanceAddress "src-ccv2@partyB"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-ccv2@partyB"] defaultCCVs = [] ] - args = ApplySourceChainConfigUpdatesParams with sourceChainConfigArgs = sourceChainConfigs - let encoded = GlobalConfigCodec.encodeApplySourceChainConfigUpdatesParams args - fst (fromSome (GlobalConfigCodec.decodeApplySourceChainConfigUpdatesParamsAt encoded 0)) === args + args = CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdatesParams with sourceChainConfigArgs = sourceChainConfigs + let encoded = CCIP.CoreV1.GlobalConfigCodecGen.encodeApplySourceChainConfigUpdatesParams args + fst (fromSome (CCIP.CoreV1.GlobalConfigCodecGen.decodeApplySourceChainConfigUpdatesParamsAt encoded 0)) === args -- =========================================================================== -- INVALID DATA REJECTION TESTS @@ -102,16 +98,16 @@ testApplySourceChainConfigUpdatesParamsRoundtrip = do testInvalidDataRejection : Script () testInvalidDataRejection = do -- Empty data should fail - case GlobalConfigCodec.decodeApplyDestChainConfigUpdatesParamsAt "" 0 of + case CCIP.CoreV1.GlobalConfigCodecGen.decodeApplyDestChainConfigUpdatesParamsAt "" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeApplyDestChainConfigUpdatesParams to fail on empty data" - case GlobalConfigCodec.decodeApplyDestChainConfigUpdatesParamsAt "00" 0 of + case CCIP.CoreV1.GlobalConfigCodecGen.decodeApplyDestChainConfigUpdatesParamsAt "00" 0 of Some _ -> pure () -- Expected (an empty list of updates is technically valid, so we should get Some []) None -> abort "Expected decodeApplyDestChainConfigUpdatesParams to succeed on empty list data" -- Invalid data should fail - case GlobalConfigCodec.decodeApplySourceChainConfigUpdatesParamsAt "1234" 0 of + case CCIP.CoreV1.GlobalConfigCodecGen.decodeApplySourceChainConfigUpdatesParamsAt "1234" 0 of None -> pure () -- Expected Some got -> abort ("Expected decodeApplySourceChainConfigUpdatesParams to fail on invalid data, got: " <> show got) diff --git a/contracts/ccip/test/daml/CCIP/GlobalConfigTest/GlobalConfigMCMSTest.daml b/contracts/ccip/test/daml/CCIP/GlobalConfigTest/GlobalConfigMCMSTest.daml index fa2b1d857..60f916774 100644 --- a/contracts/ccip/test/daml/CCIP/GlobalConfigTest/GlobalConfigMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/GlobalConfigTest/GlobalConfigMCMSTest.daml @@ -8,14 +8,11 @@ import DA.List import DA.Map qualified as Map import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.GlobalConfig -import CCIP.GlobalConfigCodecGen ( - encodeApplyDestChainConfigUpdatesParams, - encodeApplySourceChainConfigUpdatesParams, - ) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.GlobalConfigCodecGen cents : Decimal -> Numeric 0 cents c = intToNumeric (truncate c) @@ -32,35 +29,35 @@ testGlobalConfigMCMSEntrypoint_ApplyDestChainConfigUpdates = script do let instanceId = "globalconfig-test" chainSelector : Numeric 0 = 1.0 - -- Create GlobalConfig with no dest chain configs + -- Create CCIP.CoreV1.GlobalConfig.GlobalConfig with no dest chain configs gcCid <- submit ccipOwner do - createCmd GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId ccipOwner chainSelector = 123.0 -- Local chain destChainConfigs = Map.empty sourceChainConfigs = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver gcCid -- Create dest chain config update let args = [ - DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 456.0 isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "d589cf1d9ddc38d0aff8f324ed5d16d220f0fdbe" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - laneMandatedCCVs = [RawInstanceAddress "ccv@owner"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv@owner"] defaultCCVs = [] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 5.0 ] - encoded = encodeApplyDestChainConfigUpdatesParams (ApplyDestChainConfigUpdatesParams with destChainConfigArgs = args) + encoded = CCIP.CoreV1.GlobalConfigCodecGen.encodeApplyDestChainConfigUpdatesParams (CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdatesParams with destChainConfigArgs = args) -- Call mcmsEntrypoint newContractIds <- submit ccipOwner do @@ -70,7 +67,7 @@ testGlobalConfigMCMSEntrypoint_ApplyDestChainConfigUpdates = script do contractIds = Map.fromList [(instAddr, toAnyContractId gcCid)] -- Verify dest chain config was added - contracts <- query @GlobalConfig ccipOwner + contracts <- query @CCIP.CoreV1.GlobalConfig.GlobalConfig ccipOwner case filter (\(_, gc) -> gc.instanceId == instanceId) contracts of [(_, gc)] -> do Map.size gc.destChainConfigs === 1 @@ -88,59 +85,59 @@ testGlobalConfigMCMSEntrypoint_ApplyDestChainConfigUpdates_Replace = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "globalconfig-replace-test" - existingConfig = DestChainConfig with + existingConfig = CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = True baseExecutionGasCost = 0 offRampAddress = "abcd" - defaultExecutor = Some (RawInstanceAddress "executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "executor@party") laneMandatedCCVs = [] defaultCCVs = [] messageNetworkFeeUSDCents = cents 1.0 tokenNetworkFeeUSDCents = cents 1.0 - -- Create GlobalConfig with existing dest chain config + -- Create CCIP.CoreV1.GlobalConfig.GlobalConfig with existing dest chain config gcCid <- submit ccipOwner do - createCmd GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId ccipOwner chainSelector = 123.0 destChainConfigs = Map.fromList [(456.0, existingConfig)] sourceChainConfigs = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver gcCid -- Create multiple new configs, one to replace existing let args = [ - DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 456.0 isEnabled = False addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "b70fd68ac42892c71b3f9df7dde8efcafcfa82fe" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") laneMandatedCCVs = [] - defaultCCVs = [RawInstanceAddress "default@party"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "default@party"] messageNetworkFeeUSDCents = 20.0 tokenNetworkFeeUSDCents = 10.0 - ,DestChainConfigArgs with + ,CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 789.0 isEnabled = True addressBytesLength = 32 tokenReceiverAllowed = True baseExecutionGasCost = 0 offRampAddress = "fdd0a23462dbe0f8cd1dfb5afdb61ffa9dccdfab1dcfcb0ee87aec14269fe8b5" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - laneMandatedCCVs = [RawInstanceAddress "ccv@owner"] - defaultCCVs = [RawInstanceAddress "default@party"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv@owner"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "default@party"] messageNetworkFeeUSDCents = 300.0 tokenNetworkFeeUSDCents = 777.0 ] - encoded = encodeApplyDestChainConfigUpdatesParams (ApplyDestChainConfigUpdatesParams with destChainConfigArgs = args) + encoded = CCIP.CoreV1.GlobalConfigCodecGen.encodeApplyDestChainConfigUpdatesParams (CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdatesParams with destChainConfigArgs = args) -- Call mcmsEntrypoint newContractIds <- submit ccipOwner do @@ -150,7 +147,7 @@ testGlobalConfigMCMSEntrypoint_ApplyDestChainConfigUpdates_Replace = script do contractIds = Map.fromList [(instAddr, toAnyContractId gcCid)] -- Verify config was replaced - contracts <- query @GlobalConfig ccipOwner + contracts <- query @CCIP.CoreV1.GlobalConfig.GlobalConfig ccipOwner case filter (\(_, gc) -> gc.instanceId == instanceId) contracts of [(_, gc)] -> do Map.size gc.destChainConfigs === 2 @@ -177,29 +174,29 @@ testGlobalConfigMCMSEntrypoint_ApplySourceChainConfigUpdates = script do let instanceId = "globalconfig-source-test" - -- Create GlobalConfig with no source chain configs + -- Create CCIP.CoreV1.GlobalConfig.GlobalConfig with no source chain configs gcCid <- submit ccipOwner do - createCmd GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId ccipOwner chainSelector = 123.0 destChainConfigs = Map.empty sourceChainConfigs = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver gcCid -- Create source chain config let args = [ - SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 456.0 isEnabled = True onRampAddresses = ["fedcba0987654321"] - laneMandatedCCVs = [RawInstanceAddress "src-ccv@party1"] - defaultCCVs = [RawInstanceAddress "src-default@party2"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-ccv@party1"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-default@party2"] ] - encoded = encodeApplySourceChainConfigUpdatesParams (ApplySourceChainConfigUpdatesParams with sourceChainConfigArgs = args) + encoded = CCIP.CoreV1.GlobalConfigCodecGen.encodeApplySourceChainConfigUpdatesParams (CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdatesParams with sourceChainConfigArgs = args) -- Call mcmsEntrypoint newContractIds <- submit ccipOwner do @@ -209,7 +206,7 @@ testGlobalConfigMCMSEntrypoint_ApplySourceChainConfigUpdates = script do contractIds = Map.fromList [(instAddr, toAnyContractId gcCid)] -- Verify source chain config was added - contracts <- query @GlobalConfig ccipOwner + contracts <- query @CCIP.CoreV1.GlobalConfig.GlobalConfig ccipOwner case filter (\(_, gc) -> gc.instanceId == instanceId) contracts of [(_, gc)] -> do Map.size gc.sourceChainConfigs === 1 @@ -221,35 +218,35 @@ testGlobalConfigMCMSEntrypoint_ApplySourceChainConfigUpdates = script do let instanceId = "globalconfig-source-replace-test" - -- Create GlobalConfig with existing source chain config + -- Create CCIP.CoreV1.GlobalConfig.GlobalConfig with existing source chain config gcCid <- submit ccipOwner do - createCmd GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId ccipOwner chainSelector = 123.0 destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(456.0, SourceChainConfig True ["abcd"] [] [])] + sourceChainConfigs = Map.fromList [(456.0, CCIP.CoreV1.GlobalConfig.SourceChainConfig True ["abcd"] [] [])] - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver gcCid -- Create multiple new configs, one to replace existing let args = [ - SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 456.0 isEnabled = True onRampAddresses = ["fedcba0987654321"] - laneMandatedCCVs = [RawInstanceAddress "src-ccv@party1"] - defaultCCVs = [RawInstanceAddress "src-default@party2"] - ,SourceChainConfigArgs with + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-ccv@party1"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-default@party2"] + ,CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 789.0 isEnabled = True onRampAddresses = ["cafe5678"] - laneMandatedCCVs = [RawInstanceAddress "src-ccv@party1"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "src-ccv@party1"] defaultCCVs = [] ] - encoded = encodeApplySourceChainConfigUpdatesParams (ApplySourceChainConfigUpdatesParams with sourceChainConfigArgs = args) + encoded = CCIP.CoreV1.GlobalConfigCodecGen.encodeApplySourceChainConfigUpdatesParams (CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdatesParams with sourceChainConfigArgs = args) -- Call mcmsEntrypoint newContractIds <- submit ccipOwner do @@ -259,7 +256,7 @@ testGlobalConfigMCMSEntrypoint_ApplySourceChainConfigUpdates = script do contractIds = Map.fromList [(instAddr, toAnyContractId gcCid)] -- Verify source chain config was added - contracts <- query @GlobalConfig ccipOwner + contracts <- query @CCIP.CoreV1.GlobalConfig.GlobalConfig ccipOwner case filter (\(_, gc) -> gc.instanceId == instanceId) contracts of [(_, gc)] -> do Map.size gc.sourceChainConfigs === 2 @@ -287,14 +284,14 @@ testGlobalConfigMCMSEntrypoint_UnknownFunction = script do let instanceId = "globalconfig-error-test" gcCid <- submit ccipOwner do - createCmd GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId ccipOwner chainSelector = 1.0 destChainConfigs = Map.empty sourceChainConfigs = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver gcCid -- Call with unknown function name - should fail @@ -314,14 +311,14 @@ testGlobalConfigMCMSEntrypoint_InvalidParams = script do let instanceId = "globalconfig-invalid-test" gcCid <- submit ccipOwner do - createCmd GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId ccipOwner chainSelector = 1.0 destChainConfigs = Map.empty sourceChainConfigs = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver gcCid -- Call with invalid operationData - should fail @@ -341,7 +338,7 @@ testGlobalConfigMCMSEntrypoint_MissingSelfCid = script do let instanceId = "globalconfig-missing-cid-test" gcCid <- submit ccipOwner do - createCmd GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId ccipOwner chainSelector = 1.0 @@ -352,21 +349,21 @@ testGlobalConfigMCMSEntrypoint_MissingSelfCid = script do -- Encode valid params let args = [ - DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 456.0 isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "abcdef1234567890" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - laneMandatedCCVs = [RawInstanceAddress "ccv@owner"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv@owner"] defaultCCVs = [] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 5.0 ] - encoded = encodeApplyDestChainConfigUpdatesParams (ApplyDestChainConfigUpdatesParams with destChainConfigArgs = args) + encoded = CCIP.CoreV1.GlobalConfigCodecGen.encodeApplyDestChainConfigUpdatesParams (CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdatesParams with destChainConfigArgs = args) -- Call with empty contractIds map - should fail submitMustFail ccipOwner do @@ -384,7 +381,7 @@ toAnyContractId = coerceContractId -- Assertion helpers -- These compare Config <> Args, and therefore cannot assert on the chain selector since it's not part of the config itself, but rather the key in the map. The rest of the fields can be compared directly. -assertDestChainConfigsEqual : DestChainConfig -> DestChainConfigArgs -> Script () +assertDestChainConfigsEqual : CCIP.CoreV1.GlobalConfig.DestChainConfig -> CCIP.CoreV1.GlobalConfig.DestChainConfigArgs -> Script () assertDestChainConfigsEqual got expected = do assertMsg ("isEnabled mismatch, got: " <> show got.isEnabled <> ", expected: " <> show expected.isEnabled) (got.isEnabled == expected.isEnabled) assertMsg ("addressBytesLength mismatch, got: " <> show got.addressBytesLength <> ", expected: " <> show expected.addressBytesLength) (got.addressBytesLength == expected.addressBytesLength) @@ -397,7 +394,7 @@ assertDestChainConfigsEqual got expected = do assertMsg ("messageNetworkFeeUSDCents mismatch, got: " <> show got.messageNetworkFeeUSDCents <> ", expected: " <> show expected.messageNetworkFeeUSDCents) (got.messageNetworkFeeUSDCents == expected.messageNetworkFeeUSDCents) assertMsg ("tokenNetworkFeeUSDCents mismatch, got: " <> show got.tokenNetworkFeeUSDCents <> ", expected: " <> show expected.tokenNetworkFeeUSDCents) (got.tokenNetworkFeeUSDCents == expected.tokenNetworkFeeUSDCents) -assertSourceChainConfigsEqual : SourceChainConfig -> SourceChainConfigArgs -> Script () +assertSourceChainConfigsEqual : CCIP.CoreV1.GlobalConfig.SourceChainConfig -> CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs -> Script () assertSourceChainConfigsEqual got expected = do assertMsg ("isEnabled mismatch, got: " <> show got.isEnabled <> ", expected: " <> show expected.isEnabled) (got.isEnabled == expected.isEnabled) assertMsg ("onRampAddresses mismatch, got: " <> show got.onRampAddresses <> ", expected: " <> show expected.onRampAddresses) (got.onRampAddresses == expected.onRampAddresses) diff --git a/contracts/ccip/test/daml/CCIP/LockReleaseTokenPoolTest/LockReleaseTokenPoolCodecTest.daml b/contracts/ccip/test/daml/CCIP/LockReleaseTokenPoolTest/LockReleaseTokenPoolCodecTest.daml index fdaa27a4d..1c8df3d9a 100644 --- a/contracts/ccip/test/daml/CCIP/LockReleaseTokenPoolTest/LockReleaseTokenPoolCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/LockReleaseTokenPoolTest/LockReleaseTokenPoolCodecTest.daml @@ -4,35 +4,21 @@ module CCIP.LockReleaseTokenPoolTest.LockReleaseTokenPoolCodecTest where import Daml.Script import DA.Assert ((===)) import DA.Optional (fromSome) - -import CCIP.LockReleaseTokenPoolCodecGen qualified as LockReleaseTokenPoolCodec -import CCIP.LockReleaseTokenPoolTypes ( - ChainUpdate(..), - TokenTransferFeeConfigArgs(..), - RateLimitConfigArgs(..), - TransferTimeout(..), - SetDynamicConfigParams(..), - ApplyChainUpdatesParams(..), - ApplyTokenTransferFeeConfigUpdatesParams(..), - SetRateLimiterReferencesParams(..), - SetRateLimitConfigParams(..), - SetTransferTimeoutParams(..), - AddPoolReceiveContextNonContractValueParams(..), - AddPoolReceiveContextContractValueParams(..), - RemovePoolReceiveContextValueParams(..), - ) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.ContextCodec (encodeChoiceContext, decodeChoiceContextAt, encodeAnyValue) import DA.TextMap qualified as TextMap -import CCIP.FinalityConfig qualified as FinalityCodec +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.LockReleaseTokenPoolV1 +import qualified CCIP.LockReleaseTokenPoolV1CodecGen +import qualified CCIP.UtilsV1.Context mkFinalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n -- =============================================== -- | SetDynamicConfig | @@ -42,13 +28,13 @@ testSetDynamicConfigParamsRoundtrip : Script () testSetDynamicConfigParamsRoundtrip = do -- Test with rateLimitAdmin set rateLimitAdmin <- allocateParty "admin" - let args = SetDynamicConfigParams with rateLimitAdmin = Some rateLimitAdmin - encoded = LockReleaseTokenPoolCodec.encodeSetDynamicConfigParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeSetDynamicConfigParamsAt encoded 0)) === args + let args = CCIP.LockReleaseTokenPoolV1.SetDynamicConfigParams with rateLimitAdmin = Some rateLimitAdmin + encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeSetDynamicConfigParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeSetDynamicConfigParamsAt encoded 0)) === args -- Test with rateLimitAdmin not set - let argsNone = SetDynamicConfigParams with rateLimitAdmin = None - encodedNone = LockReleaseTokenPoolCodec.encodeSetDynamicConfigParams argsNone - fst (fromSome (LockReleaseTokenPoolCodec.decodeSetDynamicConfigParamsAt encodedNone 0)) === argsNone + let argsNone = CCIP.LockReleaseTokenPoolV1.SetDynamicConfigParams with rateLimitAdmin = None + encodedNone = CCIP.LockReleaseTokenPoolV1CodecGen.encodeSetDynamicConfigParams argsNone + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeSetDynamicConfigParamsAt encodedNone 0)) === argsNone -- =============================================== @@ -58,42 +44,42 @@ testSetDynamicConfigParamsRoundtrip = do testApplyChainUpdatesParamsRoundtrip : Script () testApplyChainUpdatesParamsRoundtrip = do let chainsToAdd = [ - ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 1.0 remotePools = ["1234567890abcdef", "fedcba0987654321"] remoteTokenAddress = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" - inboundCCVs = [RawInstanceAddress.RawInstanceAddress "ccv-inbound@party1", RawInstanceAddress.RawInstanceAddress "ccv-inbound2@party2"] - outboundCCVs = [RawInstanceAddress.RawInstanceAddress "ccv-outbound@party1"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv-inbound@party1", Chainlink.InstanceAddress.RawInstanceAddress "ccv-inbound2@party2"] + outboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "ccv-outbound@party1"] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party1" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party1" - , ChainUpdate with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party1" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party1" + , CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 18446744073709551615.0 -- max uint64 remotePools = [] remoteTokenAddress = "" inboundCCVs = [] outboundCCVs = [] finalityConfig = mkFinalityConfig 7 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party1" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party1" - , ChainUpdate with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party1" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party1" + , CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 0.0 remotePools = [] remoteTokenAddress = "c44879cc487d6ed2fdda5dfbebace4d430bd3f5a" inboundCCVs = [] outboundCCVs = [] finalityConfig = mkFinalityConfig 3 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party1" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party1" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party1" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party1" ] - args = ApplyChainUpdatesParams with + args = CCIP.LockReleaseTokenPoolV1.ApplyChainUpdatesParams with remoteChainSelectorsToRemove = [2.0, 3.0] chainsToAdd - let encoded = LockReleaseTokenPoolCodec.encodeApplyChainUpdatesParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeApplyChainUpdatesParamsAt encoded 0)) === args + let encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeApplyChainUpdatesParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeApplyChainUpdatesParamsAt encoded 0)) === args -- =============================================== -- | ApplyTokenTransferFeeConfigUpdates | @@ -102,14 +88,14 @@ testApplyChainUpdatesParamsRoundtrip = do testApplyTokenTransferFeeConfigUpdatesParamsRoundtrip : Script () testApplyTokenTransferFeeConfigUpdatesParamsRoundtrip = do let feeConfigArgs = [ - TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 1.0 isEnabled = True destGasOverhead = 21000 destBytesOverhead = 100 feeUSDCents = 50.0 feeBps = 25.0 - , TokenTransferFeeConfigArgs with + , CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 18446744073709551615.0 -- max uint64 isEnabled = False destGasOverhead = 30000 @@ -117,11 +103,11 @@ testApplyTokenTransferFeeConfigUpdatesParamsRoundtrip = do feeUSDCents = 100.0 feeBps = 50.0 ] - args = ApplyTokenTransferFeeConfigUpdatesParams with + args = CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdatesParams with tokenTransferFeeConfigArgs = feeConfigArgs disableTokenTransferFeeConfigArgs = [2.0, 3.0] - let encoded = LockReleaseTokenPoolCodec.encodeApplyTokenTransferFeeConfigUpdatesParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeApplyTokenTransferFeeConfigUpdatesParamsAt encoded 0)) === args + let encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeApplyTokenTransferFeeConfigUpdatesParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeApplyTokenTransferFeeConfigUpdatesParamsAt encoded 0)) === args -- =============================================== -- | SetRateLimiterReferences | @@ -130,26 +116,26 @@ testApplyTokenTransferFeeConfigUpdatesParamsRoundtrip = do testSetRateLimiterReferencesParamsRoundtrip : Script () testSetRateLimiterReferencesParamsRoundtrip = do let rateLimitConfigs = [ - RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 1.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party1" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party1" - , RateLimitConfigArgs with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party1" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party1" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party1" + , CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 18446744073709551615.0 -- max uint64 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party2" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party2" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party2" - , RateLimitConfigArgs with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party2" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party2" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party2" + , CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 0.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@party3" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party3" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@party3" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@party3" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@party3" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@party3" ] - args = SetRateLimiterReferencesParams with + args = CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferencesParams with rateLimitConfigArgs = rateLimitConfigs - let encoded = LockReleaseTokenPoolCodec.encodeSetRateLimiterReferencesParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeSetRateLimiterReferencesParamsAt encoded 0)) === args + let encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeSetRateLimiterReferencesParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeSetRateLimiterReferencesParamsAt encoded 0)) === args pure () -- =============================================== @@ -160,14 +146,14 @@ testSetRateLimitConfigParamsRoundtrip : Script () testSetRateLimitConfigParamsRoundtrip = script do admin <- allocateParty "rate_limit_admin" poolOwner <- allocateParty "pool_owner" - let args = SetRateLimitConfigParams with + let args = CCIP.LockReleaseTokenPoolV1.SetRateLimitConfigParams with caller = admin - rateLimiterInstanceAddress = RawInstanceAddress.make "rl-in" poolOwner + rateLimiterInstanceAddress = Chainlink.InstanceAddress.make "rl-in" poolOwner newIsEnabled = True newCapacity = 42.0 newRate = 3.0 - let encoded = LockReleaseTokenPoolCodec.encodeSetRateLimitConfigParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeSetRateLimitConfigParamsAt encoded 0)) === args + let encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeSetRateLimitConfigParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeSetRateLimitConfigParamsAt encoded 0)) === args pure () -- =============================================== @@ -177,22 +163,22 @@ testSetRateLimitConfigParamsRoundtrip = script do testTransferTimeoutRoundtrip : Script () testTransferTimeoutRoundtrip = do -- Test Indefinite - let indefinite = Indefinite - encodedIndefinite = LockReleaseTokenPoolCodec.encodeTransferTimeout indefinite - fst (fromSome (LockReleaseTokenPoolCodec.decodeTransferTimeoutAt encodedIndefinite 0)) === indefinite + let indefinite = CCIP.LockReleaseTokenPoolV1.Indefinite + encodedIndefinite = CCIP.LockReleaseTokenPoolV1CodecGen.encodeTransferTimeout indefinite + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeTransferTimeoutAt encodedIndefinite 0)) === indefinite -- Test RelativeHours with various values - let relHours24 = RelativeHours 24 - encodedRelHours24 = LockReleaseTokenPoolCodec.encodeTransferTimeout relHours24 - fst (fromSome (LockReleaseTokenPoolCodec.decodeTransferTimeoutAt encodedRelHours24 0)) === relHours24 + let relHours24 = CCIP.LockReleaseTokenPoolV1.RelativeHours 24 + encodedRelHours24 = CCIP.LockReleaseTokenPoolV1CodecGen.encodeTransferTimeout relHours24 + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeTransferTimeoutAt encodedRelHours24 0)) === relHours24 - let relHours0 = RelativeHours 0 - encodedRelHours0 = LockReleaseTokenPoolCodec.encodeTransferTimeout relHours0 - fst (fromSome (LockReleaseTokenPoolCodec.decodeTransferTimeoutAt encodedRelHours0 0)) === relHours0 + let relHours0 = CCIP.LockReleaseTokenPoolV1.RelativeHours 0 + encodedRelHours0 = CCIP.LockReleaseTokenPoolV1CodecGen.encodeTransferTimeout relHours0 + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeTransferTimeoutAt encodedRelHours0 0)) === relHours0 - let relHoursLarge = RelativeHours 8760 -- 1 year in hours - encodedRelHoursLarge = LockReleaseTokenPoolCodec.encodeTransferTimeout relHoursLarge - fst (fromSome (LockReleaseTokenPoolCodec.decodeTransferTimeoutAt encodedRelHoursLarge 0)) === relHoursLarge + let relHoursLarge = CCIP.LockReleaseTokenPoolV1.RelativeHours 8760 -- 1 year in hours + encodedRelHoursLarge = CCIP.LockReleaseTokenPoolV1CodecGen.encodeTransferTimeout relHoursLarge + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeTransferTimeoutAt encodedRelHoursLarge 0)) === relHoursLarge -- =============================================== -- | Pool receive context MCMS param codecs | @@ -200,24 +186,24 @@ testTransferTimeoutRoundtrip = do testAddPoolReceiveContextNonContractValueParamsRoundtrip : Script () testAddPoolReceiveContextNonContractValueParamsRoundtrip = do - let inner = encodeAnyValue (MetadataV1.AV_Text "hello") - args = AddPoolReceiveContextNonContractValueParams with contextKey = "myKey", valuePayload = inner - encoded = LockReleaseTokenPoolCodec.encodeAddPoolReceiveContextNonContractValueParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeAddPoolReceiveContextNonContractValueParamsAt encoded 0)) === args + let inner = CCIP.UtilsV1.Context.encodeAnyValue (Splice.Api.Token.MetadataV1.AV_Text "hello") + args = CCIP.LockReleaseTokenPoolV1.AddPoolReceiveContextNonContractValueParams with contextKey = "myKey", valuePayload = inner + encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeAddPoolReceiveContextNonContractValueParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeAddPoolReceiveContextNonContractValueParamsAt encoded 0)) === args testAddPoolReceiveContextContractValueParamsRoundtrip : Script () testAddPoolReceiveContextContractValueParamsRoundtrip = script do p <- allocateParty "p" - let ria = RawInstanceAddress.make "other-inst" p - args = AddPoolReceiveContextContractValueParams with contextKey = "refKey", referentInstanceAddress = ria - encoded = LockReleaseTokenPoolCodec.encodeAddPoolReceiveContextContractValueParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeAddPoolReceiveContextContractValueParamsAt encoded 0)) === args + let ria = Chainlink.InstanceAddress.make "other-inst" p + args = CCIP.LockReleaseTokenPoolV1.AddPoolReceiveContextContractValueParams with contextKey = "refKey", referentInstanceAddress = ria + encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeAddPoolReceiveContextContractValueParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeAddPoolReceiveContextContractValueParamsAt encoded 0)) === args testRemovePoolReceiveContextValueParamsRoundtrip : Script () testRemovePoolReceiveContextValueParamsRoundtrip = do - let args = RemovePoolReceiveContextValueParams with contextKey = "toRemove" - encoded = LockReleaseTokenPoolCodec.encodeRemovePoolReceiveContextValueParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeRemovePoolReceiveContextValueParamsAt encoded 0)) === args + let args = CCIP.LockReleaseTokenPoolV1.RemovePoolReceiveContextValueParams with contextKey = "toRemove" + encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeRemovePoolReceiveContextValueParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeRemovePoolReceiveContextValueParamsAt encoded 0)) === args -- =============================================== -- | ChoiceContext (ContextCodec) | @@ -226,24 +212,24 @@ testRemovePoolReceiveContextValueParamsRoundtrip = do testChoiceContextCodecRoundtrip : Script () testChoiceContextCodecRoundtrip = do -- Test empty context - let emptyCtx = MetadataV1.emptyChoiceContext - encodedEmpty = encodeChoiceContext emptyCtx - fst (fromSome (decodeChoiceContextAt encodedEmpty 0)) === emptyCtx + let emptyCtx = Splice.Api.Token.MetadataV1.emptyChoiceContext + encodedEmpty = CCIP.UtilsV1.Context.encodeChoiceContext emptyCtx + fst (fromSome (CCIP.UtilsV1.Context.decodeChoiceContextAt encodedEmpty 0)) === emptyCtx -- Test context with simple text values - let ctxWithText = MetadataV1.ChoiceContext (TextMap.fromList [("key1", MetadataV1.AV_Text "value1"), ("key2", MetadataV1.AV_Text "value2")]) - encodedWithText = encodeChoiceContext ctxWithText - fst (fromSome (decodeChoiceContextAt encodedWithText 0)) === ctxWithText + let ctxWithText = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("key1", Splice.Api.Token.MetadataV1.AV_Text "value1"), ("key2", Splice.Api.Token.MetadataV1.AV_Text "value2")]) + encodedWithText = CCIP.UtilsV1.Context.encodeChoiceContext ctxWithText + fst (fromSome (CCIP.UtilsV1.Context.decodeChoiceContextAt encodedWithText 0)) === ctxWithText -- Test context with int values - let ctxWithInt = MetadataV1.ChoiceContext (TextMap.fromList [("count", MetadataV1.AV_Int 42)]) - encodedWithInt = encodeChoiceContext ctxWithInt - fst (fromSome (decodeChoiceContextAt encodedWithInt 0)) === ctxWithInt + let ctxWithInt = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("count", Splice.Api.Token.MetadataV1.AV_Int 42)]) + encodedWithInt = CCIP.UtilsV1.Context.encodeChoiceContext ctxWithInt + fst (fromSome (CCIP.UtilsV1.Context.decodeChoiceContextAt encodedWithInt 0)) === ctxWithInt -- Test context with bool values - let ctxWithBool = MetadataV1.ChoiceContext (TextMap.fromList [("enabled", MetadataV1.AV_Bool True), ("disabled", MetadataV1.AV_Bool False)]) - encodedWithBool = encodeChoiceContext ctxWithBool - fst (fromSome (decodeChoiceContextAt encodedWithBool 0)) === ctxWithBool + let ctxWithBool = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("enabled", Splice.Api.Token.MetadataV1.AV_Bool True), ("disabled", Splice.Api.Token.MetadataV1.AV_Bool False)]) + encodedWithBool = CCIP.UtilsV1.Context.encodeChoiceContext ctxWithBool + fst (fromSome (CCIP.UtilsV1.Context.decodeChoiceContextAt encodedWithBool 0)) === ctxWithBool -- =============================================== -- | SetTransferTimeout | @@ -252,9 +238,9 @@ testChoiceContextCodecRoundtrip = do testSetTransferTimeoutRoundtrip : Script () testSetTransferTimeoutRoundtrip = do -- Test using the params wrapper - let args = SetTransferTimeoutParams with transferTimeout = RelativeHours 48 - encoded = LockReleaseTokenPoolCodec.encodeSetTransferTimeoutParams args - fst (fromSome (LockReleaseTokenPoolCodec.decodeSetTransferTimeoutParamsAt encoded 0)) === args + let args = CCIP.LockReleaseTokenPoolV1.SetTransferTimeoutParams with transferTimeout = CCIP.LockReleaseTokenPoolV1.RelativeHours 48 + encoded = CCIP.LockReleaseTokenPoolV1CodecGen.encodeSetTransferTimeoutParams args + fst (fromSome (CCIP.LockReleaseTokenPoolV1CodecGen.decodeSetTransferTimeoutParamsAt encoded 0)) === args -- =========================================================================== -- INVALID DATA REJECTION TESTS @@ -263,12 +249,12 @@ testSetTransferTimeoutRoundtrip = do testInvalidDataRejection : Script () testInvalidDataRejection = do -- Empty data should fail - case LockReleaseTokenPoolCodec.decodeApplyChainUpdatesParamsAt "" 0 of + case CCIP.LockReleaseTokenPoolV1CodecGen.decodeApplyChainUpdatesParamsAt "" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeApplyChainUpdatesParams to fail on empty data" -- Invalid tag for TransferTimeout should fail - case LockReleaseTokenPoolCodec.decodeTransferTimeoutAt "ff" 0 of + case CCIP.LockReleaseTokenPoolV1CodecGen.decodeTransferTimeoutAt "ff" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeTransferTimeoutAt to fail on invalid tag" diff --git a/contracts/ccip/test/daml/CCIP/LockReleaseTokenPoolTest/LockReleaseTokenPoolMCMSTest.daml b/contracts/ccip/test/daml/CCIP/LockReleaseTokenPoolTest/LockReleaseTokenPoolMCMSTest.daml index c09bb04cc..708a15c60 100644 --- a/contracts/ccip/test/daml/CCIP/LockReleaseTokenPoolTest/LockReleaseTokenPoolMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/LockReleaseTokenPoolTest/LockReleaseTokenPoolMCMSTest.daml @@ -10,35 +10,28 @@ import DA.Optional (fromSome) import DA.TextMap qualified as TextMap import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.LockReleaseTokenPool -import CCIP.LockReleaseTokenPoolCodecGen ( - encodeSetDynamicConfigParams, - encodeApplyChainUpdatesParams, - encodeSetRateLimiterReferencesParams, - encodeSetTransferTimeoutParams, - encodeAddPoolReceiveContextNonContractValueParams, - encodeAddPoolReceiveContextContractValueParams, - encodeRemovePoolReceiveContextValueParams, - ) - -import CCIP.ContextCodec (encodeAnyValue) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 + +import qualified Chainlink.InstanceAddress + +import CCIP.CodecV1.FinalityConfig +import CCIP.LockReleaseTokenPoolV1 +import CCIP.LockReleaseTokenPoolV1CodecGen +import CCIP.UtilsV1.Context mkFinalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n dummyPoolDeps : Party -> LockReleaseTokenPoolDeps dummyPoolDeps ccipOwner = LockReleaseTokenPoolDeps with - tokenAdminRegistry = RawInstanceAddress ("dummy-tar@" <> partyToText ccipOwner) - rmnRemote = RawInstanceAddress ("dummy-rmn@" <> partyToText ccipOwner) - feeQuoter = RawInstanceAddress ("dummy-fq@" <> partyToText ccipOwner) + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress ("dummy-tar@" <> partyToText ccipOwner) + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress ("dummy-rmn@" <> partyToText ccipOwner) + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress ("dummy-fq@" <> partyToText ccipOwner) -- ======================================================== -- | MCMS Entrypoint - SetDynamicConfig | @@ -64,11 +57,11 @@ testLockReleaseTokenPoolMCMSEntrypoint_SetDynamicConfig = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Update rate limit admin via mcmsEntrypoint @@ -114,11 +107,11 @@ testLockReleaseTokenPoolMCMSEntrypoint_ApplyChainUpdates = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Create remote chain config @@ -127,12 +120,12 @@ testLockReleaseTokenPoolMCMSEntrypoint_ApplyChainUpdates = script do remoteChainSelector = 123.0 remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4", "d7e508a1d4ba82aed19fadcbf6ebd81d2c9b173a"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner", RawInstanceAddress "in2@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner", Chainlink.InstanceAddress.RawInstanceAddress "in2@owner"] outboundCCVs = [] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-new@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-new@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-new@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-new@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-new@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-new@owner" ] encoded = encodeApplyChainUpdatesParams (ApplyChainUpdatesParams with @@ -171,12 +164,12 @@ testLockReleaseTokenPoolMCMSEntrypoint_UpdateChainPoolConfigs_Multiple = script existingConfig = RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" - inboundCCVs = [RawInstanceAddress "in1@owner"] - outboundCCVs = [RawInstanceAddress "out1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner"] + outboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "out1@owner"] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- Create LockReleaseTokenPool with existing remote chain config poolCid <- submit poolOwner do @@ -189,11 +182,11 @@ testLockReleaseTokenPoolMCMSEntrypoint_UpdateChainPoolConfigs_Multiple = script rateLimitAdmin = None remoteChainConfigs = Map.fromList [(123.0, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) transferTimeout = RelativeHours 24 deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Create multiple chain pool configs, one to replace existing @@ -202,22 +195,22 @@ testLockReleaseTokenPoolMCMSEntrypoint_UpdateChainPoolConfigs_Multiple = script remoteChainSelector = 123.0 remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4", "d7e508a1d4ba82aed19fadcbf6ebd81d2c9b173a"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner", RawInstanceAddress "in2@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner", Chainlink.InstanceAddress.RawInstanceAddress "in2@owner"] outboundCCVs = [] finalityConfig = mkFinalityConfig 12 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-new@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-new@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-new@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-new@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-new@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-new@owner" ,ChainUpdate with remoteChainSelector = 456.0 remotePools = ["d3704b816babab425caa936be1eb5b5a9bfb59c7"] remoteTokenAddress = "cf9a923ab9efa0e261608dbd3c40fc0cfabade92" - inboundCCVs = [RawInstanceAddress "in4@owner", RawInstanceAddress "in5@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in4@owner", Chainlink.InstanceAddress.RawInstanceAddress "in5@owner"] outboundCCVs = [] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-2@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-2@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-2@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-2@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-2@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-2@owner" ] encoded = encodeApplyChainUpdatesParams (ApplyChainUpdatesParams with @@ -261,12 +254,12 @@ testLockReleaseTokenPoolMCMSEntrypoint_SetRateLimiterReferences = script do existingConfig = RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" - inboundCCVs = [RawInstanceAddress "in1@owner"] - outboundCCVs = [RawInstanceAddress "out1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner"] + outboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "out1@owner"] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- Create LockReleaseTokenPool with existing config poolCid <- submit poolOwner do @@ -279,20 +272,20 @@ testLockReleaseTokenPoolMCMSEntrypoint_SetRateLimiterReferences = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(123.0, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Create rate limiter config update for existing chain let args = [ RateLimitConfigArgs with remoteChainSelector = 123.0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-updated@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-updated@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-updated@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-updated@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-updated@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-updated@owner" ] encoded = encodeSetRateLimiterReferencesParams (SetRateLimiterReferencesParams with @@ -341,11 +334,11 @@ testLockReleaseTokenPoolMCMSEntrypoint_UnknownFunction = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Call with unknown function name - should fail @@ -377,11 +370,11 @@ testLockReleaseTokenPoolMCMSEntrypoint_InvalidParams = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Call with invalid operationData - should fail @@ -413,7 +406,7 @@ testLockReleaseTokenPoolMCMSEntrypoint_MissingSelfCid = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.ChoiceContext (TextMap.empty) + poolReceiveContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.empty) transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner @@ -425,12 +418,12 @@ testLockReleaseTokenPoolMCMSEntrypoint_MissingSelfCid = script do remoteChainSelector = 123.0 remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4", "d7e508a1d4ba82aed19fadcbf6ebd81d2c9b173a"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner", RawInstanceAddress "in2@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner", Chainlink.InstanceAddress.RawInstanceAddress "in2@owner"] outboundCCVs = [] finalityConfig = mkFinalityConfig 0 - inboundRateLimiter = RawInstanceAddress "rate-limiter-in-new@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom-new@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out-new@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-new@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom-new@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-new@owner" ] encoded = encodeApplyChainUpdatesParams (ApplyChainUpdatesParams with @@ -497,15 +490,15 @@ testLockReleaseTokenPoolMCMSEntrypoint_AddPoolReceiveContextNonContractValue = s rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - let newContext = MetadataV1.ChoiceContext (TextMap.fromList [("key1", MetadataV1.AV_Text "value1"), ("key2", MetadataV1.AV_Int 42)]) - let encoded1 = encodeAddPoolReceiveContextNonContractValueParams (AddPoolReceiveContextNonContractValueParams with contextKey = "key1", valuePayload = encodeAnyValue (MetadataV1.AV_Text "value1")) + let newContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("key1", Splice.Api.Token.MetadataV1.AV_Text "value1"), ("key2", Splice.Api.Token.MetadataV1.AV_Int 42)]) + let encoded1 = encodeAddPoolReceiveContextNonContractValueParams (AddPoolReceiveContextNonContractValueParams with contextKey = "key1", valuePayload = encodeAnyValue (Splice.Api.Token.MetadataV1.AV_Text "value1")) cidMap1 <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "AddPoolReceiveContextNonContractValue" @@ -514,7 +507,7 @@ testLockReleaseTokenPoolMCMSEntrypoint_AddPoolReceiveContextNonContractValue = s let poolCid2 = coerceContractId (fromSome (Map.lookup instAddr cidMap1)) : ContractId LockReleaseTokenPool let target2 = toInterfaceContractId @MCMSReceiver poolCid2 - let encoded2 = encodeAddPoolReceiveContextNonContractValueParams (AddPoolReceiveContextNonContractValueParams with contextKey = "key2", valuePayload = encodeAnyValue (MetadataV1.AV_Int 42)) + let encoded2 = encodeAddPoolReceiveContextNonContractValueParams (AddPoolReceiveContextNonContractValueParams with contextKey = "key2", valuePayload = encodeAnyValue (Splice.Api.Token.MetadataV1.AV_Int 42)) _ <- submit poolOwner do exerciseCmd target2 MCMSReceiver_Entrypoint with functionName = "AddPoolReceiveContextNonContractValue" @@ -535,7 +528,7 @@ testLockReleaseTokenPoolMCMSEntrypoint_ClearPoolReceiveContext = script do let instanceId = "pool-context-empty-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" - initialContext = MetadataV1.ChoiceContext (TextMap.fromList [("existing", MetadataV1.AV_Text "data")]) + initialContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("existing", Splice.Api.Token.MetadataV1.AV_Text "data")]) poolCid <- submit poolOwner do createCmd LockReleaseTokenPool with @@ -551,10 +544,10 @@ testLockReleaseTokenPoolMCMSEntrypoint_ClearPoolReceiveContext = script do transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - let emptyContext = MetadataV1.emptyChoiceContext + let emptyContext = Splice.Api.Token.MetadataV1.emptyChoiceContext _ <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "ClearPoolReceiveContext" @@ -586,13 +579,13 @@ testLockReleaseTokenPoolMCMSEntrypoint_AddPoolReceiveContextContractValue = scri rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid - let encoded = encodeAddPoolReceiveContextContractValueParams (AddPoolReceiveContextContractValueParams with contextKey = "selfRef", referentInstanceAddress = RawInstanceAddress instAddr) + let encoded = encodeAddPoolReceiveContextContractValueParams (AddPoolReceiveContextContractValueParams with contextKey = "selfRef", referentInstanceAddress = Chainlink.InstanceAddress.RawInstanceAddress instAddr) _ <- submit poolOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -603,7 +596,7 @@ testLockReleaseTokenPoolMCMSEntrypoint_AddPoolReceiveContextContractValue = scri contracts <- query @LockReleaseTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do - let expected = MetadataV1.ChoiceContext (TextMap.fromList [("selfRef", MetadataV1.AV_ContractId (coerceContractId poolCid))]) + let expected = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("selfRef", Splice.Api.Token.MetadataV1.AV_ContractId (coerceContractId poolCid))]) assertMsg ("poolReceiveContext mismatch, got: " <> show pool.poolReceiveContext) (pool.poolReceiveContext == expected) _ -> abort "Expected exactly one LockReleaseTokenPool contract" @@ -615,7 +608,7 @@ testLockReleaseTokenPoolMCMSEntrypoint_RemovePoolReceiveContextValue = script do let instanceId = "pool-context-remove-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "USDC" - initialContext = MetadataV1.ChoiceContext (TextMap.fromList [("keep", MetadataV1.AV_Text "me"), ("remove", MetadataV1.AV_Int 99)]) + initialContext = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("keep", Splice.Api.Token.MetadataV1.AV_Text "me"), ("remove", Splice.Api.Token.MetadataV1.AV_Int 99)]) poolCid <- submit poolOwner do createCmd LockReleaseTokenPool with @@ -631,7 +624,7 @@ testLockReleaseTokenPoolMCMSEntrypoint_RemovePoolReceiveContextValue = script do transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid let encoded = encodeRemovePoolReceiveContextValueParams (RemovePoolReceiveContextValueParams with contextKey = "remove") @@ -644,7 +637,7 @@ testLockReleaseTokenPoolMCMSEntrypoint_RemovePoolReceiveContextValue = script do contracts <- query @LockReleaseTokenPool poolOwner case filter (\(_, pool) -> pool.instanceId == instanceId) contracts of [(_, pool)] -> do - let expected = MetadataV1.ChoiceContext (TextMap.fromList [("keep", MetadataV1.AV_Text "me")]) + let expected = Splice.Api.Token.MetadataV1.ChoiceContext (TextMap.fromList [("keep", Splice.Api.Token.MetadataV1.AV_Text "me")]) assertMsg ("poolReceiveContext mismatch, got: " <> show pool.poolReceiveContext) (pool.poolReceiveContext == expected) _ -> abort "Expected exactly one LockReleaseTokenPool contract" @@ -672,11 +665,11 @@ testLockReleaseTokenPoolMCMSEntrypoint_SetTransferTimeout_Indefinite = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext transferTimeout = RelativeHours 24 deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Change to Indefinite @@ -716,11 +709,11 @@ testLockReleaseTokenPoolMCMSEntrypoint_SetTransferTimeout_RelativeHours = script rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Change to RelativeHours 48 @@ -760,11 +753,11 @@ testLockReleaseTokenPoolMCMSEntrypoint_SetTransferTimeout_InvalidData = script d rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner - let instAddr = RawInstanceAddress.makeText instanceId poolOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId poolOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver poolCid -- Call with invalid tag byte - should fail @@ -787,12 +780,12 @@ testLockReleaseTokenPool_RejectsInvalidBlockDepthConfig = script do mkRemoteConfig finality = RemoteChainConfig with remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner"] outboundCCVs = [] finalityConfig = finality - inboundRateLimiter = RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" mkPool remoteChainConfigs = LockReleaseTokenPool with instanceId poolOwner @@ -802,15 +795,15 @@ testLockReleaseTokenPool_RejectsInvalidBlockDepthConfig = script do rateLimitAdmin = None remoteChainConfigs tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner submitMustFail poolOwner do - createCmd (mkPool (Map.fromList [(123.0, mkRemoteConfig (FinalityCodec.BlockDepth 0))])) + createCmd (mkPool (Map.fromList [(123.0, mkRemoteConfig (CCIP.CodecV1.FinalityConfig.BlockDepth 0))])) submitMustFail poolOwner do - createCmd (mkPool (Map.fromList [(123.0, mkRemoteConfig (FinalityCodec.BlockDepth (-1)))])) + createCmd (mkPool (Map.fromList [(123.0, mkRemoteConfig (CCIP.CodecV1.FinalityConfig.BlockDepth (-1)))])) poolCid <- submit poolOwner do createCmd (mkPool Map.empty) @@ -819,27 +812,27 @@ testLockReleaseTokenPool_RejectsInvalidBlockDepthConfig = script do remoteChainSelector = 123.0 remotePools = ["1fb477ac89df394bead4f46ad754f8aec70cc0e4"] remoteTokenAddress = "cbae4ea0c4c503a582af009bb2b30b75badc1e32" - inboundCCVs = [RawInstanceAddress "in1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "in1@owner"] outboundCCVs = [] finalityConfig = finality - inboundRateLimiter = RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress "rate-limiter-in-custom@owner" - outboundRateLimiter = RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" submitMustFail poolOwner do exerciseCmd poolCid ApplyChainUpdates with remoteChainSelectorsToRemove = [] - chainsToAdd = [mkUpdate (FinalityCodec.BlockDepth 0)] + chainsToAdd = [mkUpdate (CCIP.CodecV1.FinalityConfig.BlockDepth 0)] submitMustFail poolOwner do exerciseCmd poolCid ApplyChainUpdates with remoteChainSelectorsToRemove = [] - chainsToAdd = [mkUpdate (FinalityCodec.BlockDepth (-1))] + chainsToAdd = [mkUpdate (CCIP.CodecV1.FinalityConfig.BlockDepth (-1))] _ <- submit poolOwner do exerciseCmd poolCid ApplyChainUpdates with remoteChainSelectorsToRemove = [] - chainsToAdd = [mkUpdate (FinalityCodec.BlockDepth 1)] + chainsToAdd = [mkUpdate (CCIP.CodecV1.FinalityConfig.BlockDepth 1)] pure () @@ -859,7 +852,7 @@ testLockReleaseTokenPool_RejectsInvalidDecimals = script do rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext transferTimeout = Indefinite deps = dummyPoolDeps ccipOwner diff --git a/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampCodecTest.daml b/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampCodecTest.daml index f399ac551..ad898a860 100644 --- a/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampCodecTest.daml @@ -4,9 +4,10 @@ module CCIP.OffRampTest.OffRampCodecTest where import Daml.Script import DA.Assert ((===)) -import CCIP.OffRampTypes (OffRampDeps(..), SetDepsParams(..)) -import CCIP.OffRampCodecGen (encodeSetDepsParams, decodeSetDepsParamsAt, encodeOffRampDeps, decodeOffRampDepsAt) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.RuntimeV1.OffRamp +import qualified CCIP.RuntimeV1.OffRampCodecGen -- =========================================================================== -- SETDEPSPARAMS ENCODING/DECODING TESTS (Optional fields) @@ -14,14 +15,14 @@ import Chainlink.InstanceAddress (RawInstanceAddress(..)) testSetDepsParamsRoundtrip_AllSome : Script () testSetDepsParamsRoundtrip_AllSome = do - let params = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc-instance@party::namespace") - rmnRemote = Some (RawInstanceAddress "rmn-instance@another-party") - tokenAdminRegistry = Some (RawInstanceAddress "tar-instance@yet-another") + let params = CCIP.RuntimeV1.OffRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc-instance@party::namespace") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn-instance@another-party") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar-instance@yet-another") - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.OffRampCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.OffRampCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (all Some)" Some decoded -> decoded === params @@ -29,14 +30,14 @@ testSetDepsParamsRoundtrip_AllSome = do testSetDepsParamsRoundtrip_AllNone : Script () testSetDepsParamsRoundtrip_AllNone = do - let params = SetDepsParams with + let params = CCIP.RuntimeV1.OffRamp.SetDepsParams with globalConfig = None rmnRemote = None tokenAdminRegistry = None - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.OffRampCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.OffRampCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (all None)" Some decoded -> decoded === params @@ -44,14 +45,14 @@ testSetDepsParamsRoundtrip_AllNone = do testSetDepsParamsRoundtrip_Mixed : Script () testSetDepsParamsRoundtrip_Mixed = do - let params = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc@owner") + let params = CCIP.RuntimeV1.OffRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc@owner") rmnRemote = None - tokenAdminRegistry = Some (RawInstanceAddress "tar@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar@owner") - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.OffRampCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.OffRampCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (mixed)" Some decoded -> decoded === params @@ -63,14 +64,14 @@ testSetDepsParamsRoundtrip_Mixed = do testOffRampDepsRoundtrip : Script () testOffRampDepsRoundtrip = do - let deps = OffRampDeps with - globalConfig = RawInstanceAddress "globalconfig@ccip_owner" - rmnRemote = RawInstanceAddress "rmnremote@ccip_owner" - tokenAdminRegistry = RawInstanceAddress "tar@ccip_owner" + let deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "globalconfig@ccip_owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmnremote@ccip_owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@ccip_owner" - encoded = encodeOffRampDeps deps + encoded = CCIP.RuntimeV1.OffRampCodecGen.encodeOffRampDeps deps - case decodeOffRampDepsAt encoded 0 of + case CCIP.RuntimeV1.OffRampCodecGen.decodeOffRampDepsAt encoded 0 of None -> abort "Failed to decode OffRampDeps" Some (decoded, _) -> do decoded.globalConfig === deps.globalConfig @@ -81,14 +82,14 @@ testOffRampDepsRoundtrip = do testOffRampDepsSpecialCharacters : Script () testOffRampDepsSpecialCharacters = do - let deps = OffRampDeps with - globalConfig = RawInstanceAddress "config-with-dashes@party1::namespace1" - rmnRemote = RawInstanceAddress "rmn_with_underscores@party2::namespace2" - tokenAdminRegistry = RawInstanceAddress "tar.with.dots@party3" + let deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "config-with-dashes@party1::namespace1" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn_with_underscores@party2::namespace2" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar.with.dots@party3" - encoded = encodeOffRampDeps deps + encoded = CCIP.RuntimeV1.OffRampCodecGen.encodeOffRampDeps deps - case decodeOffRampDepsAt encoded 0 of + case CCIP.RuntimeV1.OffRampCodecGen.decodeOffRampDepsAt encoded 0 of None -> abort "Failed to decode OffRampDeps with special characters" Some (decoded, _) -> do decoded.globalConfig === deps.globalConfig @@ -103,11 +104,11 @@ testOffRampDepsSpecialCharacters = do testInvalidDataRejection : Script () testInvalidDataRejection = do - case decodeSetDepsParamsAt "" 0 of + case CCIP.RuntimeV1.OffRampCodecGen.decodeSetDepsParamsAt "" 0 of None -> pure () Some _ -> abort "Expected decodeSetDepsParamsAt to fail on empty data" - case decodeSetDepsParamsAt "ff" 0 of + case CCIP.RuntimeV1.OffRampCodecGen.decodeSetDepsParamsAt "ff" 0 of None -> pure () Some _ -> abort "Expected decodeSetDepsParamsAt to fail on invalid tag" diff --git a/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampMCMSTest.daml b/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampMCMSTest.daml index 4a080b36d..5b48fa1ad 100644 --- a/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampMCMSTest.daml @@ -7,11 +7,11 @@ import DA.Assert ((===)) import DA.Map qualified as Map import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.OffRamp -import CCIP.OffRampTypes (OffRampDeps(..), SetDepsParams(..)) -import CCIP.OffRampCodecGen (encodeSetDepsParams) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.RuntimeV1.OffRamp +import qualified CCIP.RuntimeV1.OffRampCodecGen -- =========================================================================== -- MCMS ENTRYPOINT TESTS - SET DEPS @@ -23,26 +23,26 @@ testOffRampMCMSEntrypoint_SetDeps = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "offramp-test" - initialDeps = OffRampDeps with - globalConfig = RawInstanceAddress "gc-old@owner" - rmnRemote = RawInstanceAddress "rmn-old@owner" - tokenAdminRegistry = RawInstanceAddress "tar-old@owner" + initialDeps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" offRampCid <- submit ccipOwner do - createCmd OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId ccipOwner deps = initialDeps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver offRampCid - let newDeps = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc-new@owner") - rmnRemote = Some (RawInstanceAddress "rmn-new@owner") - tokenAdminRegistry = Some (RawInstanceAddress "tar-new@owner") + let newDeps = CCIP.RuntimeV1.OffRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar-new@owner") - encoded = encodeSetDepsParams newDeps + encoded = CCIP.RuntimeV1.OffRampCodecGen.encodeSetDepsParams newDeps newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -50,12 +50,12 @@ testOffRampMCMSEntrypoint_SetDeps = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId offRampCid)] - contracts <- query @OffRamp ccipOwner + contracts <- query @CCIP.RuntimeV1.OffRamp.OffRamp ccipOwner case filter (\(_, offRamp) -> offRamp.instanceId == instanceId) contracts of [(_, offRamp)] -> do - offRamp.deps.globalConfig === RawInstanceAddress "gc-new@owner" - offRamp.deps.rmnRemote === RawInstanceAddress "rmn-new@owner" - offRamp.deps.tokenAdminRegistry === RawInstanceAddress "tar-new@owner" + offRamp.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner" + offRamp.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner" + offRamp.deps.tokenAdminRegistry === Chainlink.InstanceAddress.RawInstanceAddress "tar-new@owner" _ -> abort "Expected exactly one OffRamp contract" pure () @@ -66,26 +66,26 @@ testOffRampMCMSEntrypoint_SetDeps_Partial = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "offramp-partial-test" - initialDeps = OffRampDeps with - globalConfig = RawInstanceAddress "gc-old@owner" - rmnRemote = RawInstanceAddress "rmn-old@owner" - tokenAdminRegistry = RawInstanceAddress "tar-old@owner" + initialDeps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" offRampCid <- submit ccipOwner do - createCmd OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId ccipOwner deps = initialDeps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver offRampCid - let partialDeps = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc-new@owner") + let partialDeps = CCIP.RuntimeV1.OffRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner") rmnRemote = None tokenAdminRegistry = None - encoded = encodeSetDepsParams partialDeps + encoded = CCIP.RuntimeV1.OffRampCodecGen.encodeSetDepsParams partialDeps submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -93,12 +93,12 @@ testOffRampMCMSEntrypoint_SetDeps_Partial = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId offRampCid)] - contracts <- query @OffRamp ccipOwner + contracts <- query @CCIP.RuntimeV1.OffRamp.OffRamp ccipOwner case filter (\(_, offRamp) -> offRamp.instanceId == instanceId) contracts of [(_, offRamp)] -> do - offRamp.deps.globalConfig === RawInstanceAddress "gc-new@owner" - offRamp.deps.rmnRemote === RawInstanceAddress "rmn-old@owner" - offRamp.deps.tokenAdminRegistry === RawInstanceAddress "tar-old@owner" + offRamp.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner" + offRamp.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" + offRamp.deps.tokenAdminRegistry === Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" _ -> abort "Expected exactly one OffRamp contract" pure () @@ -109,25 +109,25 @@ testOffRampMCMSEntrypoint_SetDeps_Replace = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "offramp-replace-test" - initialDeps = OffRampDeps with - globalConfig = RawInstanceAddress "gc1@owner" - rmnRemote = RawInstanceAddress "rmn1@owner" - tokenAdminRegistry = RawInstanceAddress "tar1@owner" + initialDeps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc1@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn1@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar1@owner" offRampCid <- submit ccipOwner do - createCmd OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId ccipOwner deps = initialDeps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver offRampCid - let deps2 = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc2@owner") - rmnRemote = Some (RawInstanceAddress "rmn2@owner") - tokenAdminRegistry = Some (RawInstanceAddress "tar2@owner") - encoded1 = encodeSetDepsParams deps2 + let deps2 = CCIP.RuntimeV1.OffRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc2@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn2@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar2@owner") + encoded1 = CCIP.RuntimeV1.OffRampCodecGen.encodeSetDepsParams deps2 newContractIds1 <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -135,17 +135,17 @@ testOffRampMCMSEntrypoint_SetDeps_Replace = script do operationData = encoded1 contractIds = Map.fromList [(instAddr, toAnyContractId offRampCid)] - contracts1 <- query @OffRamp ccipOwner + contracts1 <- query @CCIP.RuntimeV1.OffRamp.OffRamp ccipOwner case filter (\(_, offRamp) -> offRamp.instanceId == instanceId) contracts1 of [(newCid, offRamp1)] -> do - offRamp1.deps.globalConfig === RawInstanceAddress "gc2@owner" + offRamp1.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc2@owner" let targetAsMcmsReceiver2 = toInterfaceContractId @MCMSReceiver newCid - let deps3 = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc3@owner") - rmnRemote = Some (RawInstanceAddress "rmn3@owner") - tokenAdminRegistry = Some (RawInstanceAddress "tar3@owner") - encoded2 = encodeSetDepsParams deps3 + let deps3 = CCIP.RuntimeV1.OffRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc3@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn3@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar3@owner") + encoded2 = CCIP.RuntimeV1.OffRampCodecGen.encodeSetDepsParams deps3 newContractIds2 <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver2 MCMSReceiver_Entrypoint with @@ -153,11 +153,11 @@ testOffRampMCMSEntrypoint_SetDeps_Replace = script do operationData = encoded2 contractIds = Map.fromList [(instAddr, toAnyContractId newCid)] - contracts2 <- query @OffRamp ccipOwner + contracts2 <- query @CCIP.RuntimeV1.OffRamp.OffRamp ccipOwner case filter (\(_, offRamp) -> offRamp.instanceId == instanceId) contracts2 of [(_, offRamp2)] -> do - offRamp2.deps.globalConfig === RawInstanceAddress "gc3@owner" - offRamp2.deps.rmnRemote === RawInstanceAddress "rmn3@owner" + offRamp2.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc3@owner" + offRamp2.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn3@owner" _ -> abort "Expected exactly one OffRamp contract after second update" _ -> abort "Expected exactly one OffRamp contract after first update" @@ -174,18 +174,18 @@ testOffRampMCMSEntrypoint_UnknownFunction = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "offramp-error-test" - deps = OffRampDeps with - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" offRampCid <- submit ccipOwner do - createCmd OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId ccipOwner deps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver offRampCid submitMustFail ccipOwner do @@ -202,18 +202,18 @@ testOffRampMCMSEntrypoint_InvalidParams = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "offramp-invalid-test" - deps = OffRampDeps with - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" offRampCid <- submit ccipOwner do - createCmd OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId ccipOwner deps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver offRampCid submitMustFail ccipOwner do @@ -230,20 +230,20 @@ testOffRampMCMSEntrypoint_MissingSelfCid = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "offramp-missing-cid-test" - deps = OffRampDeps with - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" offRampCid <- submit ccipOwner do - createCmd OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId ccipOwner deps let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver offRampCid - let encoded = encodeSetDepsParams (SetDepsParams with + let encoded = CCIP.RuntimeV1.OffRampCodecGen.encodeSetDepsParams (CCIP.RuntimeV1.OffRamp.SetDepsParams with globalConfig = Some deps.globalConfig rmnRemote = Some deps.rmnRemote tokenAdminRegistry = Some deps.tokenAdminRegistry) diff --git a/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampTokenOnlyCCVTest.daml b/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampTokenOnlyCCVTest.daml index 2d88fb4cc..ff52dc1c7 100644 --- a/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampTokenOnlyCCVTest.daml +++ b/contracts/ccip/test/daml/CCIP/OffRampTest/OffRampTokenOnlyCCVTest.daml @@ -7,12 +7,12 @@ import DA.List (sort) import DA.Map qualified as Map import DA.Optional (fromSome) -import qualified CCIP.FinalityConfig -import qualified CCIP.GlobalConfig -import qualified CCIP.MessageCodecV1 -import qualified CCIP.OffRamp -import qualified CCIP.OffRampTypes -import Chainlink.InstanceAddress qualified as RawInstanceAddress +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.RuntimeV1.OffRamp -- | Token-only transfers include lane-mandated CCVs in the required set. testTokenOnlyExecuteIncludesLaneMandatedCCVs : Script () @@ -24,15 +24,15 @@ testTokenOnlyExecuteIncludesLaneMandatedCCVs = script do let destChainSelector : Numeric 0 = 222.0 let globalConfigInstanceId = "globalconfig-token-only" let offRampInstanceId = "offramp-token-only" - let laneCcv = RawInstanceAddress.make "lane-ccv" laneCcvOwner + let laneCcv = Chainlink.InstanceAddress.make "lane-ccv" laneCcvOwner globalConfigCid <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty sourceChainConfigs = Map.fromList - [ (sourceChainSelector, CCIP.GlobalConfig.SourceChainConfig with + [ (sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [laneCcv] @@ -40,33 +40,33 @@ testTokenOnlyExecuteIncludesLaneMandatedCCVs = script do ) ] - let globalConfigAddr = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let offRampAddr = RawInstanceAddress.make offRampInstanceId ccipOwner + let globalConfigAddr = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let offRampAddr = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner offRampCid <- submit ccipOwner do - createCmd CCIP.OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = CCIP.OffRampTypes.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigAddr - rmnRemote = RawInstanceAddress.make "rmn-token-only" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "tar-token-only" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-token-only" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-token-only" ccipOwner - let tokenOnlyMessage = CCIP.MessageCodecV1.MessageV1 with + let tokenOnlyMessage = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 0 - finality = CCIP.FinalityConfig.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress offRampAddr + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress offRampAddr sender = "0000000000000000000000000000000000000000000000000000000000000003" receiver = "0000000000000000000000000000000000000000000000000000000000000004" destBlob = "" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 1.0) + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1.0) sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000005" sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" destTokenAddress = "0000000000000000000000000000000000000000000000000000000000000007" @@ -75,7 +75,7 @@ testTokenOnlyExecuteIncludesLaneMandatedCCVs = script do messageData = "" requiredCCVs <- submit ccipOwner do - exerciseCmd offRampCid CCIP.OffRamp.GetRequiredCCVsForExecuteFromRouter with + exerciseCmd offRampCid CCIP.RuntimeV1.OffRamp.GetRequiredCCVsForExecuteFromRouter with globalConfigCid = globalConfigCid message = tokenOnlyMessage receiverRequiredCCVs = [] @@ -93,17 +93,17 @@ testTokenOnlyExecuteMergesPoolAndLaneCCVs = script do let sourceChainSelector : Numeric 0 = 111.0 let destChainSelector : Numeric 0 = 222.0 - let laneCcv = RawInstanceAddress.make "lane-ccv-merge" laneCcvOwner - let poolCcv = RawInstanceAddress.make "pool-ccv-merge" laneCcvOwner + let laneCcv = Chainlink.InstanceAddress.make "lane-ccv-merge" laneCcvOwner + let poolCcv = Chainlink.InstanceAddress.make "pool-ccv-merge" laneCcvOwner globalConfigCid <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = "globalconfig-merge" ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty sourceChainConfigs = Map.fromList - [ (sourceChainSelector, CCIP.GlobalConfig.SourceChainConfig with + [ (sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [laneCcv] @@ -112,29 +112,29 @@ testTokenOnlyExecuteMergesPoolAndLaneCCVs = script do ] offRampCid <- submit ccipOwner do - createCmd CCIP.OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "offramp-merge" ccipOwner = ccipOwner - deps = CCIP.OffRampTypes.OffRampDeps with - globalConfig = RawInstanceAddress.make "globalconfig-merge" ccipOwner - rmnRemote = RawInstanceAddress.make "rmn-merge" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "tar-merge" ccipOwner + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.make "globalconfig-merge" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-merge" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-merge" ccipOwner - let tokenOnlyMessage = CCIP.MessageCodecV1.MessageV1 with + let tokenOnlyMessage = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 0 - finality = CCIP.FinalityConfig.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" receiver = "0000000000000000000000000000000000000000000000000000000000000004" destBlob = "" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 1.0) + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1.0) sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000005" sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" destTokenAddress = "0000000000000000000000000000000000000000000000000000000000000007" @@ -143,7 +143,7 @@ testTokenOnlyExecuteMergesPoolAndLaneCCVs = script do messageData = "" requiredCCVs <- submit ccipOwner do - exerciseCmd offRampCid CCIP.OffRamp.GetRequiredCCVsForExecuteFromRouter with + exerciseCmd offRampCid CCIP.RuntimeV1.OffRamp.GetRequiredCCVsForExecuteFromRouter with globalConfigCid = globalConfigCid message = tokenOnlyMessage receiverRequiredCCVs = [] diff --git a/contracts/ccip/test/daml/CCIP/OnRampTest/OnRampCodecTest.daml b/contracts/ccip/test/daml/CCIP/OnRampTest/OnRampCodecTest.daml index bdf52299c..cbee617ba 100644 --- a/contracts/ccip/test/daml/CCIP/OnRampTest/OnRampCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/OnRampTest/OnRampCodecTest.daml @@ -4,11 +4,11 @@ module CCIP.OnRampTest.OnRampCodecTest where import Daml.Script import DA.Assert ((===)) -import CCIP.OnRamp (orderedVerifierDataByCCVs) -import CCIP.OnRampTypes (OnRampDeps(..), SetDepsParams(..)) -import CCIP.OnRampCodecGen (encodeSetDepsParams, decodeSetDepsParamsAt, encodeOnRampDeps, decodeOnRampDepsAt) -import Chainlink.InstanceAddress (RawInstanceAddress(..), make, toInstanceAddress) -import CCIP.SendingMessageV1 qualified as SendingMessageV1 +import qualified Chainlink.InstanceAddress + +import qualified CCIP.RuntimeV1.OnRamp +import qualified CCIP.RuntimeV1.OnRampCodecGen +import qualified CCIP.CoreV1.SendingMessage -- =========================================================================== -- SETDEPSPARAMS ENCODING/DECODING TESTS (Optional fields) @@ -16,16 +16,15 @@ import CCIP.SendingMessageV1 qualified as SendingMessageV1 testSetDepsParamsRoundtrip_AllSome : Script () testSetDepsParamsRoundtrip_AllSome = do - let params = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc-instance@party::namespace") - rmnRemote = Some (RawInstanceAddress "rmn-instance@another-party") - tokenAdminRegistry = Some (RawInstanceAddress "tar-instance@yet-another") - feeQuoter = Some (RawInstanceAddress "fq-instance@fee-owner") - ccvRegistry = Some (RawInstanceAddress "ccv-registry@registry-owner") + let params = CCIP.RuntimeV1.OnRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc-instance@party::namespace") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn-instance@another-party") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar-instance@yet-another") + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq-instance@fee-owner") - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.OnRampCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.OnRampCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (all Some)" Some decoded -> decoded === params @@ -33,16 +32,15 @@ testSetDepsParamsRoundtrip_AllSome = do testSetDepsParamsRoundtrip_AllNone : Script () testSetDepsParamsRoundtrip_AllNone = do - let params = SetDepsParams with + let params = CCIP.RuntimeV1.OnRamp.SetDepsParams with globalConfig = None rmnRemote = None tokenAdminRegistry = None feeQuoter = None - ccvRegistry = None - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.OnRampCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.OnRampCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (all None)" Some decoded -> decoded === params @@ -50,16 +48,15 @@ testSetDepsParamsRoundtrip_AllNone = do testSetDepsParamsRoundtrip_Mixed : Script () testSetDepsParamsRoundtrip_Mixed = do - let params = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc@owner") + let params = CCIP.RuntimeV1.OnRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc@owner") rmnRemote = None tokenAdminRegistry = None - feeQuoter = Some (RawInstanceAddress "fq@owner") - ccvRegistry = None + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq@owner") - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.OnRampCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.OnRampCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (mixed)" Some decoded -> decoded === params @@ -71,45 +68,41 @@ testSetDepsParamsRoundtrip_Mixed = do testOnRampDepsRoundtrip : Script () testOnRampDepsRoundtrip = do - let deps = OnRampDeps with - globalConfig = RawInstanceAddress "globalconfig@ccip_owner" - rmnRemote = RawInstanceAddress "rmnremote@ccip_owner" - tokenAdminRegistry = RawInstanceAddress "tar@ccip_owner" - feeQuoter = RawInstanceAddress "feequoter@ccip_owner" - ccvRegistry = RawInstanceAddress "ccvregistry@ccip_owner" + let deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "globalconfig@ccip_owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmnremote@ccip_owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@ccip_owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "feequoter@ccip_owner" - encoded = encodeOnRampDeps deps + encoded = CCIP.RuntimeV1.OnRampCodecGen.encodeOnRampDeps deps - case decodeOnRampDepsAt encoded 0 of + case CCIP.RuntimeV1.OnRampCodecGen.decodeOnRampDepsAt encoded 0 of None -> abort "Failed to decode OnRampDeps" Some (decoded, _) -> do decoded.globalConfig === deps.globalConfig decoded.rmnRemote === deps.rmnRemote decoded.tokenAdminRegistry === deps.tokenAdminRegistry decoded.feeQuoter === deps.feeQuoter - decoded.ccvRegistry === deps.ccvRegistry pure () testOnRampDepsSpecialCharacters : Script () testOnRampDepsSpecialCharacters = do - let deps = OnRampDeps with - globalConfig = RawInstanceAddress "config-with-dashes@party1::namespace1" - rmnRemote = RawInstanceAddress "rmn_with_underscores@party2::namespace2" - tokenAdminRegistry = RawInstanceAddress "tar.with.dots@party3" - feeQuoter = RawInstanceAddress "fq/with/slashes@party4" - ccvRegistry = RawInstanceAddress "ccv:with:colons@party5" + let deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "config-with-dashes@party1::namespace1" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn_with_underscores@party2::namespace2" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar.with.dots@party3" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq/with/slashes@party4" - encoded = encodeOnRampDeps deps + encoded = CCIP.RuntimeV1.OnRampCodecGen.encodeOnRampDeps deps - case decodeOnRampDepsAt encoded 0 of + case CCIP.RuntimeV1.OnRampCodecGen.decodeOnRampDepsAt encoded 0 of None -> abort "Failed to decode OnRampDeps with special characters" Some (decoded, _) -> do decoded.globalConfig === deps.globalConfig decoded.rmnRemote === deps.rmnRemote decoded.tokenAdminRegistry === deps.tokenAdminRegistry decoded.feeQuoter === deps.feeQuoter - decoded.ccvRegistry === deps.ccvRegistry pure () @@ -119,11 +112,11 @@ testOnRampDepsSpecialCharacters = do testInvalidDataRejection : Script () testInvalidDataRejection = do - case decodeSetDepsParamsAt "" 0 of + case CCIP.RuntimeV1.OnRampCodecGen.decodeSetDepsParamsAt "" 0 of None -> pure () Some _ -> abort "Expected decodeSetDepsParamsAt to fail on empty data" - case decodeSetDepsParamsAt "ff" 0 of + case CCIP.RuntimeV1.OnRampCodecGen.decodeSetDepsParamsAt "ff" 0 of None -> pure () Some _ -> abort "Expected decodeSetDepsParamsAt to fail on invalid tag" @@ -133,22 +126,22 @@ testOrderedVerifierDataByCCVs : Script () testOrderedVerifierDataByCCVs = do ccvOwner <- allocateParty "ccv-owner" - let ccv1 = toInstanceAddress (make "ccv-1" ccvOwner) - ccv2 = toInstanceAddress (make "ccv-2" ccvOwner) - vd1 = SendingMessageV1.VerifierData with + let ccv1 = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "ccv-1" ccvOwner) + ccv2 = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "ccv-2" ccvOwner) + vd1 = CCIP.CoreV1.SendingMessage.VerifierData with ccvInstanceId = "ccv-1" ccvOwner = ccvOwner versionTag = "11111111" verifierBlob = "aaaa" messageSentObservers = [] - vd2 = SendingMessageV1.VerifierData with + vd2 = CCIP.CoreV1.SendingMessage.VerifierData with ccvInstanceId = "ccv-2" ccvOwner = ccvOwner versionTag = "22222222" verifierBlob = "bbbb" messageSentObservers = [] - let ordered = orderedVerifierDataByCCVs [ccv1, ccv2] [vd2, vd1] + let ordered = CCIP.RuntimeV1.OnRamp.orderedVerifierDataByCCVs [ccv1, ccv2] [vd2, vd1] map (.ccvInstanceId) ordered === ["ccv-1", "ccv-2"] map (.verifierBlob) ordered === ["aaaa", "bbbb"] diff --git a/contracts/ccip/test/daml/CCIP/OnRampTest/OnRampMCMSTest.daml b/contracts/ccip/test/daml/CCIP/OnRampTest/OnRampMCMSTest.daml index f9397d203..ced0cea44 100644 --- a/contracts/ccip/test/daml/CCIP/OnRampTest/OnRampMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/OnRampTest/OnRampMCMSTest.daml @@ -7,11 +7,11 @@ import DA.Assert ((===)) import DA.Map qualified as Map import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.OnRamp -import CCIP.OnRampTypes (OnRampDeps(..), SetDepsParams(..)) -import CCIP.OnRampCodecGen (encodeSetDepsParams) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.RuntimeV1.OnRamp +import qualified CCIP.RuntimeV1.OnRampCodecGen -- =========================================================================== -- MCMS ENTRYPOINT TESTS - SET DEPS @@ -23,31 +23,29 @@ testOnRampMCMSEntrypoint_SetDeps = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "onramp-test" - initialDeps = OnRampDeps with - globalConfig = RawInstanceAddress "gc-old@owner" - rmnRemote = RawInstanceAddress "rmn-old@owner" - tokenAdminRegistry = RawInstanceAddress "tar-old@owner" - feeQuoter = RawInstanceAddress "fq-old@owner" - ccvRegistry = RawInstanceAddress "ccv-old@owner" + initialDeps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq-old@owner" onRampCid <- submit ccipOwner do - createCmd OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId ccipOwner maxUSDCentsPerMsg = 1000000000.0 deps = initialDeps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver onRampCid - let newDeps = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc-new@owner") - rmnRemote = Some (RawInstanceAddress "rmn-new@owner") - tokenAdminRegistry = Some (RawInstanceAddress "tar-new@owner") - feeQuoter = Some (RawInstanceAddress "fq-new@owner") - ccvRegistry = Some (RawInstanceAddress "ccv-new@owner") + let newDeps = CCIP.RuntimeV1.OnRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar-new@owner") + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq-new@owner") - encoded = encodeSetDepsParams newDeps + encoded = CCIP.RuntimeV1.OnRampCodecGen.encodeSetDepsParams newDeps newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -55,49 +53,46 @@ testOnRampMCMSEntrypoint_SetDeps = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId onRampCid)] - contracts <- query @OnRamp ccipOwner + contracts <- query @CCIP.RuntimeV1.OnRamp.OnRamp ccipOwner case filter (\(_, onRamp) -> onRamp.instanceId == instanceId) contracts of [(_, onRamp)] -> do - onRamp.deps.globalConfig === RawInstanceAddress "gc-new@owner" - onRamp.deps.rmnRemote === RawInstanceAddress "rmn-new@owner" - onRamp.deps.tokenAdminRegistry === RawInstanceAddress "tar-new@owner" - onRamp.deps.feeQuoter === RawInstanceAddress "fq-new@owner" - onRamp.deps.ccvRegistry === RawInstanceAddress "ccv-new@owner" + onRamp.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner" + onRamp.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner" + onRamp.deps.tokenAdminRegistry === Chainlink.InstanceAddress.RawInstanceAddress "tar-new@owner" + onRamp.deps.feeQuoter === Chainlink.InstanceAddress.RawInstanceAddress "fq-new@owner" _ -> abort "Expected exactly one OnRamp contract" pure () --- | Test partial update: only update feeQuoter and ccvRegistry +-- | Test partial update: only update feeQuoter testOnRampMCMSEntrypoint_SetDeps_Partial : Script () testOnRampMCMSEntrypoint_SetDeps_Partial = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "onramp-partial-test" - initialDeps = OnRampDeps with - globalConfig = RawInstanceAddress "gc-old@owner" - rmnRemote = RawInstanceAddress "rmn-old@owner" - tokenAdminRegistry = RawInstanceAddress "tar-old@owner" - feeQuoter = RawInstanceAddress "fq-old@owner" - ccvRegistry = RawInstanceAddress "ccv-old@owner" + initialDeps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq-old@owner" onRampCid <- submit ccipOwner do - createCmd OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId ccipOwner maxUSDCentsPerMsg = 1000000000.0 deps = initialDeps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver onRampCid - let partialDeps = SetDepsParams with + let partialDeps = CCIP.RuntimeV1.OnRamp.SetDepsParams with globalConfig = None rmnRemote = None tokenAdminRegistry = None - feeQuoter = Some (RawInstanceAddress "fq-new@owner") - ccvRegistry = Some (RawInstanceAddress "ccv-new@owner") + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq-new@owner") - encoded = encodeSetDepsParams partialDeps + encoded = CCIP.RuntimeV1.OnRampCodecGen.encodeSetDepsParams partialDeps submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -105,14 +100,13 @@ testOnRampMCMSEntrypoint_SetDeps_Partial = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId onRampCid)] - contracts <- query @OnRamp ccipOwner + contracts <- query @CCIP.RuntimeV1.OnRamp.OnRamp ccipOwner case filter (\(_, onRamp) -> onRamp.instanceId == instanceId) contracts of [(_, onRamp)] -> do - onRamp.deps.globalConfig === RawInstanceAddress "gc-old@owner" - onRamp.deps.rmnRemote === RawInstanceAddress "rmn-old@owner" - onRamp.deps.tokenAdminRegistry === RawInstanceAddress "tar-old@owner" - onRamp.deps.feeQuoter === RawInstanceAddress "fq-new@owner" - onRamp.deps.ccvRegistry === RawInstanceAddress "ccv-new@owner" + onRamp.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + onRamp.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" + onRamp.deps.tokenAdminRegistry === Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + onRamp.deps.feeQuoter === Chainlink.InstanceAddress.RawInstanceAddress "fq-new@owner" _ -> abort "Expected exactly one OnRamp contract" pure () @@ -123,30 +117,28 @@ testOnRampMCMSEntrypoint_SetDeps_Replace = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "onramp-replace-test" - initialDeps = OnRampDeps with - globalConfig = RawInstanceAddress "gc1@owner" - rmnRemote = RawInstanceAddress "rmn1@owner" - tokenAdminRegistry = RawInstanceAddress "tar1@owner" - feeQuoter = RawInstanceAddress "fq1@owner" - ccvRegistry = RawInstanceAddress "ccv1@owner" + initialDeps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc1@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn1@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar1@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq1@owner" onRampCid <- submit ccipOwner do - createCmd OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId ccipOwner maxUSDCentsPerMsg = 1000000000.0 deps = initialDeps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver onRampCid - let deps2 = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc2@owner") - rmnRemote = Some (RawInstanceAddress "rmn2@owner") - tokenAdminRegistry = Some (RawInstanceAddress "tar2@owner") - feeQuoter = Some (RawInstanceAddress "fq2@owner") - ccvRegistry = Some (RawInstanceAddress "ccv2@owner") - encoded1 = encodeSetDepsParams deps2 + let deps2 = CCIP.RuntimeV1.OnRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc2@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn2@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar2@owner") + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq2@owner") + encoded1 = CCIP.RuntimeV1.OnRampCodecGen.encodeSetDepsParams deps2 newContractIds1 <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -154,19 +146,18 @@ testOnRampMCMSEntrypoint_SetDeps_Replace = script do operationData = encoded1 contractIds = Map.fromList [(instAddr, toAnyContractId onRampCid)] - contracts1 <- query @OnRamp ccipOwner + contracts1 <- query @CCIP.RuntimeV1.OnRamp.OnRamp ccipOwner case filter (\(_, onRamp) -> onRamp.instanceId == instanceId) contracts1 of [(newCid, onRamp1)] -> do - onRamp1.deps.globalConfig === RawInstanceAddress "gc2@owner" + onRamp1.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc2@owner" let targetAsMcmsReceiver2 = toInterfaceContractId @MCMSReceiver newCid - let deps3 = SetDepsParams with - globalConfig = Some (RawInstanceAddress "gc3@owner") - rmnRemote = Some (RawInstanceAddress "rmn3@owner") - tokenAdminRegistry = Some (RawInstanceAddress "tar3@owner") - feeQuoter = Some (RawInstanceAddress "fq3@owner") - ccvRegistry = Some (RawInstanceAddress "ccv3@owner") - encoded2 = encodeSetDepsParams deps3 + let deps3 = CCIP.RuntimeV1.OnRamp.SetDepsParams with + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc3@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn3@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar3@owner") + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq3@owner") + encoded2 = CCIP.RuntimeV1.OnRampCodecGen.encodeSetDepsParams deps3 newContractIds2 <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver2 MCMSReceiver_Entrypoint with @@ -174,11 +165,11 @@ testOnRampMCMSEntrypoint_SetDeps_Replace = script do operationData = encoded2 contractIds = Map.fromList [(instAddr, toAnyContractId newCid)] - contracts2 <- query @OnRamp ccipOwner + contracts2 <- query @CCIP.RuntimeV1.OnRamp.OnRamp ccipOwner case filter (\(_, onRamp) -> onRamp.instanceId == instanceId) contracts2 of [(_, onRamp2)] -> do - onRamp2.deps.globalConfig === RawInstanceAddress "gc3@owner" - onRamp2.deps.rmnRemote === RawInstanceAddress "rmn3@owner" + onRamp2.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc3@owner" + onRamp2.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn3@owner" _ -> abort "Expected exactly one OnRamp contract after second update" _ -> abort "Expected exactly one OnRamp contract after first update" @@ -194,21 +185,20 @@ testOnRampMCMSEntrypoint_UnknownFunction = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "onramp-error-test" - deps = OnRampDeps with - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - ccvRegistry = RawInstanceAddress "ccv@owner" + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" onRampCid <- submit ccipOwner do - createCmd OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId ccipOwner maxUSDCentsPerMsg = 1000000000.0 deps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver onRampCid submitMustFail ccipOwner do @@ -224,21 +214,20 @@ testOnRampMCMSEntrypoint_InvalidParams = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "onramp-invalid-test" - deps = OnRampDeps with - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - ccvRegistry = RawInstanceAddress "ccv@owner" + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" onRampCid <- submit ccipOwner do - createCmd OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId ccipOwner maxUSDCentsPerMsg = 1000000000.0 deps - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver onRampCid submitMustFail ccipOwner do @@ -254,15 +243,14 @@ testOnRampMCMSEntrypoint_MissingSelfCid = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "onramp-missing-cid-test" - deps = OnRampDeps with - globalConfig = RawInstanceAddress "gc@owner" - rmnRemote = RawInstanceAddress "rmn@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - ccvRegistry = RawInstanceAddress "ccv@owner" + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" onRampCid <- submit ccipOwner do - createCmd OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId ccipOwner maxUSDCentsPerMsg = 1000000000.0 @@ -270,12 +258,11 @@ testOnRampMCMSEntrypoint_MissingSelfCid = script do let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver onRampCid - let encoded = encodeSetDepsParams (SetDepsParams with + let encoded = CCIP.RuntimeV1.OnRampCodecGen.encodeSetDepsParams (CCIP.RuntimeV1.OnRamp.SetDepsParams with globalConfig = Some deps.globalConfig rmnRemote = Some deps.rmnRemote tokenAdminRegistry = Some deps.tokenAdminRegistry - feeQuoter = Some deps.feeQuoter - ccvRegistry = Some deps.ccvRegistry) + feeQuoter = Some deps.feeQuoter) submitMustFail ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with diff --git a/contracts/ccip/test/daml/CCIP/PerPartyRouterTest/PerPartyRouterCodecTest.daml b/contracts/ccip/test/daml/CCIP/PerPartyRouterTest/PerPartyRouterCodecTest.daml index 36a5e94d4..94f75ad64 100644 --- a/contracts/ccip/test/daml/CCIP/PerPartyRouterTest/PerPartyRouterCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/PerPartyRouterTest/PerPartyRouterCodecTest.daml @@ -4,9 +4,10 @@ module CCIP.PerPartyRouterTest.PerPartyRouterCodecTest where import Daml.Script import DA.Assert ((===)) -import CCIP.PerPartyRouterTypes (PerPartyRouterDeps(..), SetDepsParams(..)) -import CCIP.PerPartyRouterCodecGen (encodeSetDepsParams, decodeSetDepsParamsAt, encodePerPartyRouterDeps, decodePerPartyRouterDepsAt) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.RuntimeV1.PerPartyRouter +import qualified CCIP.RuntimeV1.PerPartyRouterCodecGen -- =========================================================================== -- SETDEPSPARAMS ENCODING/DECODING TESTS (Optional fields) @@ -14,17 +15,17 @@ import Chainlink.InstanceAddress (RawInstanceAddress(..)) testSetDepsParamsRoundtrip_AllSome : Script () testSetDepsParamsRoundtrip_AllSome = do - let params = SetDepsParams with - onRamp = Some (RawInstanceAddress "onramp-instance@party::namespace") - offRamp = Some (RawInstanceAddress "offramp-instance@another-party") - globalConfig = Some (RawInstanceAddress "gc-instance@yet-another") - tokenAdminRegistry = Some (RawInstanceAddress "tar-instance@tar-owner") - feeQuoter = Some (RawInstanceAddress "fq-instance@fee-owner") - rmnRemote = Some (RawInstanceAddress "rmn-instance@rmn-owner") + let params = CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with + onRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "onramp-instance@party::namespace") + offRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "offramp-instance@another-party") + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc-instance@yet-another") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar-instance@tar-owner") + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq-instance@fee-owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn-instance@rmn-owner") - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.PerPartyRouterCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (all Some)" Some decoded -> decoded === params @@ -32,7 +33,7 @@ testSetDepsParamsRoundtrip_AllSome = do testSetDepsParamsRoundtrip_AllNone : Script () testSetDepsParamsRoundtrip_AllNone = do - let params = SetDepsParams with + let params = CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with onRamp = None offRamp = None globalConfig = None @@ -40,9 +41,9 @@ testSetDepsParamsRoundtrip_AllNone = do feeQuoter = None rmnRemote = None - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.PerPartyRouterCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (all None)" Some decoded -> decoded === params @@ -50,17 +51,17 @@ testSetDepsParamsRoundtrip_AllNone = do testSetDepsParamsRoundtrip_Mixed : Script () testSetDepsParamsRoundtrip_Mixed = do - let params = SetDepsParams with - onRamp = Some (RawInstanceAddress "onramp@owner") + let params = CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with + onRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner") offRamp = None globalConfig = None - tokenAdminRegistry = Some (RawInstanceAddress "tar@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar@owner") feeQuoter = None - rmnRemote = Some (RawInstanceAddress "rmn@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner") - encoded = encodeSetDepsParams params + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams params - case fst <$> decodeSetDepsParamsAt encoded 0 of + case fst <$> CCIP.RuntimeV1.PerPartyRouterCodecGen.decodeSetDepsParamsAt encoded 0 of None -> abort "Failed to decode SetDepsParams (mixed)" Some decoded -> decoded === params @@ -72,17 +73,17 @@ testSetDepsParamsRoundtrip_Mixed = do testPerPartyRouterDepsRoundtrip : Script () testPerPartyRouterDepsRoundtrip = do - let deps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp@ccip_owner" - offRamp = RawInstanceAddress "offramp@ccip_owner" - globalConfig = RawInstanceAddress "globalconfig@ccip_owner" - tokenAdminRegistry = RawInstanceAddress "tar@ccip_owner" - feeQuoter = RawInstanceAddress "feequoter@ccip_owner" - rmnRemote = RawInstanceAddress "rmnremote@ccip_owner" + let deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@ccip_owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@ccip_owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "globalconfig@ccip_owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@ccip_owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "feequoter@ccip_owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmnremote@ccip_owner" - encoded = encodePerPartyRouterDeps deps + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodePerPartyRouterDeps deps - case decodePerPartyRouterDepsAt encoded 0 of + case CCIP.RuntimeV1.PerPartyRouterCodecGen.decodePerPartyRouterDepsAt encoded 0 of None -> abort "Failed to decode PerPartyRouterDeps" Some (decoded, _) -> do decoded.onRamp === deps.onRamp @@ -96,18 +97,18 @@ testPerPartyRouterDepsRoundtrip = do testPerPartyRouterDepsSpecialCharacters : Script () testPerPartyRouterDepsSpecialCharacters = do - let deps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp-with-dashes@party1::namespace1" - offRamp = RawInstanceAddress "offramp_with_underscores@party2::namespace2" - globalConfig = RawInstanceAddress "gc.with.dots@party3" - tokenAdminRegistry = RawInstanceAddress "tar/with/slashes@party4" - feeQuoter = RawInstanceAddress "fq:with:colons@party5" - rmnRemote = RawInstanceAddress "rmn+with+plus@party6" - - encoded = encodePerPartyRouterDeps deps - - case decodePerPartyRouterDepsAt encoded 0 of - None -> abort "Failed to decode PerPartyRouterDeps with special characters" + let deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp-with-dashes@party1::namespace1" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp_with_underscores@party2::namespace2" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc.with.dots@party3" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar/with/slashes@party4" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq:with:colons@party5" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn+with+plus@party6" + + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodePerPartyRouterDeps deps + + case CCIP.RuntimeV1.PerPartyRouterCodecGen.decodePerPartyRouterDepsAt encoded 0 of + None -> abort "Failed to decode CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with special characters" Some (decoded, _) -> do decoded.onRamp === deps.onRamp decoded.offRamp === deps.offRamp @@ -124,11 +125,11 @@ testPerPartyRouterDepsSpecialCharacters = do testInvalidDataRejection : Script () testInvalidDataRejection = do - case decodeSetDepsParamsAt "" 0 of + case CCIP.RuntimeV1.PerPartyRouterCodecGen.decodeSetDepsParamsAt "" 0 of None -> pure () Some _ -> abort "Expected decodeSetDepsParamsAt to fail on empty data" - case decodeSetDepsParamsAt "ff" 0 of + case CCIP.RuntimeV1.PerPartyRouterCodecGen.decodeSetDepsParamsAt "ff" 0 of None -> pure () Some _ -> abort "Expected decodeSetDepsParamsAt to fail on invalid tag" diff --git a/contracts/ccip/test/daml/CCIP/PerPartyRouterTest/PerPartyRouterMCMSTest.daml b/contracts/ccip/test/daml/CCIP/PerPartyRouterTest/PerPartyRouterMCMSTest.daml index b0bc89a53..6b2d81f14 100644 --- a/contracts/ccip/test/daml/CCIP/PerPartyRouterTest/PerPartyRouterMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/PerPartyRouterTest/PerPartyRouterMCMSTest.daml @@ -8,11 +8,11 @@ import DA.Map qualified as Map import DA.Set qualified as Set import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.PerPartyRouter -import CCIP.PerPartyRouterTypes (PerPartyRouterDeps(..), SetDepsParams(..)) -import CCIP.PerPartyRouterCodecGen (encodeSetDepsParams) -import Chainlink.InstanceAddress (RawInstanceAddress(..)) + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.RuntimeV1.PerPartyRouter +import qualified CCIP.RuntimeV1.PerPartyRouterCodecGen -- =========================================================================== -- PERPARTYROUTER MCMS ENTRYPOINT TESTS - SET DEPS @@ -25,16 +25,16 @@ testPerPartyRouterMCMSEntrypoint_SetDeps = script do partyOwner <- allocateParty "party_owner" let instanceId = "router-test" - initialDeps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp-old@owner" - offRamp = RawInstanceAddress "offramp-old@owner" - globalConfig = RawInstanceAddress "gc-old@owner" - tokenAdminRegistry = RawInstanceAddress "tar-old@owner" - feeQuoter = RawInstanceAddress "fq-old@owner" - rmnRemote = RawInstanceAddress "rmn-old@owner" + initialDeps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp-old@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp-old@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq-old@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" routerCid <- submit ccipOwner do - createCmd PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId ccipOwner partyOwner @@ -44,18 +44,18 @@ testPerPartyRouterMCMSEntrypoint_SetDeps = script do archivedExecutionContractIds = [] customObservers = [] - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver routerCid - let newDeps = SetDepsParams with - onRamp = Some (RawInstanceAddress "onramp-new@owner") - offRamp = Some (RawInstanceAddress "offramp-new@owner") - globalConfig = Some (RawInstanceAddress "gc-new@owner") - tokenAdminRegistry = Some (RawInstanceAddress "tar-new@owner") - feeQuoter = Some (RawInstanceAddress "fq-new@owner") - rmnRemote = Some (RawInstanceAddress "rmn-new@owner") + let newDeps = CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with + onRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "onramp-new@owner") + offRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "offramp-new@owner") + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar-new@owner") + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq-new@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner") - encoded = encodeSetDepsParams newDeps + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams newDeps newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -63,15 +63,15 @@ testPerPartyRouterMCMSEntrypoint_SetDeps = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId routerCid)] - contracts <- query @PerPartyRouter ccipOwner + contracts <- query @CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter ccipOwner case filter (\(_, router) -> router.instanceId == instanceId) contracts of [(_, router)] -> do - router.deps.onRamp === RawInstanceAddress "onramp-new@owner" - router.deps.offRamp === RawInstanceAddress "offramp-new@owner" - router.deps.globalConfig === RawInstanceAddress "gc-new@owner" - router.deps.tokenAdminRegistry === RawInstanceAddress "tar-new@owner" - router.deps.feeQuoter === RawInstanceAddress "fq-new@owner" - router.deps.rmnRemote === RawInstanceAddress "rmn-new@owner" + router.deps.onRamp === Chainlink.InstanceAddress.RawInstanceAddress "onramp-new@owner" + router.deps.offRamp === Chainlink.InstanceAddress.RawInstanceAddress "offramp-new@owner" + router.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner" + router.deps.tokenAdminRegistry === Chainlink.InstanceAddress.RawInstanceAddress "tar-new@owner" + router.deps.feeQuoter === Chainlink.InstanceAddress.RawInstanceAddress "fq-new@owner" + router.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner" _ -> abort "Expected exactly one PerPartyRouter contract" pure () @@ -83,16 +83,16 @@ testPerPartyRouterMCMSEntrypoint_SetDeps_Partial = script do partyOwner <- allocateParty "party_owner" let instanceId = "router-partial-test" - initialDeps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp-old@owner" - offRamp = RawInstanceAddress "offramp-old@owner" - globalConfig = RawInstanceAddress "gc-old@owner" - tokenAdminRegistry = RawInstanceAddress "tar-old@owner" - feeQuoter = RawInstanceAddress "fq-old@owner" - rmnRemote = RawInstanceAddress "rmn-old@owner" + initialDeps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp-old@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp-old@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq-old@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" routerCid <- submit ccipOwner do - createCmd PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId ccipOwner partyOwner @@ -102,18 +102,18 @@ testPerPartyRouterMCMSEntrypoint_SetDeps_Partial = script do archivedExecutionContractIds = [] customObservers = [] - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver routerCid - let partialDeps = SetDepsParams with - onRamp = Some (RawInstanceAddress "onramp-new@owner") - offRamp = Some (RawInstanceAddress "offramp-new@owner") + let partialDeps = CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with + onRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "onramp-new@owner") + offRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "offramp-new@owner") globalConfig = None tokenAdminRegistry = None feeQuoter = None rmnRemote = None - encoded = encodeSetDepsParams partialDeps + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams partialDeps submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -121,15 +121,15 @@ testPerPartyRouterMCMSEntrypoint_SetDeps_Partial = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId routerCid)] - contracts <- query @PerPartyRouter ccipOwner + contracts <- query @CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter ccipOwner case filter (\(_, router) -> router.instanceId == instanceId) contracts of [(_, router)] -> do - router.deps.onRamp === RawInstanceAddress "onramp-new@owner" - router.deps.offRamp === RawInstanceAddress "offramp-new@owner" - router.deps.globalConfig === RawInstanceAddress "gc-old@owner" - router.deps.tokenAdminRegistry === RawInstanceAddress "tar-old@owner" - router.deps.feeQuoter === RawInstanceAddress "fq-old@owner" - router.deps.rmnRemote === RawInstanceAddress "rmn-old@owner" + router.deps.onRamp === Chainlink.InstanceAddress.RawInstanceAddress "onramp-new@owner" + router.deps.offRamp === Chainlink.InstanceAddress.RawInstanceAddress "offramp-new@owner" + router.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + router.deps.tokenAdminRegistry === Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + router.deps.feeQuoter === Chainlink.InstanceAddress.RawInstanceAddress "fq-old@owner" + router.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" _ -> abort "Expected exactly one PerPartyRouter contract" pure () @@ -141,16 +141,16 @@ testPerPartyRouterMCMSEntrypoint_UnknownFunction = script do partyOwner <- allocateParty "party_owner" let instanceId = "router-error-test" - deps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp@owner" - offRamp = RawInstanceAddress "offramp@owner" - globalConfig = RawInstanceAddress "gc@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - rmnRemote = RawInstanceAddress "rmn@owner" + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" routerCid <- submit ccipOwner do - createCmd PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId ccipOwner partyOwner @@ -160,7 +160,7 @@ testPerPartyRouterMCMSEntrypoint_UnknownFunction = script do archivedExecutionContractIds = [] customObservers = [] - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver routerCid submitMustFail ccipOwner do @@ -177,16 +177,16 @@ testPerPartyRouterMCMSEntrypoint_InvalidParams = script do partyOwner <- allocateParty "party_owner" let instanceId = "router-invalid-test" - deps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp@owner" - offRamp = RawInstanceAddress "offramp@owner" - globalConfig = RawInstanceAddress "gc@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - rmnRemote = RawInstanceAddress "rmn@owner" + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" routerCid <- submit ccipOwner do - createCmd PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId ccipOwner partyOwner @@ -196,7 +196,7 @@ testPerPartyRouterMCMSEntrypoint_InvalidParams = script do archivedExecutionContractIds = [] customObservers = [] - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver routerCid submitMustFail ccipOwner do @@ -213,16 +213,16 @@ testPerPartyRouterMCMSEntrypoint_MissingSelfCid = script do partyOwner <- allocateParty "party_owner" let instanceId = "router-missing-cid-test" - deps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp@owner" - offRamp = RawInstanceAddress "offramp@owner" - globalConfig = RawInstanceAddress "gc@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - rmnRemote = RawInstanceAddress "rmn@owner" + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" routerCid <- submit ccipOwner do - createCmd PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId ccipOwner partyOwner @@ -234,7 +234,7 @@ testPerPartyRouterMCMSEntrypoint_MissingSelfCid = script do let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver routerCid - let encoded = encodeSetDepsParams (SetDepsParams with + let encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams (CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with onRamp = Some deps.onRamp offRamp = Some deps.offRamp globalConfig = Some deps.globalConfig @@ -260,33 +260,33 @@ testPerPartyRouterFactoryMCMSEntrypoint_FactorySetDeps = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "factory-test" - initialDeps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp-old@owner" - offRamp = RawInstanceAddress "offramp-old@owner" - globalConfig = RawInstanceAddress "gc-old@owner" - tokenAdminRegistry = RawInstanceAddress "tar-old@owner" - feeQuoter = RawInstanceAddress "fq-old@owner" - rmnRemote = RawInstanceAddress "rmn-old@owner" + initialDeps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp-old@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp-old@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq-old@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" factoryCid <- submit ccipOwner do - createCmd PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId ccipOwner deps = initialDeps registeredRouters = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let newDeps = SetDepsParams with - onRamp = Some (RawInstanceAddress "onramp-new@owner") - offRamp = Some (RawInstanceAddress "offramp-new@owner") - globalConfig = Some (RawInstanceAddress "gc-new@owner") - tokenAdminRegistry = Some (RawInstanceAddress "tar-new@owner") - feeQuoter = Some (RawInstanceAddress "fq-new@owner") - rmnRemote = Some (RawInstanceAddress "rmn-new@owner") + let newDeps = CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with + onRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "onramp-new@owner") + offRamp = Some (Chainlink.InstanceAddress.RawInstanceAddress "offramp-new@owner") + globalConfig = Some (Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner") + tokenAdminRegistry = Some (Chainlink.InstanceAddress.RawInstanceAddress "tar-new@owner") + feeQuoter = Some (Chainlink.InstanceAddress.RawInstanceAddress "fq-new@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner") - encoded = encodeSetDepsParams newDeps + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams newDeps newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -294,15 +294,15 @@ testPerPartyRouterFactoryMCMSEntrypoint_FactorySetDeps = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId factoryCid)] - contracts <- query @PerPartyRouterFactory ccipOwner + contracts <- query @CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory ccipOwner case filter (\(_, factory) -> factory.instanceId == instanceId) contracts of [(_, factory)] -> do - factory.deps.onRamp === RawInstanceAddress "onramp-new@owner" - factory.deps.offRamp === RawInstanceAddress "offramp-new@owner" - factory.deps.globalConfig === RawInstanceAddress "gc-new@owner" - factory.deps.tokenAdminRegistry === RawInstanceAddress "tar-new@owner" - factory.deps.feeQuoter === RawInstanceAddress "fq-new@owner" - factory.deps.rmnRemote === RawInstanceAddress "rmn-new@owner" + factory.deps.onRamp === Chainlink.InstanceAddress.RawInstanceAddress "onramp-new@owner" + factory.deps.offRamp === Chainlink.InstanceAddress.RawInstanceAddress "offramp-new@owner" + factory.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc-new@owner" + factory.deps.tokenAdminRegistry === Chainlink.InstanceAddress.RawInstanceAddress "tar-new@owner" + factory.deps.feeQuoter === Chainlink.InstanceAddress.RawInstanceAddress "fq-new@owner" + factory.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner" _ -> abort "Expected exactly one PerPartyRouterFactory contract" pure () @@ -313,33 +313,33 @@ testPerPartyRouterFactoryMCMSEntrypoint_FactorySetDeps_Partial = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "factory-partial-test" - initialDeps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp-old@owner" - offRamp = RawInstanceAddress "offramp-old@owner" - globalConfig = RawInstanceAddress "gc-old@owner" - tokenAdminRegistry = RawInstanceAddress "tar-old@owner" - feeQuoter = RawInstanceAddress "fq-old@owner" - rmnRemote = RawInstanceAddress "rmn-old@owner" + initialDeps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp-old@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp-old@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq-old@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn-old@owner" factoryCid <- submit ccipOwner do - createCmd PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId ccipOwner deps = initialDeps registeredRouters = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let partialDeps = SetDepsParams with + let partialDeps = CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with onRamp = None offRamp = None globalConfig = None tokenAdminRegistry = None feeQuoter = None - rmnRemote = Some (RawInstanceAddress "rmn-new@owner") + rmnRemote = Some (Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner") - encoded = encodeSetDepsParams partialDeps + encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams partialDeps submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with @@ -347,15 +347,15 @@ testPerPartyRouterFactoryMCMSEntrypoint_FactorySetDeps_Partial = script do operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId factoryCid)] - contracts <- query @PerPartyRouterFactory ccipOwner + contracts <- query @CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory ccipOwner case filter (\(_, factory) -> factory.instanceId == instanceId) contracts of [(_, factory)] -> do - factory.deps.onRamp === RawInstanceAddress "onramp-old@owner" - factory.deps.offRamp === RawInstanceAddress "offramp-old@owner" - factory.deps.globalConfig === RawInstanceAddress "gc-old@owner" - factory.deps.tokenAdminRegistry === RawInstanceAddress "tar-old@owner" - factory.deps.feeQuoter === RawInstanceAddress "fq-old@owner" - factory.deps.rmnRemote === RawInstanceAddress "rmn-new@owner" + factory.deps.onRamp === Chainlink.InstanceAddress.RawInstanceAddress "onramp-old@owner" + factory.deps.offRamp === Chainlink.InstanceAddress.RawInstanceAddress "offramp-old@owner" + factory.deps.globalConfig === Chainlink.InstanceAddress.RawInstanceAddress "gc-old@owner" + factory.deps.tokenAdminRegistry === Chainlink.InstanceAddress.RawInstanceAddress "tar-old@owner" + factory.deps.feeQuoter === Chainlink.InstanceAddress.RawInstanceAddress "fq-old@owner" + factory.deps.rmnRemote === Chainlink.InstanceAddress.RawInstanceAddress "rmn-new@owner" _ -> abort "Expected exactly one PerPartyRouterFactory contract" pure () @@ -365,22 +365,22 @@ testPerPartyRouterFactoryMCMSEntrypoint_UnknownFunction = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "factory-error-test" - deps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp@owner" - offRamp = RawInstanceAddress "offramp@owner" - globalConfig = RawInstanceAddress "gc@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - rmnRemote = RawInstanceAddress "rmn@owner" + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" factoryCid <- submit ccipOwner do - createCmd PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId ccipOwner deps registeredRouters = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid submitMustFail ccipOwner do @@ -396,22 +396,22 @@ testPerPartyRouterFactoryMCMSEntrypoint_InvalidParams = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "factory-invalid-test" - deps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp@owner" - offRamp = RawInstanceAddress "offramp@owner" - globalConfig = RawInstanceAddress "gc@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - rmnRemote = RawInstanceAddress "rmn@owner" + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" factoryCid <- submit ccipOwner do - createCmd PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId ccipOwner deps registeredRouters = Map.empty - let instAddr = RawInstanceAddress.makeText instanceId ccipOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid submitMustFail ccipOwner do @@ -427,16 +427,16 @@ testPerPartyRouterFactoryMCMSEntrypoint_MissingSelfCid = script do ccipOwner <- allocateParty "ccip_owner" let instanceId = "factory-missing-cid-test" - deps = PerPartyRouterDeps with - onRamp = RawInstanceAddress "onramp@owner" - offRamp = RawInstanceAddress "offramp@owner" - globalConfig = RawInstanceAddress "gc@owner" - tokenAdminRegistry = RawInstanceAddress "tar@owner" - feeQuoter = RawInstanceAddress "fq@owner" - rmnRemote = RawInstanceAddress "rmn@owner" + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.RawInstanceAddress "onramp@owner" + offRamp = Chainlink.InstanceAddress.RawInstanceAddress "offramp@owner" + globalConfig = Chainlink.InstanceAddress.RawInstanceAddress "gc@owner" + tokenAdminRegistry = Chainlink.InstanceAddress.RawInstanceAddress "tar@owner" + feeQuoter = Chainlink.InstanceAddress.RawInstanceAddress "fq@owner" + rmnRemote = Chainlink.InstanceAddress.RawInstanceAddress "rmn@owner" factoryCid <- submit ccipOwner do - createCmd PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId ccipOwner deps @@ -444,7 +444,7 @@ testPerPartyRouterFactoryMCMSEntrypoint_MissingSelfCid = script do let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver factoryCid - let encoded = encodeSetDepsParams (SetDepsParams with + let encoded = CCIP.RuntimeV1.PerPartyRouterCodecGen.encodeSetDepsParams (CCIP.RuntimeV1.PerPartyRouter.SetDepsParams with onRamp = Some deps.onRamp offRamp = Some deps.offRamp globalConfig = Some deps.globalConfig diff --git a/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteCodecTest.daml b/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteCodecTest.daml index 254c8f212..a41a29edd 100644 --- a/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteCodecTest.daml @@ -5,8 +5,8 @@ import Daml.Script import DA.Assert ((===)) import DA.Optional (fromSome) -import CCIP.RMNRemoteCodecGen -import CCIP.RMNRemoteTypes +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.RMNRemoteCodecGen -- =========================================================================== -- CURSE PARAMS ENCODING/DECODING TESTS @@ -16,24 +16,24 @@ testCurseParamsRoundtrip : Script () testCurseParamsRoundtrip = do -- Test with global curse subject let globalSubject = "01000000000000000000000000000001" - params = CurseParams with subject = globalSubject - encoded = encodeCurseParams params - fst (fromSome (decodeCurseParamsAt encoded 0)) === params + params = CCIP.CoreV1.RMNRemote.CurseParams with subject = globalSubject + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseParams params + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseParamsAt encoded 0)) === params -- Test with chain-specific subject let chainSubject = "00000000000000000000000000000089" -- Chain 137 - params2 = CurseParams with subject = chainSubject - encodedChain = encodeCurseParams params2 - fst (fromSome (decodeCurseParamsAt encodedChain 0)) === params2 + params2 = CCIP.CoreV1.RMNRemote.CurseParams with subject = chainSubject + encodedChain = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseParams params2 + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseParamsAt encodedChain 0)) === params2 pure () testUncurseParamsRoundtrip : Script () testUncurseParamsRoundtrip = do let subject = "01000000000000000000000000000001" - params = UncurseParams with subject - encoded = encodeUncurseParams params - fst (fromSome (decodeUncurseParamsAt encoded 0)) === params + params = CCIP.CoreV1.RMNRemote.UncurseParams with subject + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeUncurseParams params + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeUncurseParamsAt encoded 0)) === params pure () @@ -45,42 +45,42 @@ testCurseChainParamsRoundtrip : Script () testCurseChainParamsRoundtrip = do -- Test with chain selector 1 (Ethereum mainnet) let chainSelector1 : Numeric 0 = 1.0 - params1 = CurseChainParams with chainSelector = chainSelector1 - encoded1 = encodeCurseChainParams params1 - fst (fromSome (decodeCurseChainParamsAt encoded1 0)) === params1 + params1 = CCIP.CoreV1.RMNRemote.CurseChainParams with chainSelector = chainSelector1 + encoded1 = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseChainParams params1 + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseChainParamsAt encoded1 0)) === params1 -- Test with larger chain selector (137 = Polygon) let chainSelector137 : Numeric 0 = 137.0 - params137 = CurseChainParams with chainSelector = chainSelector137 - encoded137 = encodeCurseChainParams params137 - fst (fromSome (decodeCurseChainParamsAt encoded137 0)) === params137 + params137 = CCIP.CoreV1.RMNRemote.CurseChainParams with chainSelector = chainSelector137 + encoded137 = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseChainParams params137 + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseChainParamsAt encoded137 0)) === params137 -- Test with very large chain selector let largeSelector : Numeric 0 = 16015286601757825753.0 -- Avalanche Fuji testnet selector - paramsLarge = CurseChainParams with chainSelector = largeSelector - encodedLarge = encodeCurseChainParams paramsLarge - fst (fromSome (decodeCurseChainParamsAt encodedLarge 0)) === paramsLarge + paramsLarge = CCIP.CoreV1.RMNRemote.CurseChainParams with chainSelector = largeSelector + encodedLarge = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseChainParams paramsLarge + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseChainParamsAt encodedLarge 0)) === paramsLarge -- Test zero selector let zeroSelector : Numeric 0 = 0.0 - paramsZero = CurseChainParams with chainSelector = zeroSelector - encodedZero = encodeCurseChainParams paramsZero - fst (fromSome (decodeCurseChainParamsAt encodedZero 0)) === paramsZero + paramsZero = CCIP.CoreV1.RMNRemote.CurseChainParams with chainSelector = zeroSelector + encodedZero = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseChainParams paramsZero + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseChainParamsAt encodedZero 0)) === paramsZero -- Test max uint64 selector let maxUint64 : Numeric 0 = 18446744073709551615.0 - paramsMax = CurseChainParams with chainSelector = maxUint64 - encodedMax = encodeCurseChainParams paramsMax - fst (fromSome (decodeCurseChainParamsAt encodedMax 0)) === paramsMax + paramsMax = CCIP.CoreV1.RMNRemote.CurseChainParams with chainSelector = maxUint64 + encodedMax = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseChainParams paramsMax + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseChainParamsAt encodedMax 0)) === paramsMax pure () testUncurseChainParamsRoundtrip : Script () testUncurseChainParamsRoundtrip = do let chainSelector : Numeric 0 = 42161.0 -- Arbitrum One - params = UncurseChainParams with chainSelector - encoded = encodeUncurseChainParams params - fst (fromSome (decodeUncurseChainParamsAt encoded 0)) === params + params = CCIP.CoreV1.RMNRemote.UncurseChainParams with chainSelector + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeUncurseChainParams params + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeUncurseChainParamsAt encoded 0)) === params pure () @@ -95,9 +95,9 @@ testCurseMultipleParamsRoundtrip = do "00000000000000000000000000000001", -- Chain 1 "00000000000000000000000000000089" -- Chain 137 ] - params = CurseMultipleParams with subjects - encoded = encodeCurseMultipleParams params - decoded = fst (fromSome (decodeCurseMultipleParamsAt encoded 0)) + params = CCIP.CoreV1.RMNRemote.CurseMultipleParams with subjects + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseMultipleParams params + decoded = fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseMultipleParamsAt encoded 0)) length decoded.subjects === 3 decoded === params @@ -105,9 +105,9 @@ testCurseMultipleParamsRoundtrip = do testCurseMultipleParamsEmptyList : Script () testCurseMultipleParamsEmptyList = do - let params = CurseMultipleParams with subjects = [] - encoded = encodeCurseMultipleParams params - fst (fromSome (decodeCurseMultipleParamsAt encoded 0)) === params + let params = CCIP.CoreV1.RMNRemote.CurseMultipleParams with subjects = [] + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseMultipleParams params + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseMultipleParamsAt encoded 0)) === params pure () @@ -117,9 +117,9 @@ testUncurseMultipleParamsRoundtrip = do "00000000000000000000000000000001", "00000000000000000000000000000002" ] - params = UncurseMultipleParams with subjects - encoded = encodeUncurseMultipleParams params - fst (fromSome (decodeUncurseMultipleParamsAt encoded 0)) === params + params = CCIP.CoreV1.RMNRemote.UncurseMultipleParams with subjects + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeUncurseMultipleParams params + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeUncurseMultipleParamsAt encoded 0)) === params pure () @@ -134,9 +134,9 @@ testAddCustomObserversParamsRoundtrip = do party3 <- allocateParty "Observer3" let parties = [party1, party2, party3] - params = AddCustomObserversParams with parties - encoded = encodeAddCustomObserversParams params - decoded = fst (fromSome (decodeAddCustomObserversParamsAt encoded 0)) + params = CCIP.CoreV1.RMNRemote.AddCustomObserversParams with parties + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeAddCustomObserversParams params + decoded = fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeAddCustomObserversParamsAt encoded 0)) length decoded.parties === 3 decoded === params @@ -144,9 +144,9 @@ testAddCustomObserversParamsRoundtrip = do testAddCustomObserversParamsEmptyList : Script () testAddCustomObserversParamsEmptyList = do - let params = AddCustomObserversParams with parties = [] - encoded = encodeAddCustomObserversParams params - fst (fromSome (decodeAddCustomObserversParamsAt encoded 0)) === params + let params = CCIP.CoreV1.RMNRemote.AddCustomObserversParams with parties = [] + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeAddCustomObserversParams params + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeAddCustomObserversParamsAt encoded 0)) === params pure () @@ -156,9 +156,9 @@ testRemoveCustomObserversParamsRoundtrip = do party2 <- allocateParty "Observer2" let parties = [party1, party2] - params = RemoveCustomObserversParams with parties - encoded = encodeRemoveCustomObserversParams params - fst (fromSome (decodeRemoveCustomObserversParamsAt encoded 0)) === params + params = CCIP.CoreV1.RMNRemote.RemoveCustomObserversParams with parties + encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeRemoveCustomObserversParams params + fst (fromSome (CCIP.CoreV1.RMNRemoteCodecGen.decodeRemoveCustomObserversParamsAt encoded 0)) === params pure () @@ -169,12 +169,12 @@ testRemoveCustomObserversParamsRoundtrip = do testInvalidDataRejection : Script () testInvalidDataRejection = do -- Empty data should fail for curse params - case decodeCurseParamsAt "" 0 of + case CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseParamsAt "" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeCurseParamsAt to fail on empty data" -- Truncated chain selector should fail - case decodeCurseChainParamsAt "0001" 0 of + case CCIP.CoreV1.RMNRemoteCodecGen.decodeCurseChainParamsAt "0001" 0 of None -> pure () -- Expected - need 8 bytes Some _ -> abort "Expected decodeCurseChainParamsAt to fail on truncated data" diff --git a/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteMCMSTest.daml b/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteMCMSTest.daml index 71c783a8a..627d31b13 100644 --- a/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteMCMSTest.daml @@ -6,11 +6,14 @@ import Daml.Script import DA.Assert ((===)) import DA.Map qualified as Map +import qualified Splice.Api.Token.MetadataV1 + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.RMNRemote -import CCIP.RMNRemoteCodecGen -import CCIP.RMNRemoteTypes + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.RMNRemoteCodecGen -- =========================================================================== -- MCMS ENTRYPOINT TESTS - CURSE @@ -25,20 +28,20 @@ testRMNRemoteMCMSEntrypoint_Curse = script do let instanceId = "rmn-test" globalSubject = "01000000000000000000000000000001" - -- Create RMNRemote with no cursed subjects + -- Create CCIP.CoreV1.RMNRemote.RMNRemote with no cursed subjects rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = [] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode Curse params - let encoded = encodeCurseParams (CurseParams with subject = globalSubject) + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseParams (CCIP.CoreV1.RMNRemote.CurseParams with subject = globalSubject) -- Call mcmsEntrypoint newContractIds <- submit rmnOwner do @@ -48,7 +51,7 @@ testRMNRemoteMCMSEntrypoint_Curse = script do contractIds = Map.fromList [(instAddr, toAnyContractId rmnCid)] -- Verify subject was cursed - contracts <- query @RMNRemote rmnOwner + contracts <- query @CCIP.CoreV1.RMNRemote.RMNRemote rmnOwner case filter (\(_, rmn) -> rmn.instanceId == instanceId) contracts of [(_, rmn)] -> do length rmn.cursedSubjects === 1 @@ -66,20 +69,20 @@ testRMNRemoteMCMSEntrypoint_Uncurse = script do let instanceId = "rmn-uncurse-test" subject = "01000000000000000000000000000001" - -- Create RMNRemote with subject already cursed + -- Create CCIP.CoreV1.RMNRemote.RMNRemote with subject already cursed rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = [subject] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode Uncurse params - let encoded = encodeUncurseParams (UncurseParams with subject) + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeUncurseParams (CCIP.CoreV1.RMNRemote.UncurseParams with subject) -- Call mcmsEntrypoint newContractIds <- submit rmnOwner do @@ -89,7 +92,7 @@ testRMNRemoteMCMSEntrypoint_Uncurse = script do contractIds = Map.fromList [(instAddr, toAnyContractId rmnCid)] -- Verify subject was uncursed - contracts <- query @RMNRemote rmnOwner + contracts <- query @CCIP.CoreV1.RMNRemote.RMNRemote rmnOwner case filter (\(_, rmn) -> rmn.instanceId == instanceId) contracts of [(_, rmn)] -> rmn.cursedSubjects === [] _ -> abort "Expected exactly one RMNRemote contract" @@ -111,18 +114,18 @@ testRMNRemoteMCMSEntrypoint_CurseChain = script do -- Create RMNRemote rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = [] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode CurseChain params - let encoded = encodeCurseChainParams (CurseChainParams with chainSelector) + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseChainParams (CCIP.CoreV1.RMNRemote.CurseChainParams with chainSelector) -- Call mcmsEntrypoint newContractIds <- submit rmnOwner do @@ -132,15 +135,16 @@ testRMNRemoteMCMSEntrypoint_CurseChain = script do contractIds = Map.fromList [(instAddr, toAnyContractId rmnCid)] -- Verify chain was cursed - contracts <- query @RMNRemote rmnOwner + contracts <- query @CCIP.CoreV1.RMNRemote.RMNRemote rmnOwner case filter (\(_, rmn) -> rmn.instanceId == instanceId) contracts of [(newCid, rmn)] -> do length rmn.cursedSubjects === 1 -- Verify IsCursedForChain returns True isCursed <- submit rmnOwner do - exerciseCmd newCid IsCursedForChain with - caller = rmnOwner + exerciseCmd newCid CCIP.CoreV1.RMNRemote.IsCursedForChain with chainSelector = chainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = rmnOwner isCursed === True _ -> abort "Expected exactly one RMNRemote contract" @@ -154,22 +158,22 @@ testRMNRemoteMCMSEntrypoint_UncurseChain = script do let instanceId = "rmn-uncursechain-test" chainSelector : Numeric 0 = 42161.0 - chainSubject = chainSelectorToSubject chainSelector + chainSubject = CCIP.CoreV1.RMNRemote.chainSelectorToSubject chainSelector - -- Create RMNRemote with chain already cursed + -- Create CCIP.CoreV1.RMNRemote.RMNRemote with chain already cursed rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = [chainSubject] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode UncurseChain params - let encoded = encodeUncurseChainParams (UncurseChainParams with chainSelector) + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeUncurseChainParams (CCIP.CoreV1.RMNRemote.UncurseChainParams with chainSelector) -- Call mcmsEntrypoint newContractIds <- submit rmnOwner do @@ -179,7 +183,7 @@ testRMNRemoteMCMSEntrypoint_UncurseChain = script do contractIds = Map.fromList [(instAddr, toAnyContractId rmnCid)] -- Verify chain was uncursed - contracts <- query @RMNRemote rmnOwner + contracts <- query @CCIP.CoreV1.RMNRemote.RMNRemote rmnOwner case filter (\(_, rmn) -> rmn.instanceId == instanceId) contracts of [(_, rmn)] -> rmn.cursedSubjects === [] _ -> abort "Expected exactly one RMNRemote contract" @@ -205,18 +209,18 @@ testRMNRemoteMCMSEntrypoint_CurseMultiple = script do -- Create RMNRemote rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = [] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode CurseMultiple params - let encoded = encodeCurseMultipleParams (CurseMultipleParams with subjects) + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseMultipleParams (CCIP.CoreV1.RMNRemote.CurseMultipleParams with subjects) -- Call mcmsEntrypoint newContractIds <- submit rmnOwner do @@ -226,7 +230,7 @@ testRMNRemoteMCMSEntrypoint_CurseMultiple = script do contractIds = Map.fromList [(instAddr, toAnyContractId rmnCid)] -- Verify all subjects were cursed - contracts <- query @RMNRemote rmnOwner + contracts <- query @CCIP.CoreV1.RMNRemote.RMNRemote rmnOwner case filter (\(_, rmn) -> rmn.instanceId == instanceId) contracts of [(_, rmn)] -> length rmn.cursedSubjects === 3 _ -> abort "Expected exactly one RMNRemote contract" @@ -245,20 +249,20 @@ testRMNRemoteMCMSEntrypoint_UncurseMultiple = script do "00000000000000000000000000000002" ] - -- Create RMNRemote with subjects already cursed + -- Create CCIP.CoreV1.RMNRemote.RMNRemote with subjects already cursed rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = subjects - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode UncurseMultiple params - let encoded = encodeUncurseMultipleParams (UncurseMultipleParams with subjects) + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeUncurseMultipleParams (CCIP.CoreV1.RMNRemote.UncurseMultipleParams with subjects) -- Call mcmsEntrypoint newContractIds <- submit rmnOwner do @@ -268,7 +272,7 @@ testRMNRemoteMCMSEntrypoint_UncurseMultiple = script do contractIds = Map.fromList [(instAddr, toAnyContractId rmnCid)] -- Verify all subjects were uncursed - contracts <- query @RMNRemote rmnOwner + contracts <- query @CCIP.CoreV1.RMNRemote.RMNRemote rmnOwner case filter (\(_, rmn) -> rmn.instanceId == instanceId) contracts of [(_, rmn)] -> rmn.cursedSubjects === [] _ -> abort "Expected exactly one RMNRemote contract" @@ -289,20 +293,20 @@ testRMNRemoteMCMSEntrypoint_AddCustomObservers = script do let instanceId = "rmn-observers-test" - -- Create RMNRemote with no custom observers + -- Create CCIP.CoreV1.RMNRemote.RMNRemote with no custom observers rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = [] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode AddCustomObservers params - let encoded = encodeAddCustomObserversParams (AddCustomObserversParams with parties = [observer1, observer2]) + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeAddCustomObserversParams (CCIP.CoreV1.RMNRemote.AddCustomObserversParams with parties = [observer1, observer2]) -- Call mcmsEntrypoint newContractIds <- submit rmnOwner do @@ -312,7 +316,7 @@ testRMNRemoteMCMSEntrypoint_AddCustomObservers = script do contractIds = Map.fromList [(instAddr, toAnyContractId rmnCid)] -- Verify observers were added - contracts <- query @RMNRemote rmnOwner + contracts <- query @CCIP.CoreV1.RMNRemote.RMNRemote rmnOwner case filter (\(_, rmn) -> rmn.instanceId == instanceId) contracts of [(_, rmn)] -> length rmn.customObservers === 2 _ -> abort "Expected exactly one RMNRemote contract" @@ -329,20 +333,20 @@ testRMNRemoteMCMSEntrypoint_RemoveCustomObservers = script do let instanceId = "rmn-remove-observers-test" - -- Create RMNRemote with custom observers + -- Create CCIP.CoreV1.RMNRemote.RMNRemote with custom observers rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [observer1, observer2] cursedSubjects = [] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode RemoveCustomObservers params (remove observer1) - let encoded = encodeRemoveCustomObserversParams (RemoveCustomObserversParams with parties = [observer1]) + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeRemoveCustomObserversParams (CCIP.CoreV1.RMNRemote.RemoveCustomObserversParams with parties = [observer1]) -- Call mcmsEntrypoint newContractIds <- submit rmnOwner do @@ -352,7 +356,7 @@ testRMNRemoteMCMSEntrypoint_RemoveCustomObservers = script do contractIds = Map.fromList [(instAddr, toAnyContractId rmnCid)] -- Verify observer1 was removed, observer2 remains - contracts <- query @RMNRemote rmnOwner + contracts <- query @CCIP.CoreV1.RMNRemote.RMNRemote rmnOwner case filter (\(_, rmn) -> rmn.instanceId == instanceId) contracts of [(_, rmn)] -> do length rmn.customObservers === 1 @@ -374,14 +378,14 @@ testRMNRemoteMCMSEntrypoint_UnknownFunction = script do let instanceId = "rmn-error-test" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = [] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Call with unknown function name - should fail @@ -402,14 +406,14 @@ testRMNRemoteMCMSEntrypoint_InvalidParams = script do let instanceId = "rmn-invalid-test" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner customObservers = [] cursedSubjects = [] - let instAddr = RawInstanceAddress.makeText instanceId rmnOwner + let instAddr = Chainlink.InstanceAddress.makeText instanceId rmnOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Call Curse with empty operationData - should fail @@ -430,7 +434,7 @@ testRMNRemoteMCMSEntrypoint_MissingSelfCid = script do let instanceId = "rmn-missing-cid-test" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId rmnOwner ccipOwner @@ -440,7 +444,7 @@ testRMNRemoteMCMSEntrypoint_MissingSelfCid = script do let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver rmnCid -- Encode valid params - let encoded = encodeCurseParams (CurseParams with subject = "01000000000000000000000000000001") + let encoded = CCIP.CoreV1.RMNRemoteCodecGen.encodeCurseParams (CCIP.CoreV1.RMNRemote.CurseParams with subject = "01000000000000000000000000000001") -- Call with empty contractIds map - should fail submitMustFail rmnOwner do @@ -457,7 +461,7 @@ testRMNRemote_CurseMultipleRejectsDuplicateSubjects = script do ccipOwner <- allocateParty "ccip_owner" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-duplicate-subjects-test" rmnOwner ccipOwner @@ -467,7 +471,7 @@ testRMNRemote_CurseMultipleRejectsDuplicateSubjects = script do let duplicatedSubject = "01000000000000000000000000000001" submitMustFail rmnOwner do - exerciseCmd rmnCid CurseMultiple with + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.CurseMultiple with subjects = [duplicatedSubject, duplicatedSubject] pure () @@ -481,7 +485,7 @@ testRMNRemote_CurseMultipleRejectsAlreadyCursedSubject = script do newSubject = "00000000000000000000000000000089" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-already-cursed-test" rmnOwner ccipOwner @@ -489,7 +493,7 @@ testRMNRemote_CurseMultipleRejectsAlreadyCursedSubject = script do cursedSubjects = [existingSubject] submitMustFail rmnOwner do - exerciseCmd rmnCid CurseMultiple with + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.CurseMultiple with subjects = [existingSubject, newSubject] pure () diff --git a/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteTest.daml b/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteTest.daml index 166a8d40c..b717831de 100644 --- a/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteTest.daml +++ b/contracts/ccip/test/daml/CCIP/RMNTest/RMNRemoteTest.daml @@ -4,7 +4,9 @@ module CCIP.RMNTest.RMNRemoteTest where import Daml.Script import DA.Assert ((===)) -import CCIP.RMNRemote +import qualified Splice.Api.Token.MetadataV1 + +import qualified CCIP.CoreV1.RMNRemote -- =========================================================================== -- UNCURSE MULTIPLE VALIDATION TESTS @@ -19,7 +21,7 @@ testRMNRemote_UncurseMultipleRejectsDuplicateSubjects = script do let subject = "01000000000000000000000000000001" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-uncurse-dup-test" rmnOwner ccipOwner @@ -27,7 +29,7 @@ testRMNRemote_UncurseMultipleRejectsDuplicateSubjects = script do cursedSubjects = [subject] submitMustFail rmnOwner do - exerciseCmd rmnCid UncurseMultiple with + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.UncurseMultiple with subjects = [subject, subject] pure () @@ -42,7 +44,7 @@ testRMNRemote_UncurseMultipleRejectsNotCursedSubject = script do notCursedSubject = "00000000000000000000000000000089" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-uncurse-not-cursed-test" rmnOwner ccipOwner @@ -50,7 +52,7 @@ testRMNRemote_UncurseMultipleRejectsNotCursedSubject = script do cursedSubjects = [cursedSubject] submitMustFail rmnOwner do - exerciseCmd rmnCid UncurseMultiple with + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.UncurseMultiple with subjects = [cursedSubject, notCursedSubject] pure () @@ -65,7 +67,7 @@ testRMNRemote_UncurseMultipleSucceeds = script do subject2 = "00000000000000000000000000000089" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-uncurse-success-test" rmnOwner ccipOwner @@ -73,7 +75,7 @@ testRMNRemote_UncurseMultipleSucceeds = script do cursedSubjects = [subject1, subject2] rmnCid' <- submit rmnOwner do - exerciseCmd rmnCid UncurseMultiple with + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.UncurseMultiple with subjects = [subject1, subject2] rmn <- queryContractId rmnOwner rmnCid' @@ -88,7 +90,7 @@ testRMNRemote_UncurseMultipleRejectsAllNotCursed = script do ccipOwner <- allocateParty "ccip_owner" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-uncurse-none-cursed-test" rmnOwner ccipOwner @@ -96,7 +98,7 @@ testRMNRemote_UncurseMultipleRejectsAllNotCursed = script do cursedSubjects = [] submitMustFail rmnOwner do - exerciseCmd rmnCid UncurseMultiple with + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.UncurseMultiple with subjects = ["01000000000000000000000000000001"] pure () @@ -112,7 +114,7 @@ testRMNRemote_CurseChainRejectsReservedSubjectMapping = script do ccipOwner <- allocateParty "ccip_owner" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-curse-reserved-mapping-test" rmnOwner ccipOwner @@ -120,7 +122,7 @@ testRMNRemote_CurseChainRejectsReservedSubjectMapping = script do cursedSubjects = [] submitMustFail rmnOwner do - exerciseCmd rmnCid CurseChain with + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.CurseChain with chainSelector = chainSelectorAliasingGlobalSubject pure () @@ -131,15 +133,15 @@ testRMNRemote_UncurseChainRejectsReservedSubjectMapping = script do ccipOwner <- allocateParty "ccip_owner" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-uncurse-reserved-mapping-test" rmnOwner ccipOwner customObservers = [] - cursedSubjects = [globalCurseSubject] + cursedSubjects = [CCIP.CoreV1.RMNRemote.globalCurseSubject] submitMustFail rmnOwner do - exerciseCmd rmnCid UncurseChain with + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.UncurseChain with chainSelector = chainSelectorAliasingGlobalSubject pure () @@ -150,7 +152,7 @@ testRMNRemote_IsCursedForChainRejectsReservedSubjectMapping = script do ccipOwner <- allocateParty "ccip_owner" rmnCid <- submit rmnOwner do - createCmd RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmn-iscursed-reserved-mapping-test" rmnOwner ccipOwner @@ -158,8 +160,9 @@ testRMNRemote_IsCursedForChainRejectsReservedSubjectMapping = script do cursedSubjects = [] submitMustFail rmnOwner do - exerciseCmd rmnCid IsCursedForChain with - caller = rmnOwner + exerciseCmd rmnCid CCIP.CoreV1.RMNRemote.IsCursedForChain with chainSelector = chainSelectorAliasingGlobalSubject + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = rmnOwner pure () diff --git a/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryCodecTest.daml b/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryCodecTest.daml index d588e1d61..d8f336fc5 100644 --- a/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryCodecTest.daml +++ b/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryCodecTest.daml @@ -5,34 +5,14 @@ import Daml.Script import DA.Assert ((===)) import qualified Splice.Api.Token.HoldingV1 -import CCIP.TokenAdminRegistryCodecGen ( - encodePoolRegistration, - decodePoolRegistrationAt, - encodeSetPoolParams, - decodeSetPoolParamsAt, - encodeSetTransferFactoryParams, - decodeSetTransferFactoryParamsAt, - encodeSetBurnMintFactoryParams, - decodeSetBurnMintFactoryParamsAt, - encodeProposeAdminParams, - decodeProposeAdminParamsAt, - encodeTransferAdminParams, - decodeTransferAdminParamsAt, - encodeAcceptAdminParams, - decodeAcceptAdminParamsAt, - ) -import CCIP.TokenAdminRegistryTypes ( - PoolRegistration(..), - SetPoolParams(..), - SetTransferFactoryParams(..), - SetBurnMintFactoryParams(..), - ProposeAdminParams(..), - TransferAdminParams(..), - AcceptAdminParams(..), - ) + import MCMS.Codec (encodeText, decodeTextAt) + import Chainlink.InstanceAddress qualified as RawInstanceAddress +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.CoreV1.TokenAdminRegistryCodecGen + -- =========================================================================== -- TEXT ENCODING/DECODING TESTS -- =========================================================================== @@ -70,13 +50,13 @@ testPoolRegistrationRoundtrip : Script () testPoolRegistrationRoundtrip = do alice <- allocateParty "Alice" - let poolReg = PoolRegistration with + let poolReg = CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner = alice poolInstanceId = "pool-instance-v1" - encoded = encodePoolRegistration poolReg + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodePoolRegistration poolReg - case decodePoolRegistrationAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodePoolRegistrationAt encoded 0 of None -> abort "Failed to decode PoolRegistration" Some (decoded, _) -> do decoded.poolOwner === poolReg.poolOwner @@ -88,13 +68,13 @@ testPoolRegistrationEmptyInstanceId : Script () testPoolRegistrationEmptyInstanceId = do alice <- allocateParty "Alice" - let poolReg = PoolRegistration with + let poolReg = CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner = alice poolInstanceId = "" - encoded = encodePoolRegistration poolReg + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodePoolRegistration poolReg - case decodePoolRegistrationAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodePoolRegistrationAt encoded 0 of None -> abort "Failed to decode PoolRegistration with empty instanceId" Some (decoded, _) -> do decoded.poolOwner === poolReg.poolOwner @@ -112,13 +92,13 @@ testSetPoolParamsWithPool = do tokenAdmin <- allocateParty "TokenAdmin" let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "USDC" - poolReg = PoolRegistration with + poolReg = CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner = alice poolInstanceId = "lock-release-pool-v1" - params = SetPoolParams with instrumentId, tokenPool = Some poolReg - encoded = encodeSetPoolParams params + params = CCIP.CoreV1.TokenAdminRegistry.SetPoolParams with instrumentId, tokenPool = Some poolReg + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetPoolParams params - case decodeSetPoolParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetPoolParamsAt encoded 0 of None -> abort "Failed to decode set_pool params with pool" Some (decoded, _) -> do decoded.instrumentId === instrumentId @@ -135,10 +115,10 @@ testSetPoolParamsNoPool = do tokenAdmin <- allocateParty "TokenAdmin" let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "USDC" - params = SetPoolParams with instrumentId, tokenPool = None - encoded = encodeSetPoolParams params + params = CCIP.CoreV1.TokenAdminRegistry.SetPoolParams with instrumentId, tokenPool = None + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetPoolParams params - case decodeSetPoolParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetPoolParamsAt encoded 0 of None -> abort "Failed to decode set_pool params without pool" Some (decoded, _) -> do decoded.instrumentId === instrumentId @@ -156,12 +136,12 @@ testSetTransferFactoryParamsWithAddress = do let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" factoryAddress = RawInstanceAddress.make "link-transfer-factory" tokenAdmin - params = SetTransferFactoryParams with + params = CCIP.CoreV1.TokenAdminRegistry.SetTransferFactoryParams with instrumentId transferFactoryAddress = Some factoryAddress - encoded = encodeSetTransferFactoryParams params + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetTransferFactoryParams params - case decodeSetTransferFactoryParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetTransferFactoryParamsAt encoded 0 of None -> abort "Failed to decode set_transfer_factory params with address" Some (decoded, _) -> do decoded.instrumentId === instrumentId @@ -174,12 +154,12 @@ testSetTransferFactoryParamsNoAddress = do tokenAdmin <- allocateParty "TokenAdmin" let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" - params = SetTransferFactoryParams with + params = CCIP.CoreV1.TokenAdminRegistry.SetTransferFactoryParams with instrumentId transferFactoryAddress = None - encoded = encodeSetTransferFactoryParams params + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetTransferFactoryParams params - case decodeSetTransferFactoryParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetTransferFactoryParamsAt encoded 0 of None -> abort "Failed to decode set_transfer_factory params without address" Some (decoded, _) -> do decoded.instrumentId === instrumentId @@ -193,12 +173,12 @@ testSetBurnMintFactoryParamsWithAddress = do let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" factoryAddress = RawInstanceAddress.make "link-burn-mint-factory" tokenAdmin - params = SetBurnMintFactoryParams with + params = CCIP.CoreV1.TokenAdminRegistry.SetBurnMintFactoryParams with instrumentId burnMintFactoryAddress = Some factoryAddress - encoded = encodeSetBurnMintFactoryParams params + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetBurnMintFactoryParams params - case decodeSetBurnMintFactoryParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetBurnMintFactoryParamsAt encoded 0 of None -> abort "Failed to decode set_burn_mint_factory params with address" Some (decoded, _) -> do decoded.instrumentId === instrumentId @@ -211,12 +191,12 @@ testSetBurnMintFactoryParamsNoAddress = do tokenAdmin <- allocateParty "TokenAdmin" let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" - params = SetBurnMintFactoryParams with + params = CCIP.CoreV1.TokenAdminRegistry.SetBurnMintFactoryParams with instrumentId burnMintFactoryAddress = None - encoded = encodeSetBurnMintFactoryParams params + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetBurnMintFactoryParams params - case decodeSetBurnMintFactoryParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetBurnMintFactoryParamsAt encoded 0 of None -> abort "Failed to decode set_burn_mint_factory params without address" Some (decoded, _) -> do decoded.instrumentId === instrumentId @@ -234,10 +214,10 @@ testProposeAdminParamsRoundtrip = do newAdmin <- allocateParty "NewAdmin" let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "TOKEN" - params = ProposeAdminParams with instrumentId, newAdmin - encoded = encodeProposeAdminParams params + params = CCIP.CoreV1.TokenAdminRegistry.ProposeAdminParams with instrumentId, newAdmin + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeProposeAdminParams params - case decodeProposeAdminParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeProposeAdminParamsAt encoded 0 of None -> abort "Failed to decode propose_admin params" Some (decoded, _) -> do decoded.instrumentId === instrumentId @@ -255,10 +235,10 @@ testTransferAdminParamsRoundtrip = do newAdmin <- allocateParty "NewAdmin" let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "TOKEN" - params = TransferAdminParams with instrumentId, newAdmin - encoded = encodeTransferAdminParams params + params = CCIP.CoreV1.TokenAdminRegistry.TransferAdminParams with instrumentId, newAdmin + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeTransferAdminParams params - case decodeTransferAdminParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeTransferAdminParamsAt encoded 0 of None -> abort "Failed to decode transfer_admin params" Some (decoded, _) -> do decoded.instrumentId === instrumentId @@ -275,10 +255,10 @@ testAcceptAdminParamsRoundtrip = do tokenAdmin <- allocateParty "TokenAdmin" let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "TOKEN" - params = AcceptAdminParams with instrumentId - encoded = encodeAcceptAdminParams params + params = CCIP.CoreV1.TokenAdminRegistry.AcceptAdminParams with instrumentId + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeAcceptAdminParams params - case decodeAcceptAdminParamsAt encoded 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeAcceptAdminParamsAt encoded 0 of None -> abort "Failed to decode accept_admin params" Some (decoded, _) -> decoded.instrumentId === instrumentId @@ -292,12 +272,12 @@ testAcceptAdminParamsRoundtrip = do testInvalidDataRejection : Script () testInvalidDataRejection = do -- Empty data should fail - case decodeSetPoolParamsAt "" 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetPoolParamsAt "" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeSetPoolParamsAt to fail on empty data" -- Truncated data should fail - case decodeSetPoolParamsAt "00" 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetPoolParamsAt "00" 0 of None -> pure () -- Expected Some _ -> abort "Expected decodeSetPoolParamsAt to fail on truncated data" @@ -305,12 +285,12 @@ testInvalidDataRejection = do -- First need valid instrumentId, then invalid bool tokenAdmin <- allocateParty "TokenAdmin" let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "T" - validParams = AcceptAdminParams with instrumentId - validInstrumentIdEncoded = encodeAcceptAdminParams validParams + validParams = CCIP.CoreV1.TokenAdminRegistry.AcceptAdminParams with instrumentId + validInstrumentIdEncoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeAcceptAdminParams validParams -- Append invalid bool (02 instead of 00 or 01) invalidData = validInstrumentIdEncoded <> "02" - case decodeSetPoolParamsAt invalidData 0 of + case CCIP.CoreV1.TokenAdminRegistryCodecGen.decodeSetPoolParamsAt invalidData 0 of None -> pure () -- Expected - should fail on invalid bool Some _ -> abort "Expected decodeSetPoolParamsAt to fail on invalid bool" diff --git a/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryMCMSTest.daml b/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryMCMSTest.daml index 94bd9544d..9096876e8 100644 --- a/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryMCMSTest.daml +++ b/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryMCMSTest.daml @@ -6,21 +6,25 @@ import DA.Assert ((===)) import DA.Map qualified as Map import DA.Optional (fromSomeNote) -import qualified Splice.Api.Token.HoldingV1 import qualified Splice.Api.Token.BurnMintV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 + import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiver_Entrypoint(..)) + import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.TokenAdminRegistry -import CCIP.TokenAdminRegistryCodecGen (encodeSetPoolParams, encodeSetTransferFactoryParams, encodeSetBurnMintFactoryParams, encodeProposeAdminParams, encodeTransferAdminParams, encodeAcceptAdminParams) -import CCIP.TokenAdminRegistryTypes (PoolRegistration(..), SetPoolParams(..), SetTransferFactoryParams(..), SetBurnMintFactoryParams(..), ProposeAdminParams(..), TransferAdminParams(..), AcceptAdminParams(..)) + +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.CoreV1.TokenAdminRegistryCodecGen + import qualified TestToken toAnyContractId : ContractId a -> ContractId () toAnyContractId = coerceContractId tokenConfigAddr : Party -> Splice.Api.Token.HoldingV1.InstrumentId -> Text -tokenConfigAddr owner instrumentId = RawInstanceAddress.makeText (tokenConfigInstanceId instrumentId) owner +tokenConfigAddr owner instrumentId = RawInstanceAddress.makeText (CCIP.CoreV1.TokenAdminRegistry.tokenConfigInstanceId instrumentId) owner createRegistryAndConfig : Party @@ -28,20 +32,20 @@ createRegistryAndConfig -> Splice.Api.Token.HoldingV1.InstrumentId -> Optional Party -> Optional Party - -> Optional PoolRegistration - -> Script (ContractId TokenAdminRegistry, ContractId TokenConfig) -createRegistryAndConfig owner instanceId instrumentId admin pendingAdmin tokenPool = do - tarCid <- submit owner do - createCmd TokenAdminRegistry with + -> Optional CCIP.CoreV1.TokenAdminRegistry.PoolRegistration + -> Script (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry, ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) +createRegistryAndConfig ccipOwner instanceId instrumentId admin pendingAdmin tokenPool = do + tarCid <- submit ccipOwner do + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId - owner + ccipOwner entryCount = 1 - configCid <- submit owner do - createCmd TokenConfig with - instanceId = tokenConfigInstanceId instrumentId + configCid <- submit ccipOwner do + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenConfig with + instanceId = CCIP.CoreV1.TokenAdminRegistry.tokenConfigInstanceId instrumentId registryInstanceId = instanceId - registryOwner = owner + registryOwner = ccipOwner index = 0 isCCIPManaged = False instrumentId @@ -53,7 +57,7 @@ createRegistryAndConfig owner instanceId instrumentId admin pendingAdmin tokenPo pure (tarCid, configCid) -mcmsIds : Party -> Text -> Splice.Api.Token.HoldingV1.InstrumentId -> ContractId TokenAdminRegistry -> ContractId TokenConfig -> Map.Map Text (ContractId ()) +mcmsIds : Party -> Text -> Splice.Api.Token.HoldingV1.InstrumentId -> ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry -> ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig -> Map.Map Text (ContractId ()) mcmsIds owner instanceId instrumentId tarCid configCid = Map.fromList [ (RawInstanceAddress.makeText instanceId owner, toAnyContractId tarCid) @@ -66,247 +70,248 @@ lookupContractId address contractIds = testTokenAdminRegistryMCMSEntrypoint_SetPool : Script () testTokenAdminRegistryMCMSEntrypoint_SetPool = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" tokenAdmin <- allocateParty "TokenAdmin" poolOwner <- allocateParty "PoolOwner" let instanceId = "tar-test-instance" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "USDC" - poolReg = PoolRegistration poolOwner "pool-v1" + poolReg = CCIP.CoreV1.TokenAdminRegistry.PoolRegistration poolOwner "pool-v1" - (tarCid, configCid0) <- createRegistryAndConfig owner instanceId instrumentId (Some owner) None None + (tarCid, configCid0) <- createRegistryAndConfig ccipOwner instanceId instrumentId (Some ccipOwner) None None let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeSetPoolParams (SetPoolParams with instrumentId, tokenPool = Some poolReg) + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetPoolParams (CCIP.CoreV1.TokenAdminRegistry.SetPoolParams with instrumentId, tokenPool = Some poolReg) - newContractIds <- submit owner do + newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "SetPool" operationData = encoded - contractIds = mcmsIds owner instanceId instrumentId tarCid configCid0 + contractIds = mcmsIds ccipOwner instanceId instrumentId tarCid configCid0 - let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr owner instrumentId) newContractIds) : ContractId TokenConfig - Some config <- queryContractId owner configCid1 + let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr ccipOwner instrumentId) newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig + Some config <- queryContractId ccipOwner configCid1 config.tokenPool === Some poolReg testTokenAdminRegistryMCMSEntrypoint_SetPoolNone : Script () testTokenAdminRegistryMCMSEntrypoint_SetPoolNone = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" tokenAdmin <- allocateParty "TokenAdmin" poolOwner <- allocateParty "PoolOwner" let instanceId = "tar-test-instance" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "LINK" - existingPool = PoolRegistration poolOwner "old-pool" + existingPool = CCIP.CoreV1.TokenAdminRegistry.PoolRegistration poolOwner "old-pool" - (tarCid, configCid0) <- createRegistryAndConfig owner instanceId instrumentId (Some owner) None (Some existingPool) + (tarCid, configCid0) <- createRegistryAndConfig ccipOwner instanceId instrumentId (Some ccipOwner) None (Some existingPool) let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeSetPoolParams (SetPoolParams with instrumentId, tokenPool = None) + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetPoolParams (CCIP.CoreV1.TokenAdminRegistry.SetPoolParams with instrumentId, tokenPool = None) - newContractIds <- submit owner do + newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "SetPool" operationData = encoded - contractIds = mcmsIds owner instanceId instrumentId tarCid configCid0 + contractIds = mcmsIds ccipOwner instanceId instrumentId tarCid configCid0 - let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr owner instrumentId) newContractIds) : ContractId TokenConfig - Some config <- queryContractId owner configCid1 + let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr ccipOwner instrumentId) newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig + Some config <- queryContractId ccipOwner configCid1 config.tokenPool === None testTokenAdminRegistryMCMSEntrypoint_SetTransferFactory : Script () testTokenAdminRegistryMCMSEntrypoint_SetTransferFactory = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" let instanceId = "tar-set-transfer-factory-mcms-test" - instrumentId = Splice.Api.Token.HoldingV1.InstrumentId owner "LINK" - transferFactoryAddr = RawInstanceAddress.make "link-transfer-factory" owner + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId ccipOwner "LINK" + transferFactoryAddr = RawInstanceAddress.make "link-transfer-factory" ccipOwner - (tarCid, configCid0) <- createRegistryAndConfig owner instanceId instrumentId (Some owner) None None - factoryCid <- submit owner do + (tarCid, configCid0) <- createRegistryAndConfig ccipOwner instanceId instrumentId (Some ccipOwner) None None + factoryCid <- submit ccipOwner do createCmd TestToken.TestTransferFactory with - admin = owner + admin = ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeSetTransferFactoryParams (SetTransferFactoryParams with + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetTransferFactoryParams (CCIP.CoreV1.TokenAdminRegistry.SetTransferFactoryParams with instrumentId transferFactoryAddress = Some transferFactoryAddr) contractIds = Map.insert (RawInstanceAddress.toText transferFactoryAddr) (toAnyContractId factoryCid) - (mcmsIds owner instanceId instrumentId tarCid configCid0) + (mcmsIds ccipOwner instanceId instrumentId tarCid configCid0) - newContractIds <- submit owner do + newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "SetTransferFactory" operationData = encoded contractIds - let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr owner instrumentId) newContractIds) : ContractId TokenConfig - Some config <- queryContractId owner configCid1 + let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr ccipOwner instrumentId) newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig + Some config <- queryContractId ccipOwner configCid1 config.transferFactory === Some (toInterfaceContractId @Splice.Api.Token.TransferInstructionV1.TransferFactory factoryCid) testTokenAdminRegistryMCMSEntrypoint_SetTransferFactoryNone : Script () testTokenAdminRegistryMCMSEntrypoint_SetTransferFactoryNone = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" let instanceId = "tar-set-transfer-factory-none-mcms-test" - instrumentId = Splice.Api.Token.HoldingV1.InstrumentId owner "LINK" - transferFactoryAddr = RawInstanceAddress.make "old-link-transfer-factory" owner + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId ccipOwner "LINK" + transferFactoryAddr = RawInstanceAddress.make "old-link-transfer-factory" ccipOwner - (tarCid, configCid0) <- createRegistryAndConfig owner instanceId instrumentId (Some owner) None None - factoryCid <- submit owner do + (tarCid, configCid0) <- createRegistryAndConfig ccipOwner instanceId instrumentId (Some ccipOwner) None None + factoryCid <- submit ccipOwner do createCmd TestToken.TestTransferFactory with - admin = owner - configCid1 <- submit owner do - exerciseCmd tarCid SetTransferFactory with + admin = ccipOwner + configCid1 <- submit ccipOwner do + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetTransferFactory with tokenConfigCid = configCid0 instrumentId transferFactory = Some (toInterfaceContractId @Splice.Api.Token.TransferInstructionV1.TransferFactory factoryCid) - caller = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = ccipOwner let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeSetTransferFactoryParams (SetTransferFactoryParams with + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetTransferFactoryParams (CCIP.CoreV1.TokenAdminRegistry.SetTransferFactoryParams with instrumentId transferFactoryAddress = None) - newContractIds <- submit owner do + newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "SetTransferFactory" operationData = encoded contractIds = Map.insert (RawInstanceAddress.toText transferFactoryAddr) (toAnyContractId factoryCid) - (mcmsIds owner instanceId instrumentId tarCid configCid1) + (mcmsIds ccipOwner instanceId instrumentId tarCid configCid1) - let configCid2 = coerceContractId (lookupContractId (tokenConfigAddr owner instrumentId) newContractIds) : ContractId TokenConfig - Some config <- queryContractId owner configCid2 + let configCid2 = coerceContractId (lookupContractId (tokenConfigAddr ccipOwner instrumentId) newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig + Some config <- queryContractId ccipOwner configCid2 config.transferFactory === None testTokenAdminRegistryMCMSEntrypoint_SetBurnMintFactory : Script () testTokenAdminRegistryMCMSEntrypoint_SetBurnMintFactory = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" let instanceId = "tar-set-burn-mint-factory-mcms-test" - instrumentId = Splice.Api.Token.HoldingV1.InstrumentId owner "LINK" - burnMintFactoryAddr = RawInstanceAddress.make "link-burn-mint-factory" owner + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId ccipOwner "LINK" + burnMintFactoryAddr = RawInstanceAddress.make "link-burn-mint-factory" ccipOwner - (tarCid, configCid0) <- createRegistryAndConfig owner instanceId instrumentId (Some owner) None None - factoryCid <- submit owner do + (tarCid, configCid0) <- createRegistryAndConfig ccipOwner instanceId instrumentId (Some ccipOwner) None None + factoryCid <- submit ccipOwner do createCmd TestToken.BadBurnMintFactory with - admin = owner + admin = ccipOwner outputs = [] let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeSetBurnMintFactoryParams (SetBurnMintFactoryParams with + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeSetBurnMintFactoryParams (CCIP.CoreV1.TokenAdminRegistry.SetBurnMintFactoryParams with instrumentId burnMintFactoryAddress = Some burnMintFactoryAddr) contractIds = Map.insert (RawInstanceAddress.toText burnMintFactoryAddr) (toAnyContractId factoryCid) - (mcmsIds owner instanceId instrumentId tarCid configCid0) + (mcmsIds ccipOwner instanceId instrumentId tarCid configCid0) - newContractIds <- submit owner do + newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "SetBurnMintFactory" operationData = encoded contractIds - let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr owner instrumentId) newContractIds) : ContractId TokenConfig - Some config <- queryContractId owner configCid1 + let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr ccipOwner instrumentId) newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig + Some config <- queryContractId ccipOwner configCid1 config.burnMintFactory === Some (toInterfaceContractId @Splice.Api.Token.BurnMintV1.BurnMintFactory factoryCid) testTokenAdminRegistryMCMSEntrypoint_ProposeAdministrator : Script () testTokenAdminRegistryMCMSEntrypoint_ProposeAdministrator = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" tokenAdmin <- allocateParty "TokenAdmin" newAdmin <- allocateParty "NewAdmin" let instanceId = "tar-propose-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "TOKEN" - instAddr = RawInstanceAddress.makeText instanceId owner + instAddr = RawInstanceAddress.makeText instanceId ccipOwner - tarCid <- submit owner do - createCmd TokenAdminRegistry with + tarCid <- submit ccipOwner do + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId - owner + ccipOwner = ccipOwner entryCount = 0 let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeProposeAdminParams (ProposeAdminParams with instrumentId, newAdmin) + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeProposeAdminParams (CCIP.CoreV1.TokenAdminRegistry.ProposeAdminParams with instrumentId, newAdmin) - newContractIds <- submit owner do + newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "ProposeAdministrator" operationData = encoded contractIds = Map.fromList [(instAddr, toAnyContractId tarCid)] - let newTarCid = coerceContractId (lookupContractId instAddr newContractIds) : ContractId TokenAdminRegistry - configCid = coerceContractId (lookupContractId (tokenConfigAddr owner instrumentId) newContractIds) : ContractId TokenConfig - Some tar <- queryContractId owner newTarCid + let newTarCid = coerceContractId (lookupContractId instAddr newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry + configCid = coerceContractId (lookupContractId (tokenConfigAddr ccipOwner instrumentId) newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig + Some tar <- queryContractId ccipOwner newTarCid tar.entryCount === 1 - Some config <- queryContractId owner configCid + Some config <- queryContractId ccipOwner configCid config.admin === None config.pendingAdmin === Some newAdmin config.isCCIPManaged === True testTokenAdminRegistryMCMSEntrypoint_TransferAdminRole : Script () testTokenAdminRegistryMCMSEntrypoint_TransferAdminRole = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" tokenAdmin <- allocateParty "TokenAdmin" newAdmin <- allocateParty "NewAdmin" let instanceId = "tar-transfer-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "WETH" - (tarCid, configCid0) <- createRegistryAndConfig owner instanceId instrumentId (Some owner) None None + (tarCid, configCid0) <- createRegistryAndConfig ccipOwner instanceId instrumentId (Some ccipOwner) None None let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeTransferAdminParams (TransferAdminParams with instrumentId, newAdmin) + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeTransferAdminParams (CCIP.CoreV1.TokenAdminRegistry.TransferAdminParams with instrumentId, newAdmin) - newContractIds <- submit owner do + newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "TransferAdminRole" operationData = encoded - contractIds = mcmsIds owner instanceId instrumentId tarCid configCid0 + contractIds = mcmsIds ccipOwner instanceId instrumentId tarCid configCid0 - let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr owner instrumentId) newContractIds) : ContractId TokenConfig - Some config <- queryContractId owner configCid1 - config.admin === Some owner + let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr ccipOwner instrumentId) newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig + Some config <- queryContractId ccipOwner configCid1 + config.admin === Some ccipOwner config.pendingAdmin === Some newAdmin testTokenAdminRegistryMCMSEntrypoint_AcceptAdminRole : Script () testTokenAdminRegistryMCMSEntrypoint_AcceptAdminRole = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" tokenAdmin <- allocateParty "TokenAdmin" let instanceId = "tar-accept-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "DAI" - (tarCid, configCid0) <- createRegistryAndConfig owner instanceId instrumentId None (Some owner) None + (tarCid, configCid0) <- createRegistryAndConfig ccipOwner instanceId instrumentId None (Some ccipOwner) None let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeAcceptAdminParams (AcceptAdminParams with instrumentId) + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeAcceptAdminParams (CCIP.CoreV1.TokenAdminRegistry.AcceptAdminParams with instrumentId) - newContractIds <- submit owner do + newContractIds <- submit ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "AcceptAdminRole" operationData = encoded - contractIds = mcmsIds owner instanceId instrumentId tarCid configCid0 + contractIds = mcmsIds ccipOwner instanceId instrumentId tarCid configCid0 - let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr owner instrumentId) newContractIds) : ContractId TokenConfig - Some config <- queryContractId owner configCid1 - config.admin === Some owner + let configCid1 = coerceContractId (lookupContractId (tokenConfigAddr ccipOwner instrumentId) newContractIds) : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig + Some config <- queryContractId ccipOwner configCid1 + config.admin === Some ccipOwner config.pendingAdmin === None testTokenAdminRegistryMCMSEntrypoint_UnknownFunction : Script () testTokenAdminRegistryMCMSEntrypoint_UnknownFunction = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" let instanceId = "tar-error-test" - tarCid <- submit owner do - createCmd TokenAdminRegistry with + tarCid <- submit ccipOwner do + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId - owner + ccipOwner = ccipOwner entryCount = 0 - let instAddr = RawInstanceAddress.makeText instanceId owner + let instAddr = RawInstanceAddress.makeText instanceId ccipOwner targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - submitMustFail owner do + submitMustFail ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "NonExistentFunction" operationData = "" @@ -314,16 +319,16 @@ testTokenAdminRegistryMCMSEntrypoint_UnknownFunction = script do testTokenAdminRegistryMCMSEntrypoint_InvalidParams : Script () testTokenAdminRegistryMCMSEntrypoint_InvalidParams = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" let instanceId = "tar-invalid-test" - tarCid <- submit owner do - createCmd TokenAdminRegistry with + tarCid <- submit ccipOwner do + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId - owner + ccipOwner = ccipOwner entryCount = 0 - let instAddr = RawInstanceAddress.makeText instanceId owner + let instAddr = RawInstanceAddress.makeText instanceId ccipOwner targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - submitMustFail owner do + submitMustFail ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "SetPool" operationData = "00" @@ -331,18 +336,18 @@ testTokenAdminRegistryMCMSEntrypoint_InvalidParams = script do testTokenAdminRegistryMCMSEntrypoint_MissingSelfCid : Script () testTokenAdminRegistryMCMSEntrypoint_MissingSelfCid = script do - owner <- allocateParty "ccip_owner" + ccipOwner <- allocateParty "ccip_owner" tokenAdmin <- allocateParty "TokenAdmin" let instanceId = "tar-missing-cid-test" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId tokenAdmin "TEST" - tarCid <- submit owner do - createCmd TokenAdminRegistry with + tarCid <- submit ccipOwner do + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId - owner + ccipOwner = ccipOwner entryCount = 0 let targetAsMcmsReceiver = toInterfaceContractId @MCMSReceiver tarCid - encoded = encodeAcceptAdminParams (AcceptAdminParams with instrumentId) - submitMustFail owner do + encoded = CCIP.CoreV1.TokenAdminRegistryCodecGen.encodeAcceptAdminParams (CCIP.CoreV1.TokenAdminRegistry.AcceptAdminParams with instrumentId) + submitMustFail ccipOwner do exerciseCmd targetAsMcmsReceiver MCMSReceiver_Entrypoint with functionName = "AcceptAdminRole" operationData = encoded diff --git a/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryTest.daml b/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryTest.daml index 25a810bdf..57e5ec709 100644 --- a/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryTest.daml +++ b/contracts/ccip/test/daml/CCIP/TokenAdminRegistryTest/TokenAdminRegistryTest.daml @@ -4,33 +4,36 @@ import Daml.Script import DA.Assert ((===)) import DA.Optional (fromSome) -import qualified Splice.Api.Token.HoldingV1 import qualified Splice.Api.Token.BurnMintV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.FinalityConfig -import qualified CCIP.MessageCodecV1 -import qualified CCIP.Tickets -import CCIP.TokenAdminRegistry -import CCIP.TokenAdminRegistryTypes qualified as TokenAdminRegistryTypes -import qualified Chainlink.InstanceAddress as RawInstanceAddress + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.TicketsV1 +import qualified CCIP.CoreV1.TokenAdminRegistry + import qualified TestToken createRegistryWithAdmin : Party -> Text -> Splice.Api.Token.HoldingV1.InstrumentId - -> Script (ContractId TokenAdminRegistry, ContractId TokenConfig) + -> Script (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry, ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) createRegistryWithAdmin owner instanceId instrumentId = do tarCid <- submit owner do - createCmd TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId - owner + ccipOwner =owner entryCount = 1 configCid <- submit owner do - createCmd TokenConfig with - instanceId = tokenConfigInstanceId instrumentId + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenConfig with + instanceId = CCIP.CoreV1.TokenAdminRegistry.tokenConfigInstanceId instrumentId registryInstanceId = instanceId registryOwner = owner index = 0 @@ -56,10 +59,11 @@ testTransferAdminRoleRequiresAcceptance = script do (tarCid, configCid0) <- createRegistryWithAdmin owner instanceId instrumentId configCid1 <- submit owner do - exerciseCmd tarCid TransferAdminRole with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.TransferAdminRole with tokenConfigCid = configCid0 instrumentId newAdmin + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner Some configAfterTransfer <- queryContractId owner configCid1 @@ -68,9 +72,10 @@ testTransferAdminRoleRequiresAcceptance = script do disclosedTar <- fromSome <$> queryDisclosure owner tarCid configCid2 <- submit (actAs newAdmin <> disclose disclosedTar) do - exerciseCmd tarCid AcceptAdminRole with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.AcceptAdminRole with tokenConfigCid = configCid1 instrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = newAdmin Some configAfterAccept <- queryContractId owner configCid2 @@ -90,10 +95,11 @@ testTransferAdminRoleRejectsSameAdmin = script do (tarCid, configCid) <- createRegistryWithAdmin owner instanceId instrumentId submitMustFail owner do - exerciseCmd tarCid TransferAdminRole with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.TransferAdminRole with tokenConfigCid = configCid instrumentId newAdmin = owner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner Some config <- queryContractId owner configCid @@ -115,20 +121,22 @@ testSetTransferFactoryStoresAndClearsFactory = script do admin = owner configCid1 <- submit owner do - exerciseCmd tarCid SetTransferFactory with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetTransferFactory with tokenConfigCid = configCid0 instrumentId transferFactory = Some (toInterfaceContractId @Splice.Api.Token.TransferInstructionV1.TransferFactory factoryCid) + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner Some config1 <- queryContractId owner configCid1 config1.transferFactory === Some (toInterfaceContractId @Splice.Api.Token.TransferInstructionV1.TransferFactory factoryCid) configCid2 <- submit owner do - exerciseCmd tarCid SetTransferFactory with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetTransferFactory with tokenConfigCid = configCid1 instrumentId transferFactory = None + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner Some config2 <- queryContractId owner configCid2 @@ -153,10 +161,11 @@ testSetTransferFactoryRejectsNonAdmin = script do disclosedConfig <- fromSome <$> queryDisclosure owner configCid disclosedFactory <- fromSome <$> queryDisclosure owner factoryCid submitMustFail (actAs other <> disclose disclosedTar <> disclose disclosedConfig <> disclose disclosedFactory) do - exerciseCmd tarCid SetTransferFactory with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetTransferFactory with tokenConfigCid = configCid instrumentId transferFactory = Some (toInterfaceContractId @Splice.Api.Token.TransferInstructionV1.TransferFactory factoryCid) + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = other pure () @@ -175,20 +184,22 @@ testSetBurnMintFactoryStoresAndClearsFactory = script do outputs = [] configCid1 <- submit owner do - exerciseCmd tarCid SetBurnMintFactory with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetBurnMintFactory with tokenConfigCid = configCid0 instrumentId burnMintFactory = Some (toInterfaceContractId @Splice.Api.Token.BurnMintV1.BurnMintFactory factoryCid) + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner Some config1 <- queryContractId owner configCid1 config1.burnMintFactory === Some (toInterfaceContractId @Splice.Api.Token.BurnMintV1.BurnMintFactory factoryCid) configCid2 <- submit owner do - exerciseCmd tarCid SetBurnMintFactory with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetBurnMintFactory with tokenConfigCid = configCid1 instrumentId burnMintFactory = None + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner Some config2 <- queryContractId owner configCid2 @@ -204,47 +215,48 @@ testFinalizeExecuteRejectsPoolChangedAfterInboundVerification = script do let registryInstanceId = "tar-finalize-pool-change" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId owner "USDC" - poolV1 = TokenAdminRegistryTypes.PoolRegistration with + poolV1 = CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner poolInstanceId = "pool-v1" - poolV2 = TokenAdminRegistryTypes.PoolRegistration with + poolV2 = CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner poolInstanceId = "pool-v2" - tokenAddress = CCIP.MessageCodecV1.encodeInstrumentId instrumentId + tokenAddress = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId instrumentId (tarCid, configCid0) <- createRegistryWithAdmin owner registryInstanceId instrumentId configCid1 <- submit owner do - exerciseCmd tarCid SetPool with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetPool with tokenConfigCid = configCid0 instrumentId tokenPool = Some poolV1 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 1.0 destChainSelector = 2.0 sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 0 - finality = CCIP.FinalityConfig.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000004" sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000005" destTokenAddress = tokenAddress - tokenReceiver = CCIP.MessageCodecV1.encodePartyAddress receiver - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 1.0) + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1.0) extraData = "") messageData = "" executingMessageCid <- submit (actAs owner <> actAs poolOwner) do - createCmd CCIP.ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = owner message messageId = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -257,28 +269,29 @@ testFinalizeExecuteRejectsPoolChangedAfterInboundVerification = script do requiredCCVs = [] optionalCCVs = [] optionalCCVThreshold = 0 - receiverFinalityConfig = CCIP.FinalityConfig.WaitForFinality + receiverFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality sourceDefaultCCVs = [] - inboundPoolVerification = Some (CCIP.ExecutingMessageV1.InboundPoolVerification with + inboundPoolVerification = Some (CCIP.CoreV1.ExecutingMessage.InboundPoolVerification with poolInstanceId = poolV1.poolInstanceId poolOwner = poolV1.poolOwner poolCCVs = []) - deps = CCIP.ExecutingMessageV1.ExecutingMessageDeps with - offRamp = RawInstanceAddress.make "offramp-finalize-pool-change" owner - globalConfig = RawInstanceAddress.make "global-finalize-pool-change" owner - rmnRemote = RawInstanceAddress.make "rmn-finalize-pool-change" owner - tokenAdminRegistry = RawInstanceAddress.make registryInstanceId owner - state = CCIP.ExecutingMessageV1.ExecutingMessageState_Prepared + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with + offRamp = Chainlink.InstanceAddress.make "offramp-finalize-pool-change" owner + globalConfig = Chainlink.InstanceAddress.make "global-finalize-pool-change" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-finalize-pool-change" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make registryInstanceId owner + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_Prepared configCid2 <- submit owner do - exerciseCmd tarCid SetPool with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetPool with tokenConfigCid = configCid1 instrumentId tokenPool = Some poolV2 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner submitMustFail owner do - exerciseCmd tarCid FinalizeExecute with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.FinalizeExecute with tokenConfigCid = configCid2 executingMessageCid ticketReceiver = receiver @@ -292,22 +305,23 @@ testConsumeReceiveTicketRejectsPoolAddressMismatch = script do let registryInstanceId = "tar-consume-pool-address" instrumentId = Splice.Api.Token.HoldingV1.InstrumentId owner "USDC" - registeredPool = TokenAdminRegistryTypes.PoolRegistration with + registeredPool = CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner poolInstanceId = "pool-v2" - stalePoolAddress = RawInstanceAddress.make "pool-v1" poolOwner + stalePoolAddress = Chainlink.InstanceAddress.make "pool-v1" poolOwner (tarCid, configCid0) <- createRegistryWithAdmin owner registryInstanceId instrumentId configCid <- submit owner do - exerciseCmd tarCid SetPool with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.SetPool with tokenConfigCid = configCid0 instrumentId tokenPool = Some registeredPool + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner ticketCid <- submit (actAs owner <> actAs poolOwner) do - createCmd CCIP.Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with ccipOwner = owner ccvOwners = [] verifiedCCVs = [] @@ -318,18 +332,19 @@ testConsumeReceiveTicketRejectsPoolAddressMismatch = script do receiver tokenReceiver = receiver instrumentId - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 1.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1.0) sourcePoolData = "" messageId = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" sourceChainSelector = 1.0 - finality = CCIP.FinalityConfig.WaitForFinality + finality = CCIP.CodecV1.FinalityConfig.WaitForFinality + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedTar <- fromSome <$> queryDisclosure owner tarCid disclosedConfig <- fromSome <$> queryDisclosure owner configCid submitMustFail (actAs poolOwner <> disclose disclosedTar <> disclose disclosedConfig) do - exerciseCmd tarCid ConsumeReceiveTicket with + exerciseCmd tarCid CCIP.CoreV1.TokenAdminRegistry.ConsumeReceiveTicket with tokenConfigCid = configCid - ticketCid + tokenReceiveTicketCid = ticketCid instrumentId poolInstanceId = registeredPool.poolInstanceId caller = poolOwner diff --git a/contracts/ccip/test/daml/CCIPSenderGetFee.daml b/contracts/ccip/test/daml/CCIPSenderGetFee.daml index c5142380f..38a66707b 100644 --- a/contracts/ccip/test/daml/CCIPSenderGetFee.daml +++ b/contracts/ccip/test/daml/CCIPSenderGetFee.daml @@ -3,14 +3,16 @@ module CCIPSenderGetFee where import Daml.Script import DA.Optional (fromSome) -import qualified DA.TextMap as TextMap -import qualified CCIP.Client +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.ClientV1 import qualified CCIP.CCIPSender -import Chainlink.InstanceAddress qualified as RawInstanceAddress + import qualified CommitteeVerifier.DummyCommitteeVerifier import qualified CCVMaxBounds -import qualified Splice.Api.Token.MetadataV1 as MetadataV1 data SenderGetFeeFixture = SenderGetFeeFixture with @@ -18,29 +20,25 @@ data SenderGetFeeFixture = SenderGetFeeFixture sender : ContractId CCIP.CCIPSender.CCIPSender requiredVerifier : ContractId CommitteeVerifier.DummyCommitteeVerifier.DummyCommitteeVerifier extraVerifier : ContractId CommitteeVerifier.DummyCommitteeVerifier.DummyCommitteeVerifier - requiredVerifierAddress : RawInstanceAddress.RawInstanceAddress - extraVerifierAddress : RawInstanceAddress.RawInstanceAddress - -emptyContext : MetadataV1.ChoiceContext -emptyContext = MetadataV1.ChoiceContext with - values = TextMap.fromList [] + requiredVerifierAddress : Chainlink.InstanceAddress.RawInstanceAddress + extraVerifierAddress : Chainlink.InstanceAddress.RawInstanceAddress mkCCVSendInput - : RawInstanceAddress.RawInstanceAddress + : Chainlink.InstanceAddress.RawInstanceAddress -> ContractId CommitteeVerifier.DummyCommitteeVerifier.DummyCommitteeVerifier -> CCIP.CCIPSender.CCVSendInput mkCCVSendInput ccvAddress verifierCid = CCIP.CCIPSender.CCVSendInput with ccvAddress = ccvAddress ccvCid = coerceContractId verifierCid - ccvExtraContext = emptyContext + context = Splice.Api.Token.MetadataV1.emptyChoiceContext messageRequiringRequiredVerifier : SenderGetFeeFixture - -> CCIP.Client.Canton2AnyMessage + -> CCIP.ClientV1.Canton2AnyMessage messageRequiringRequiredVerifier f = CCVMaxBounds.messageOnly f.outbound - [ CCIP.Client.CCVExtraArg with + [ CCIP.ClientV1.CCVExtraArg with ccvAddress = f.requiredVerifierAddress ccvArgs = "" ] @@ -54,7 +52,7 @@ setupSenderGetFeeFixture suffix = do owner = outbound.user let requiredVerifierAddress = - RawInstanceAddress.make ("required-ccv-getfee-" <> suffix) outbound.user + Chainlink.InstanceAddress.make ("required-ccv-getfee-" <> suffix) outbound.user requiredVerifier <- submit outbound.user do createCmd CommitteeVerifier.DummyCommitteeVerifier.DummyCommitteeVerifier with instanceId = "required-ccv-getfee-" <> suffix @@ -66,7 +64,7 @@ setupSenderGetFeeFixture suffix = do destBytesOverhead = 13 let extraVerifierAddress = - RawInstanceAddress.make ("extra-ccv-getfee-" <> suffix) outbound.user + Chainlink.InstanceAddress.make ("extra-ccv-getfee-" <> suffix) outbound.user extraVerifier <- submit outbound.user do createCmd CommitteeVerifier.DummyCommitteeVerifier.DummyCommitteeVerifier with instanceId = "extra-ccv-getfee-" <> suffix @@ -87,7 +85,7 @@ setupSenderGetFeeFixture suffix = do submitGetFee : SenderGetFeeFixture - -> CCIP.Client.Canton2AnyMessage + -> CCIP.ClientV1.Canton2AnyMessage -> [CCIP.CCIPSender.CCVSendInput] -> Script CCIP.CCIPSender.GetFeeResult submitGetFee f message ccvSendInputs = do @@ -106,14 +104,14 @@ submitGetFee f message ccvSendInputs = do destinationChainSelector = f.outbound.destChainSelector message = message context = CCVMaxBounds.outboundContext f.outbound - routerCid = f.outbound.router + routerCid = coerceContractId f.outbound.router ccvSendInputs = ccvSendInputs tokenTransferInput = None executorInput = None submitGetFeeMustFail : SenderGetFeeFixture - -> CCIP.Client.Canton2AnyMessage + -> CCIP.ClientV1.Canton2AnyMessage -> [CCIP.CCIPSender.CCVSendInput] -> Script () submitGetFeeMustFail f message ccvSendInputs = do @@ -132,7 +130,7 @@ submitGetFeeMustFail f message ccvSendInputs = do destinationChainSelector = f.outbound.destChainSelector message = message context = CCVMaxBounds.outboundContext f.outbound - routerCid = f.outbound.router + routerCid = coerceContractId f.outbound.router ccvSendInputs = ccvSendInputs tokenTransferInput = None executorInput = None diff --git a/contracts/ccip/test/daml/CCVMaxBounds.daml b/contracts/ccip/test/daml/CCVMaxBounds.daml index 04ff1e178..0f8143f4e 100644 --- a/contracts/ccip/test/daml/CCVMaxBounds.daml +++ b/contracts/ccip/test/daml/CCVMaxBounds.daml @@ -9,62 +9,66 @@ import DA.Optional import DA.Set qualified as Set import qualified DA.TextMap as TextMap -import qualified CCIP.Client -import qualified CCIP.Context -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.FeeQuoter -import qualified CCIP.FinalityConfig -import qualified CCIP.GlobalConfig -import qualified CCIP.Internal -import CCIP.Interfaces.CrossChainVerifier qualified as ICCV -import qualified CCIP.MessageCodecV1 -import qualified CCIP.OnRamp -import qualified CCIP.OnRampTypes -import qualified CCIP.OffRamp -import qualified CCIP.OffRampTypes -import qualified CCIP.PerPartyRouter -import qualified CCIP.PerPartyRouterTypes -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 -import qualified CCIP.TokenAdminRegistry -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified Splice.Api.Token.HoldingV1 as HoldingV1 -import qualified Splice.Api.Token.MetadataV1 as MetadataV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.GlobalConfig +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.ClientV1 +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.SendingMessage +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.InterfacesV1.CrossChainVerifier +import qualified CCIP.RuntimeV1.OffRamp +import qualified CCIP.RuntimeV1.OnRamp +import qualified CCIP.RuntimeV1.PerPartyRouter + overMaxCCVCount : Int -overMaxCCVCount = CCIP.Internal.maxCCVsPerMessage + 1 +overMaxCCVCount = CCIP.CodecV1.CCVCodec.maxCCVsPerMessage + 1 cents : Decimal -> Numeric 0 cents c = intToNumeric (truncate c) -mkRawCCVs : Text -> Party -> Int -> [RawInstanceAddress.RawInstanceAddress] +mkRawCCVs : Text -> Party -> Int -> [Chainlink.InstanceAddress.RawInstanceAddress] mkRawCCVs prefix owner count = - [ RawInstanceAddress.make (prefix <> show i) owner | i <- [0..(count - 1)] ] + [ Chainlink.InstanceAddress.make (prefix <> show i) owner | i <- [0..(count - 1)] ] -mkCCVExtraArgs : Text -> Party -> Int -> [CCIP.Client.CCVExtraArg] +mkCCVExtraArgs : Text -> Party -> Int -> [CCIP.ClientV1.CCVExtraArg] mkCCVExtraArgs prefix owner count = - [ CCIP.Client.CCVExtraArg with - ccvAddress = RawInstanceAddress.make (prefix <> show i) owner + [ CCIP.ClientV1.CCVExtraArg with + ccvAddress = Chainlink.InstanceAddress.make (prefix <> show i) owner ccvArgs = "" | i <- [0..(count - 1)] ] -mkFeeQuotes : Text -> Party -> Int -> [ICCV.CrossChainVerifierFeeQuote] +mkFeeQuotes : Text -> Party -> Int -> [CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote] mkFeeQuotes prefix owner count = - [ ICCV.CrossChainVerifierFeeQuote with + [ CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote with ccvInstanceId = prefix <> show i ccvOwner = owner feeUSDCents = 0.0 gasForVerification = 0 payloadSizeBytes = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext | i <- [0..(count - 1)] ] -basicExtraArgs : [CCIP.Client.CCVExtraArg] -> CCIP.Client.ExtraArgs -basicExtraArgs ccvs = CCIP.Client.V3 CCIP.Client.GenericExtraArgsV3 with +basicExtraArgs : [CCIP.ClientV1.CCVExtraArg] -> CCIP.ClientV1.ExtraArgs +basicExtraArgs ccvs = CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = 0 ccvs = ccvs - executor = CCIP.Client.Executor_NoExecutor + executor = CCIP.ClientV1.Executor_NoExecutor tokenReceiver = "" tokenArgs = "" @@ -75,40 +79,40 @@ data OutboundFixture = OutboundFixture user : Party sourceChainSelector : Numeric 0 destChainSelector : Numeric 0 - feeToken : HoldingV1.InstrumentId - globalConfig : ContractId CCIP.GlobalConfig.GlobalConfig - onRamp : ContractId CCIP.OnRamp.OnRamp - router : ContractId CCIP.PerPartyRouter.PerPartyRouter - tokenAdminRegistry : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - feeQuoter : ContractId CCIP.FeeQuoter.FeeQuoter - rmnRemote : ContractId CCIP.RMNRemote.RMNRemote - -outboundContext : OutboundFixture -> MetadataV1.ChoiceContext + feeToken : Splice.Api.Token.HoldingV1.InstrumentId + globalConfig : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + onRamp : ContractId CCIP.RuntimeV1.OnRamp.OnRamp + router : ContractId CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter + tokenAdminRegistry : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry + feeQuoter : ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter + rmnRemote : ContractId CCIP.CoreV1.RMNRemote.RMNRemote + +outboundContext : OutboundFixture -> Splice.Api.Token.MetadataV1.ChoiceContext outboundContext f = - MetadataV1.ChoiceContext with + Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId f.rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId f.tokenAdminRegistry) - , (CCIP.FeeQuoter.feeQuoterKey, MetadataV1.AV_ContractId $ coerceContractId f.feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) - , (CCIP.OnRamp.onRampKey, MetadataV1.AV_ContractId $ coerceContractId f.onRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.tokenAdminRegistry) + , (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.onRamp) ] -messageOnly : OutboundFixture -> [CCIP.Client.CCVExtraArg] -> CCIP.Client.Canton2AnyMessage +messageOnly : OutboundFixture -> [CCIP.ClientV1.CCVExtraArg] -> CCIP.ClientV1.Canton2AnyMessage messageOnly f ccvs = - CCIP.Client.Canton2AnyMessage with + CCIP.ClientV1.Canton2AnyMessage with receiver = "0000000000000000000000000000000000000001" payload = "abcd" tokenTransfer = None feeToken = f.feeToken extraArgs = basicExtraArgs ccvs -tokenOnlyClientMessage : OutboundFixture -> CCIP.Client.Canton2AnyMessage +tokenOnlyClientMessage : OutboundFixture -> CCIP.ClientV1.Canton2AnyMessage tokenOnlyClientMessage f = - CCIP.Client.Canton2AnyMessage with + CCIP.ClientV1.Canton2AnyMessage with receiver = "0000000000000000000000000000000000000001" payload = "" - tokenTransfer = Some (CCIP.Client.TokenTransfer with + tokenTransfer = Some (CCIP.ClientV1.TokenTransfer with token = f.feeToken amount = 1.0) feeToken = f.feeToken @@ -128,17 +132,17 @@ setupOutboundFixture suffix = do let tokenAdminRegistryInstanceId = "tar-bounds-" <> suffix let feeQuoterInstanceId = "feequoter-bounds-" <> suffix let rmnInstanceId = "rmn-bounds-" <> suffix - let feeToken = HoldingV1.InstrumentId with + let feeToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "FeeToken" globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = sourceChainSelector destChainConfigs = Map.fromList - [ (destChainSelector, CCIP.GlobalConfig.DestChainConfig with + [ (destChainSelector, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False @@ -154,7 +158,7 @@ setupOutboundFixture suffix = do sourceChainConfigs = Map.empty rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -162,18 +166,18 @@ setupOutboundFixture suffix = do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 feeQuoter <- submit ccipOwner do - createCmd CCIP.FeeQuoter.FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = feeQuoterInstanceId - owner = ccipOwner + ccipOwner = ccipOwner feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList - [ (destChainSelector, CCIP.FeeQuoter.FeeQuoterDestChainConfig with + [ (destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 1000000 @@ -187,13 +191,13 @@ setupOutboundFixture suffix = do ] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [ (destChainSelector, CCIP.FeeQuoter.TimestampedPrice with + [ (destChainSelector, CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 0.0 timestamp = datetime 2025 Jan 1 0 0 0 ) ] usdPerToken = Map.fromList - [ (feeToken, CCIP.FeeQuoter.TimestampedPrice with + [ (feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 100000000.0 timestamp = datetime 2025 Jan 1 0 0 0 ) @@ -202,29 +206,28 @@ setupOutboundFixture suffix = do priceUpdaters = [] onRamp <- submit ccipOwner do - createCmd CCIP.OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = onRampInstanceId ccipOwner = ccipOwner maxUSDCentsPerMsg = 1000000000.0 - deps = CCIP.OnRampTypes.OnRampDeps with - globalConfig = RawInstanceAddress.make globalConfigInstanceId ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner - ccvRegistry = RawInstanceAddress.make ("ccvregistry-bounds-" <> suffix) ccipOwner + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner router <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = routerInstanceId ccipOwner = ccipOwner partyOwner = user - deps = CCIP.PerPartyRouterTypes.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make onRampInstanceId ccipOwner - offRamp = RawInstanceAddress.make ("offramp-unused-bounds-" <> suffix) ccipOwner - globalConfig = RawInstanceAddress.make globalConfigInstanceId ccipOwner - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make onRampInstanceId ccipOwner + offRamp = Chainlink.InstanceAddress.make ("offramp-unused-bounds-" <> suffix) ccipOwner + globalConfig = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner outboundSequenceNumbers = Map.empty executedMessages = Set.empty archivedExecutionContractIds = [] @@ -254,7 +257,7 @@ testGetFeeRejectsTooManyCCVFeeQuotes = script do let tooManyQuotes = mkFeeQuotes "quote-" f.user overMaxCCVCount submitMustFail (actAs f.user <> actAs f.ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedFeeQuoter) do - exerciseCmd f.router CCIP.PerPartyRouter.GetFee with + exerciseCmd f.router CCIP.RuntimeV1.PerPartyRouter.GetFee with context = outboundContext f destChainSelector = f.destChainSelector message = messageOnly f [] @@ -263,7 +266,7 @@ testGetFeeRejectsTooManyCCVFeeQuotes = script do executorFeeQuote = None submitMustFail (actAs f.ccipOwner) do - exerciseCmd f.onRamp CCIP.OnRamp.GetFeeFromRouter with + exerciseCmd f.onRamp CCIP.RuntimeV1.OnRamp.GetFeeFromRouter with routerPartyOwner = f.user routerInstanceId = "router-bounds-fee-quotes" globalConfigCid = f.globalConfig @@ -288,20 +291,20 @@ testOutboundRequiredCCVGuardsRejectTooManyLists = script do let tooManySenderMessage = messageOnly f tooManySenderCCVs submitMustFail (actAs f.user <> actAs f.ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig) do - exerciseCmd f.router CCIP.PerPartyRouter.GetRequiredCCVsForSend with + exerciseCmd f.router CCIP.RuntimeV1.PerPartyRouter.GetRequiredCCVsForSend with context = outboundContext f destChainSelector = f.destChainSelector message = tooManySenderMessage poolReportedCCVs = [] submitMustFail (actAs f.user <> actAs f.ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd f.router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd f.router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with destinationChainSelector = f.destChainSelector message = tooManySenderMessage context = outboundContext f submitMustFail (actAs f.user <> actAs f.ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig) do - exerciseCmd f.router CCIP.PerPartyRouter.GetRequiredCCVsForSend with + exerciseCmd f.router CCIP.RuntimeV1.PerPartyRouter.GetRequiredCCVsForSend with context = outboundContext f destChainSelector = f.destChainSelector message = tokenOnlyClientMessage f @@ -310,27 +313,27 @@ testOutboundRequiredCCVGuardsRejectTooManyLists = script do mkSendingMessage : Party -> Party - -> [RawInstanceAddress.RawInstanceAddress] + -> [Chainlink.InstanceAddress.RawInstanceAddress] -> Numeric 0 - -> Script (ContractId CCIP.SendingMessageV1.SendingMessageV1) + -> Script (ContractId CCIP.CoreV1.SendingMessage.SendingMessage) mkSendingMessage ccipOwner sender destDefaultCCVs sequenceNumber = do - let feeToken = HoldingV1.InstrumentId with + let feeToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "FeeToken" - let tokenInstrumentId = HoldingV1.InstrumentId with + let tokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "SendToken" submit ccipOwner do - createCmd CCIP.SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = CCIP.SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-pool-bounds" sender - onRamp = RawInstanceAddress.make "onramp-pool-bounds" ccipOwner - globalConfig = RawInstanceAddress.make "globalconfig-pool-bounds" ccipOwner - rmnRemote = RawInstanceAddress.make "rmn-pool-bounds" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "tar-pool-bounds" ccipOwner - feeQuoter = RawInstanceAddress.make "feequoter-pool-bounds" ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-pool-bounds" sender + onRamp = Chainlink.InstanceAddress.make "onramp-pool-bounds" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-pool-bounds" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-pool-bounds" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-pool-bounds" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "feequoter-pool-bounds" ccipOwner destChainSelector = 2222222222.0 destAddressBytesLength = 20 sequenceNumber = sequenceNumber @@ -338,9 +341,9 @@ mkSendingMessage ccipOwner sender destDefaultCCVs sequenceNumber = do requiredCCVs = [] requiredExecutor = None executorAddress = "" - executionMode = Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 1111111111.0 - senderAddress = CCIP.MessageCodecV1.encodePartyAddress sender + senderAddress = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender receiver = "0000000000000000000000000000000000000001" payload = "" executionGasLimit = 0 @@ -353,6 +356,7 @@ mkSendingMessage ccipOwner sender destDefaultCCVs sequenceNumber = do feeToken = feeToken networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some tokenInstrumentId + tokenAmountBeforeTokenPoolFees = 10.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -371,7 +375,7 @@ mkSendingMessage ccipOwner sender destDefaultCCVs sequenceNumber = do message = None encodedMessage = "" messageId = "" - state = CCIP.SendingMessageV1.SendingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.SendingMessage.SendingMessageState_RequirePoolCCVs testSetOutboundPoolCCVsRejectsTooManyAndExpandedCCVs : Script () testSetOutboundPoolCCVsRejectsTooManyAndExpandedCCVs = script do @@ -381,13 +385,13 @@ testSetOutboundPoolCCVsRejectsTooManyAndExpandedCCVs = script do smTooMany <- mkSendingMessage ccipOwner sender [] 1.0 submitMustFail (actAs ccipOwner) do - exerciseCmd smTooMany CCIP.SendingMessageV1.SetOutboundPoolCCVs with + exerciseCmd smTooMany CCIP.CoreV1.SendingMessage.SetOutboundPoolCCVs with poolCCVs = mkRawCCVs "outbound-pool-ccv-" ccvOwner overMaxCCVCount smExpanded <- mkSendingMessage ccipOwner sender (mkRawCCVs "outbound-default-ccv-" ccvOwner overMaxCCVCount) 2.0 submitMustFail (actAs ccipOwner) do - exerciseCmd smExpanded CCIP.SendingMessageV1.SetOutboundPoolCCVs with - poolCCVs = [CCIP.Internal.useDefaultCCVs] + exerciseCmd smExpanded CCIP.CoreV1.SendingMessage.SetOutboundPoolCCVs with + poolCCVs = [CCIP.CodecV1.CCVCodec.useDefaultCCVs] data ExecuteFixture = ExecuteFixture with @@ -396,24 +400,24 @@ data ExecuteFixture = ExecuteFixture receiver : Party sourceChainSelector : Numeric 0 destChainSelector : Numeric 0 - globalConfig : ContractId CCIP.GlobalConfig.GlobalConfig - offRamp : ContractId CCIP.OffRamp.OffRamp - router : ContractId CCIP.PerPartyRouter.PerPartyRouter - tokenAdminRegistry : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - rmnRemote : ContractId CCIP.RMNRemote.RMNRemote - offRampAddress : RawInstanceAddress.RawInstanceAddress - -executeContext : ExecuteFixture -> MetadataV1.ChoiceContext + globalConfig : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + offRamp : ContractId CCIP.RuntimeV1.OffRamp.OffRamp + router : ContractId CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter + tokenAdminRegistry : ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry + rmnRemote : ContractId CCIP.CoreV1.RMNRemote.RMNRemote + offRampAddress : Chainlink.InstanceAddress.RawInstanceAddress + +executeContext : ExecuteFixture -> Splice.Api.Token.MetadataV1.ChoiceContext executeContext f = - MetadataV1.ChoiceContext with + Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId f.rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId f.tokenAdminRegistry) - , (CCIP.GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) - , (CCIP.OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId f.offRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.tokenAdminRegistry) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) + , (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.offRamp) ] -setupExecuteFixture : Text -> [RawInstanceAddress.RawInstanceAddress] -> Script ExecuteFixture +setupExecuteFixture : Text -> [Chainlink.InstanceAddress.RawInstanceAddress] -> Script ExecuteFixture setupExecuteFixture suffix sourceDefaultCCVs = do ccipOwner <- allocateParty ("ccip-owner-execute-bounds-" <> suffix) rmnOwner <- allocateParty ("rmn-owner-execute-bounds-" <> suffix) @@ -426,16 +430,16 @@ setupExecuteFixture suffix sourceDefaultCCVs = do let routerInstanceId = "router-execute-bounds-" <> suffix let tokenAdminRegistryInstanceId = "tar-execute-bounds-" <> suffix let rmnInstanceId = "rmn-execute-bounds-" <> suffix - let offRampAddress = RawInstanceAddress.make offRampInstanceId ccipOwner + let offRampAddress = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty sourceChainConfigs = Map.fromList - [ (sourceChainSelector, CCIP.GlobalConfig.SourceChainConfig with + [ (sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] defaultCCVs = sourceDefaultCCVs @@ -444,7 +448,7 @@ setupExecuteFixture suffix sourceDefaultCCVs = do ] rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -452,32 +456,32 @@ setupExecuteFixture suffix sourceDefaultCCVs = do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 offRamp <- submit ccipOwner do - createCmd CCIP.OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = CCIP.OffRampTypes.OffRampDeps with - globalConfig = RawInstanceAddress.make globalConfigInstanceId ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with + globalConfig = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner router <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = routerInstanceId ccipOwner = ccipOwner partyOwner = receiver - deps = CCIP.PerPartyRouterTypes.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make ("onramp-unused-execute-bounds-" <> suffix) ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make ("onramp-unused-execute-bounds-" <> suffix) ccipOwner offRamp = offRampAddress - globalConfig = RawInstanceAddress.make globalConfigInstanceId ccipOwner - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - feeQuoter = RawInstanceAddress.make ("feequoter-unused-execute-bounds-" <> suffix) ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner + globalConfig = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make ("feequoter-unused-execute-bounds-" <> suffix) ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner outboundSequenceNumbers = Map.empty executedMessages = Set.empty archivedExecutionContractIds = [] @@ -496,27 +500,27 @@ setupExecuteFixture suffix sourceDefaultCCVs = do rmnRemote offRampAddress -tokenMessage : ExecuteFixture -> CCIP.MessageCodecV1.MessageV1 +tokenMessage : ExecuteFixture -> CCIP.CodecV1.MessageCodecV1.MessageV1 tokenMessage f = - CCIP.MessageCodecV1.MessageV1 with + CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = f.sourceChainSelector destChainSelector = f.destChainSelector sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 0 - finality = CCIP.FinalityConfig.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress f.offRampAddress + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress f.offRampAddress sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress f.receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress f.receiver destBlob = "" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 1.0) + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1.0) sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000005" sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" destTokenAddress = "0000000000000000000000000000000000000000000000000000000000000007" - tokenReceiver = CCIP.MessageCodecV1.encodePartyAddress f.receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress f.receiver extraData = "") messageData = "" @@ -528,7 +532,7 @@ testGetRequiredCCVsForExecuteRejectsTooManyAndExpandedPoolCCVs = script do disclosedGlobalConfig <- fromSome <$> queryDisclosure f.ccipOwner f.globalConfig submitMustFail (actAs f.receiver <> actAs f.ccipOwner <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig) do - exerciseCmd f.router CCIP.PerPartyRouter.GetRequiredCCVsForExecute with + exerciseCmd f.router CCIP.RuntimeV1.PerPartyRouter.GetRequiredCCVsForExecute with context = executeContext f message = tokenMessage f receiverRequiredCCVs = [] @@ -542,47 +546,47 @@ testGetRequiredCCVsForExecuteRejectsTooManyAndExpandedPoolCCVs = script do disclosedExpandedGlobalConfig <- fromSome <$> queryDisclosure expanded.ccipOwner expanded.globalConfig submitMustFail (actAs expanded.receiver <> actAs expanded.ccipOwner <> disclose disclosedExpandedOffRamp <> disclose disclosedExpandedGlobalConfig) do - exerciseCmd expanded.router CCIP.PerPartyRouter.GetRequiredCCVsForExecute with + exerciseCmd expanded.router CCIP.RuntimeV1.PerPartyRouter.GetRequiredCCVsForExecute with context = executeContext expanded message = tokenMessage expanded receiverRequiredCCVs = [] receiverOptionalCCVs = [] receiverOptionalThreshold = 0 - tokenPoolRequiredCCVs = [CCIP.Internal.useDefaultCCVs] + tokenPoolRequiredCCVs = [CCIP.CodecV1.CCVCodec.useDefaultCCVs] mkExecutingMessage : Party -> Party - -> [RawInstanceAddress.RawInstanceAddress] - -> Script (ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1) + -> [Chainlink.InstanceAddress.RawInstanceAddress] + -> Script (ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage) mkExecutingMessage ccipOwner receiver sourceDefaultCCVs = do - let offRampAddress = RawInstanceAddress.make "offramp-inbound-pool-bounds" ccipOwner - let message = CCIP.MessageCodecV1.MessageV1 with + let offRampAddress = Chainlink.InstanceAddress.make "offramp-inbound-pool-bounds" ccipOwner + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 3333333333.0 destChainSelector = 4444444444.0 sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 0 - finality = CCIP.FinalityConfig.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress offRampAddress + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress offRampAddress sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 1.0) + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1.0) sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000005" sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" destTokenAddress = "0000000000000000000000000000000000000000000000000000000000000007" - tokenReceiver = CCIP.MessageCodecV1.encodePartyAddress receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "") messageData = "" submit ccipOwner do - createCmd CCIP.ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message - messageId = keccak256 (CCIP.MessageCodecV1.encodeMessageV1 message) + messageId = keccak256 (CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message) receiver = receiver tokenReceiver = Some receiver executor = receiver @@ -592,15 +596,15 @@ mkExecutingMessage ccipOwner receiver sourceDefaultCCVs = do requiredCCVs = [] optionalCCVs = [] optionalCCVThreshold = 0 - receiverFinalityConfig = CCIP.FinalityConfig.WaitForFinality + receiverFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality sourceDefaultCCVs = sourceDefaultCCVs inboundPoolVerification = None - deps = CCIP.ExecutingMessageV1.ExecutingMessageDeps with - offRamp = RawInstanceAddress.make "offramp-inbound-pool-bounds" ccipOwner - globalConfig = RawInstanceAddress.make "globalconfig-inbound-pool-bounds" ccipOwner - rmnRemote = RawInstanceAddress.make "rmn-inbound-pool-bounds" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "tar-inbound-pool-bounds" ccipOwner - state = CCIP.ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with + offRamp = Chainlink.InstanceAddress.make "offramp-inbound-pool-bounds" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-inbound-pool-bounds" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-inbound-pool-bounds" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-inbound-pool-bounds" ccipOwner + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs testSetInboundPoolCCVsRejectsTooManyAndExpandedCCVs : Script () testSetInboundPoolCCVsRejectsTooManyAndExpandedCCVs = script do @@ -610,14 +614,14 @@ testSetInboundPoolCCVsRejectsTooManyAndExpandedCCVs = script do msgTooMany <- mkExecutingMessage ccipOwner receiver [] submitMustFail (actAs ccipOwner) do - exerciseCmd msgTooMany CCIP.ExecutingMessageV1.SetInboundPoolCCVs with + exerciseCmd msgTooMany CCIP.CoreV1.ExecutingMessage.SetInboundPoolCCVs with poolInstanceId = "pool-inbound-pool-bounds-too-many" poolOwner = ccipOwner poolCCVs = mkRawCCVs "inbound-pool-ccv-" ccvOwner overMaxCCVCount msgExpanded <- mkExecutingMessage ccipOwner receiver (mkRawCCVs "inbound-default-ccv-" ccvOwner overMaxCCVCount) submitMustFail (actAs ccipOwner) do - exerciseCmd msgExpanded CCIP.ExecutingMessageV1.SetInboundPoolCCVs with + exerciseCmd msgExpanded CCIP.CoreV1.ExecutingMessage.SetInboundPoolCCVs with poolInstanceId = "pool-inbound-pool-bounds-expanded" poolOwner = ccipOwner - poolCCVs = [CCIP.Internal.useDefaultCCVs] + poolCCVs = [CCIP.CodecV1.CCVCodec.useDefaultCCVs] diff --git a/contracts/ccip/test/daml/CommitteeVerifier/DummyCommitteeVerifier.daml b/contracts/ccip/test/daml/CommitteeVerifier/DummyCommitteeVerifier.daml index 48db3cfda..db119f12a 100644 --- a/contracts/ccip/test/daml/CommitteeVerifier/DummyCommitteeVerifier.daml +++ b/contracts/ccip/test/daml/CommitteeVerifier/DummyCommitteeVerifier.daml @@ -2,10 +2,14 @@ module CommitteeVerifier.DummyCommitteeVerifier where import DA.Crypto.Text (BytesHex) -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.SendingMessageV1 -import CCIP.Interfaces.CrossChainVerifier -import Chainlink.InstanceAddress (assertValidInstanceId) +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.InterfacesV1.CrossChainVerifier + -- | Dummy version tag for testing dummyVersionTag : BytesHex @@ -22,59 +26,63 @@ template DummyCommitteeVerifier destBytesOverhead : Int where signatory owner - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId - interface instance CCIP.Interfaces.CrossChainVerifier.ICrossChainVerifier for DummyCommitteeVerifier where - view = CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierView with + interface instance CCIP.InterfacesV1.CrossChainVerifier.ICrossChainVerifier for DummyCommitteeVerifier where + view = CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierView with instanceId = instanceId owner = owner ccipOwner = ccipOwner storageLocations = ["ipfs://dummy"] + context = Splice.Api.Token.MetadataV1.emptyChoiceContext crossChainVerifier_verifyMessageImpl self arg = do case arg.verifierResults of "01" -> error "DummyCommitteeVerifier: Simulated verification failure" _ -> do debug "DummyCommitteeVerifier: Simulated successful verification" - exercise arg.executingMessageCid CCIP.ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exercise (coerceContractId arg.executingMessageCid : ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage) CCIP.CoreV1.ExecutingMessage.AddCCVVerification with ccvInstanceId = instanceId versionTag = versionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner crossChainVerifier_calculateFeeImpl _self arg = do - exercise arg.sendingMessageCid CCIP.SendingMessageV1.AddCCVFee with + exercise arg.sendingMessageCid CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = instanceId feeUSDCents = feeUSDCents destGasLimit = destGasLimit destBytesOverhead = destBytesOverhead + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner crossChainVerifier_getFeeImpl _self _arg = do - pure CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierFeeQuote with + pure CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote with ccvInstanceId = instanceId ccvOwner = owner feeUSDCents = feeUSDCents gasForVerification = destGasLimit payloadSizeBytes = destBytesOverhead + context = Splice.Api.Token.MetadataV1.emptyChoiceContext crossChainVerifier_forwardToVerifierImpl self arg = do exercise (fromInterfaceContractId @DummyCommitteeVerifier self) ForwardToVerifier with - sendingMessageCid = arg.sendingMessageCid + sendingMessageCid = coerceContractId arg.sendingMessageCid caller = arg.caller - nonconsuming choice ForwardToVerifier - : ContractId CCIP.SendingMessageV1.SendingMessageV1 + nonconsuming choice ForwardToVerifier : ContractId CCIP.APIV1.SendingMessage.ISendingMessage with - sendingMessageCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 + sendingMessageCid : ContractId CCIP.APIV1.SendingMessage.ISendingMessage caller : Party controller caller do let verifierBlob = versionTag - exercise sendingMessageCid CCIP.SendingMessageV1.AddVerifierData with + exercise sendingMessageCid CCIP.APIV1.SendingMessage.SendingMessage_AddVerifierData with ccvInstanceId = instanceId versionTag = versionTag verifierBlob = verifierBlob messageSentObservers = [owner] + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner diff --git a/contracts/ccip/test/daml/CommitteeVerifier/PayloadBuilder.daml b/contracts/ccip/test/daml/CommitteeVerifier/PayloadBuilder.daml index c3ee2f957..e24b94ada 100644 --- a/contracts/ccip/test/daml/CommitteeVerifier/PayloadBuilder.daml +++ b/contracts/ccip/test/daml/CommitteeVerifier/PayloadBuilder.daml @@ -4,23 +4,24 @@ import DA.Crypto.Text (BytesHex, byteCount) import DA.List ((!!)) import DA.Optional (fromSome, fromSomeNote) -import qualified CCIP.FinalityConfig -import qualified CCIP.MessageCodecV1 -import qualified CCIP.CommitteeVerifier -unsafeDecodeRequestedFinality : BytesHex -> CCIP.FinalityConfig.DecodedFinality +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CommitteeVerifierV1 + +unsafeDecodeRequestedFinality : BytesHex -> CCIP.CodecV1.FinalityConfig.DecodedFinality unsafeDecodeRequestedFinality finalityConfig = fromSomeNote "unsafeDecodeRequestedFinality: invalid finality config" - (CCIP.FinalityConfig.decodeRequestedFinality finalityConfig) + (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalityConfig) -blockDepthFinalityConfig : Int -> CCIP.FinalityConfig.DecodedFinality +blockDepthFinalityConfig : Int -> CCIP.CodecV1.FinalityConfig.DecodedFinality blockDepthFinalityConfig n = unsafeDecodeRequestedFinality (fromSome do - flagsHex <- CCIP.MessageCodecV1.encodeUint16 0 - blockConfirmationsHex <- CCIP.MessageCodecV1.encodeUint16 n + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 n pure (flagsHex <> blockConfirmationsHex)) -testMessage1 : CCIP.MessageCodecV1.MessageV1 -testMessage1 = CCIP.MessageCodecV1.MessageV1 with +testMessage1 : CCIP.CodecV1.MessageCodecV1.MessageV1 +testMessage1 = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 123.0 destChainSelector = 456.0 sequenceNumber = 789.0 @@ -33,8 +34,8 @@ testMessage1 = CCIP.MessageCodecV1.MessageV1 with sender = "CD1722F3947DEf4Cf144679Da39c4c32BDC35681" receiver = "B6D4805bf6943c5875C0C7b67EDa24b2bDACBF6e" destBlob = "636f6d706c65782064657374696e6174696f6e20626c6f62" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 1000000.0) + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1000000.0) sourcePoolAddress = "ed3ee8542acd9e483c658350ad4984483eb0afdc" sourceTokenAddress = "c283f6085a391df8e3f78ddc49c6b47016122838" destTokenAddress = "c22ff98123e0785520915c5bd97e83ac649180a1" @@ -43,7 +44,7 @@ testMessage1 = CCIP.MessageCodecV1.MessageV1 with messageData = "6d657373616765207769746820746f6b656e2064617461" testMessage1Encoded : BytesHex -testMessage1Encoded = CCIP.MessageCodecV1.encodeMessageV1 testMessage1 +testMessage1Encoded = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 testMessage1 -- Predefined keys and signatures for testing -- To generate: go run scripts/gen_test_signatures/main.go @@ -129,6 +130,6 @@ getVerifierResultsForIndices indices = let signatures = map (\i -> rValues !! i <> sValues !! i) indices concatenatedSignatures = foldl (<>) "" signatures signatureLength = byteCount concatenatedSignatures - in CCIP.CommitteeVerifier.versionTagV2_0_0 - <> fromSome(CCIP.MessageCodecV1.encodeUint16 signatureLength) + in CCIP.CommitteeVerifierV1.versionTagV2_0_0 + <> fromSome(CCIP.CodecV1.MessageCodecV1.encodeUint16 signatureLength) <> concatenatedSignatures diff --git a/contracts/ccip/test/daml/CommitteeVerifier/Test.daml b/contracts/ccip/test/daml/CommitteeVerifier/Test.daml index 59d8e6bb5..a19cac06c 100644 --- a/contracts/ccip/test/daml/CommitteeVerifier/Test.daml +++ b/contracts/ccip/test/daml/CommitteeVerifier/Test.daml @@ -10,29 +10,31 @@ import DA.Map qualified as Map import DA.Optional (fromSome) import DA.Text qualified as Text -import CCIP.CommitteeVerifier qualified as CommitteeVerifier -import qualified CCIP.ExecutingMessageV1 -import CCIP.SendingMessageV1 qualified as SendingMessageV1 -import CCIP.FinalityConfig qualified as FinalityCodec -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.RMNRemote qualified as RMNRemote - -import CommitteeVerifier.PayloadBuilder qualified as PayloadBuilder - import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.HoldingV1 +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CommitteeVerifierV1 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CoreV1.SendingMessage + +import qualified CCIP.CoreV1.RMNRemote + +import CommitteeVerifier.PayloadBuilder qualified as PayloadBuilder + finalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n --- | Helper to create a fresh ExecutingMessageV1 for each test. +-- | Helper to create a fresh ExecutingMessage for each test. -- AddCCVVerification is a consuming choice, so each successful verify -- consumes the contract. -createExecMsg : Party -> Party -> Script (ContractId CCIP.ExecutingMessageV1.ExecutingMessageV1) +createExecMsg : Party -> Party -> Script (ContractId CCIP.CoreV1.ExecutingMessage.ExecutingMessage) createExecMsg owner rmnOwner = submit owner do - createCmd CCIP.ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = owner message = PayloadBuilder.testMessage1 messageId = keccak256 PayloadBuilder.testMessage1Encoded @@ -43,28 +45,28 @@ createExecMsg owner rmnOwner = submit owner do ccvVerifications = [] ccvOwners = [] requiredCCVs = - [ RawInstanceAddress.make "test-ccv1" owner - , RawInstanceAddress.make "test-ccv2" owner - , RawInstanceAddress.make "test-ccv3" owner - , RawInstanceAddress.make "test-ccv4" owner - , RawInstanceAddress.make "test-ccv5" owner - , RawInstanceAddress.make "test-ccv6" owner - , RawInstanceAddress.make "test-ccv7" owner - , RawInstanceAddress.make "test-ccv8" owner - , RawInstanceAddress.make "test-ccv9" owner - , RawInstanceAddress.make "test-ccv10" owner + [ Chainlink.InstanceAddress.make "test-ccv1" owner + , Chainlink.InstanceAddress.make "test-ccv2" owner + , Chainlink.InstanceAddress.make "test-ccv3" owner + , Chainlink.InstanceAddress.make "test-ccv4" owner + , Chainlink.InstanceAddress.make "test-ccv5" owner + , Chainlink.InstanceAddress.make "test-ccv6" owner + , Chainlink.InstanceAddress.make "test-ccv7" owner + , Chainlink.InstanceAddress.make "test-ccv8" owner + , Chainlink.InstanceAddress.make "test-ccv9" owner + , Chainlink.InstanceAddress.make "test-ccv10" owner ] optionalCCVs = [] optionalCCVThreshold = 0 receiverFinalityConfig = finalityConfig 0 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = CCIP.ExecutingMessageV1.ExecutingMessageDeps with - offRamp = RawInstanceAddress.make "test-offramp" owner - globalConfig = RawInstanceAddress.make "test-globalconfig" owner - rmnRemote = RawInstanceAddress.make "test-rmn" rmnOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tar" owner - state = CCIP.ExecutingMessageV1.ExecutingMessageState_Prepared + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with + offRamp = Chainlink.InstanceAddress.make "test-offramp" owner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig" owner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn" rmnOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tar" owner + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_Prepared testCommitteeVerifier : Script () testCommitteeVerifier = script do @@ -76,14 +78,14 @@ testCommitteeVerifier = script do debug ("encodedMsg: " <> encodedMsg) let messageId = keccak256 encodedMsg debug ("messageId: " <> messageId) - let signedHash = keccak256 (CommitteeVerifier.versionTagV2_0_0 <> messageId) + let signedHash = keccak256 (CCIP.CommitteeVerifierV1.versionTagV2_0_0 <> messageId) debug ("signedHash: " <> signedHash) let rmnInstanceId = "test-rmn" - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = owner @@ -95,7 +97,7 @@ testCommitteeVerifier = script do -- Validate signatures individually executingMessageCid <- createExecMsg owner rmnOwner forA_ (zip3 PayloadBuilder.pubkeys PayloadBuilder.rValues PayloadBuilder.sValues) \(pubKey, r, s) -> do - let verified = CommitteeVerifier.validateSignature signedHash pubKey r s + let verified = CCIP.CommitteeVerifierV1.validateSignature signedHash pubKey r s assertMsg ("Signature verification failed for index " <> (show pubKey)) verified debug ("===== Test1 =====") @@ -105,24 +107,24 @@ testCommitteeVerifier = script do let pubKeys1 = PayloadBuilder.getPubkeysForIndices indices1 let verifierResults1 = PayloadBuilder.getVerifierResultsForIndices indices1 ccv1 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv1" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = Some owner messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = pubKeys1)] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = pubKeys1)] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submit (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv1 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv1 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = verifierResults1 caller = owner debug ("===== Passed Test1 =====") @@ -134,24 +136,24 @@ testCommitteeVerifier = script do let pubKeys2 = PayloadBuilder.getPubkeysForIndices indices2 let verifierResults2 = PayloadBuilder.getVerifierResultsForIndices indices2 ccv2 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv2" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [] -- test that empty observers list works, we will still observe via the ccvOwners storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 3, signerKeys = pubKeys2)] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 3, signerKeys = pubKeys2)] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submit (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv2 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv2 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = verifierResults2 caller = owner debug ("===== Passed Test2 =====") @@ -162,19 +164,19 @@ testCommitteeVerifier = script do let pubKeys3 = PayloadBuilder.getPubkeysForIndices indices3 let verifierResults3 = PayloadBuilder.getVerifierResultsForIndices indices3 ccv3 <- submitMustFail owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv3" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 20, signerKeys = pubKeys3)] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 20, signerKeys = pubKeys3)] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress debug ("===== Passed Test3 =====") debug ("===== Test4 =====") @@ -183,24 +185,24 @@ testCommitteeVerifier = script do let pubKeys4 = PayloadBuilder.getPubkeysForIndices [0, 2, 4, 6, 8, 10] let verifierResults4 = PayloadBuilder.getVerifierResultsForIndices [0, 1, 2, 3, 4, 5] ccv4 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv4" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 3, signerKeys = pubKeys4)] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 3, signerKeys = pubKeys4)] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submitMustFail (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv4 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv4 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = verifierResults4 caller = owner debug ("===== Passed Test4 =====") @@ -210,24 +212,24 @@ testCommitteeVerifier = script do let pubKeys5 = PayloadBuilder.getPubkeysForIndices [0, 1, 2, 3, 4] let verifierResults5 = PayloadBuilder.getVerifierResultsForIndices [5, 6, 7, 8, 9] ccv5 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv5" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 4, signerKeys = pubKeys5)] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 4, signerKeys = pubKeys5)] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submitMustFail (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv5 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv5 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = verifierResults5 caller = owner debug ("===== Passed Test5 =====") @@ -237,24 +239,24 @@ testCommitteeVerifier = script do let pubKeys6 = PayloadBuilder.getPubkeysForIndices [0, 1, 2] let verifierResults6 = PayloadBuilder.getVerifierResultsForIndices [0, 1, 2, 0] ccv6 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv6" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 3, signerKeys = pubKeys6)] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 3, signerKeys = pubKeys6)] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submitMustFail (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv6 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv6 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = verifierResults6 caller = owner debug ("===== Passed Test6 =====") @@ -262,83 +264,83 @@ testCommitteeVerifier = script do debug ("===== Test7 =====") -- try to create without any signers, should fail ccv7 <- submitMustFail owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv7" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 0, signerKeys = [])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 0, signerKeys = [])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress debug ("===== Passed Test7 =====") debug ("===== Test8 =====") -- try to create without a storage location, should succeed ccv8 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv8" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = [] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = PayloadBuilder.getPubkeysForIndices [0])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = PayloadBuilder.getPubkeysForIndices [0])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress debug ("===== Passed Test8 =====") debug ("===== Test9 =====") -- pass invalid verifierResults let pubKeys9 = PayloadBuilder.getPubkeysForIndices [0, 1, 2] ccv9 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv9" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 2, signerKeys = pubKeys9)] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 2, signerKeys = pubKeys9)] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submitMustFail (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv9 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv9 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = "01234567" <> -- invalid version tag "0004" <> -- signature length too long "deadbeef" -- invalid signature data caller = owner submitMustFail (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv9 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv9 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = - CommitteeVerifier.versionTagV2_0_0 <> -- version tag + CCIP.CommitteeVerifierV1.versionTagV2_0_0 <> -- version tag "ffff" <> -- signature length too long "deadbeef" -- invalid signature data caller = owner submitMustFail (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv9 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv9 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = - CommitteeVerifier.versionTagV2_0_0 <> -- version tag + CCIP.CommitteeVerifierV1.versionTagV2_0_0 <> -- version tag "0001" <> -- signature length too short "deadbeef" -- invalid signature data caller = owner @@ -350,55 +352,55 @@ testCommitteeVerifier = script do -- multiple signers, threshold 3 executingMessageCid <- createExecMsg owner rmnOwner ccv10 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv10" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 3, signerKeys = PayloadBuilder.getPubkeysForIndices [0, 1, 2, 3])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 3, signerKeys = PayloadBuilder.getPubkeysForIndices [0, 1, 2, 3])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submit (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv10 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv10 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = PayloadBuilder.getVerifierResultsForIndices [0, 1, 2] caller = owner -- Update signer config to 6, should fail due to threshold > number of signers submitMustFail owner do - exerciseCmd ccv10 CommitteeVerifier.ApplySignatureConfigs with + exerciseCmd ccv10 CCIP.CommitteeVerifierV1.ApplySignatureConfigs with sourceChainSelectorsToRemove = [] - signatureConfigs = [CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 6, signerKeys = PayloadBuilder.getPubkeysForIndices [0, 1, 2, 3, 4]] + signatureConfigs = [CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 6, signerKeys = PayloadBuilder.getPubkeysForIndices [0, 1, 2, 3, 4]] -- Update signers to 6 addresses and threshold 6, should pass ccv10 <- submit owner do - exerciseCmd ccv10 CommitteeVerifier.ApplySignatureConfigs with + exerciseCmd ccv10 CCIP.CommitteeVerifierV1.ApplySignatureConfigs with sourceChainSelectorsToRemove = [] - signatureConfigs = [CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 6, signerKeys = PayloadBuilder.getPubkeysForIndices [0, 1, 2, 3, 4, 5]] + signatureConfigs = [CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 6, signerKeys = PayloadBuilder.getPubkeysForIndices [0, 1, 2, 3, 4, 5]] executingMessageCid <- createExecMsg owner rmnOwner submit (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv10 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv10 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = PayloadBuilder.getVerifierResultsForIndices [0, 1, 2, 3, 4, 5] caller = owner -- Remove source chain config, afterward verification should fail ccv10 <- submit owner do - exerciseCmd ccv10 CommitteeVerifier.ApplySignatureConfigs with + exerciseCmd ccv10 CCIP.CommitteeVerifierV1.ApplySignatureConfigs with sourceChainSelectorsToRemove = [123.0] signatureConfigs = [] executingMessageCid <- createExecMsg owner rmnOwner submitMustFail (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccv10 CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccv10 CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = PayloadBuilder.getVerifierResultsForIndices [0, 1, 2, 3, 4, 5] caller = owner debug ("===== Passed Test10 =====") @@ -406,54 +408,54 @@ testCommitteeVerifier = script do debug ("===== Test10b =====") -- mismatched map key vs embedded sourceChainSelector should be rejected at creation time submitMustFail owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv10b-mismatch" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = [] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(456.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [head PayloadBuilder.pubkeys])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(456.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [head PayloadBuilder.pubkeys])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- duplicate signer keys should be rejected at creation time submitMustFail owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv10b" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 2, signerKeys = [head PayloadBuilder.pubkeys, head PayloadBuilder.pubkeys])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 2, signerKeys = [head PayloadBuilder.pubkeys, head PayloadBuilder.pubkeys])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- duplicate signer keys should be rejected on config updates as well ccv10b <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv10c" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [head PayloadBuilder.pubkeys])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [head PayloadBuilder.pubkeys])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submitMustFail owner do - exerciseCmd ccv10b CommitteeVerifier.ApplySignatureConfigs with + exerciseCmd ccv10b CCIP.CommitteeVerifierV1.ApplySignatureConfigs with sourceChainSelectorsToRemove = [] - signatureConfigs = [CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 2, signerKeys = [head PayloadBuilder.pubkeys, head PayloadBuilder.pubkeys]] + signatureConfigs = [CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 2, signerKeys = [head PayloadBuilder.pubkeys, head PayloadBuilder.pubkeys]] debug ("===== Passed Test10b =====") debug ("===== Test11: Malformed keys rejected at config time =====") @@ -462,55 +464,55 @@ testCommitteeVerifier = script do -- short key rejected at create time submitMustFail owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv11a" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [shortKey])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [shortKey])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- wrong-prefix key (65 bytes, not starting with 04) rejected at create time submitMustFail owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv11b" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [wrongPrefixKey])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [wrongPrefixKey])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- malformed key rejected at ApplySignatureConfigs time ccv11c <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv11c" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = ["ipfs://example"] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [head PayloadBuilder.pubkeys])] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [head PayloadBuilder.pubkeys])] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submitMustFail owner do - exerciseCmd ccv11c CommitteeVerifier.ApplySignatureConfigs with + exerciseCmd ccv11c CCIP.CommitteeVerifierV1.ApplySignatureConfigs with sourceChainSelectorsToRemove = [] - signatureConfigs = [CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [shortKey]] + signatureConfigs = [CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = [shortKey]] debug ("===== Passed Test11 =====") debug ("===== All Tests Passed =====") @@ -524,14 +526,14 @@ testCommitteeVerifier_StorageLocations = script do admin <- allocateParty "ccv-storage-locations-admin" let rmnInstanceId = "test-rmn" - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId owner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId owner ccv1 <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv1" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = [] @@ -539,30 +541,30 @@ testCommitteeVerifier_StorageLocations = script do pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty signerConfigs = Map.empty - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- Transfer storage location admin role to another party ccv1 <- submit owner do - exerciseCmd ccv1 CommitteeVerifier.TransferStorageLocationsAdmin with + exerciseCmd ccv1 CCIP.CommitteeVerifierV1.TransferStorageLocationsAdmin with newAdmin = admin -- Accept admin role from wrong party, should fail submitMustFail owner do - exerciseCmd ccv1 CommitteeVerifier.AcceptStorageLocationsAdmin + exerciseCmd ccv1 CCIP.CommitteeVerifierV1.AcceptStorageLocationsAdmin -- Accept admin role ccv1 <- submit admin do - exerciseCmd ccv1 CommitteeVerifier.AcceptStorageLocationsAdmin + exerciseCmd ccv1 CCIP.CommitteeVerifierV1.AcceptStorageLocationsAdmin let newLocations = ["ipfs://new-location1", "ipfs://new-location2"] -- Update storage locations with new admin, should succeed ccv1 <- submit admin do - exerciseCmd ccv1 CommitteeVerifier.UpdateStorageLocations with + exerciseCmd ccv1 CCIP.CommitteeVerifierV1.UpdateStorageLocations with newLocations = newLocations -- Try updating storage locations with old admin, should fail submitMustFail owner do - exerciseCmd ccv1 CommitteeVerifier.UpdateStorageLocations with + exerciseCmd ccv1 CCIP.CommitteeVerifierV1.UpdateStorageLocations with newLocations = ["ipfs://another-location"] -- Fetch contract and verify storage locations updated @@ -578,21 +580,21 @@ testCommitteeVerifier_ApplyRemoteChainConfigs = script do allowedParty2 <- allocateParty "allowed-party-2" let rmnInstanceId = "test-rmn" - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId owner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId owner ccvCid <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv1" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = [] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.fromList [ - (123.0, CommitteeVerifier.RemoteChainConfig with + (123.0, CCIP.CommitteeVerifierV1.RemoteChainConfig with feeUSDCents = 50.0, gasForVerification = 1000, payloadSizeBytes = 100, @@ -600,23 +602,23 @@ testCommitteeVerifier_ApplyRemoteChainConfigs = script do allowedSendersList = [allowedParty1, allowedParty2]) ] signerConfigs = Map.empty - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- | Test adding remote chain configs - let configArgs123 = CommitteeVerifier.RemoteChainConfigArgs with + let configArgs123 = CCIP.CommitteeVerifierV1.RemoteChainConfigArgs with remoteChainSelector = 123.0 feeUSDCents = 100.0 gasForVerification = 5000 payloadSizeBytes = 200 allowListEnabled = False - let configArgs456 = CommitteeVerifier.RemoteChainConfigArgs with + let configArgs456 = CCIP.CommitteeVerifierV1.RemoteChainConfigArgs with remoteChainSelector = 456.0 feeUSDCents = 200.0 gasForVerification = 10000 payloadSizeBytes = 250 allowListEnabled = True ccvCid <- submit owner do - exerciseCmd ccvCid CommitteeVerifier.ApplyRemoteChainConfigUpdates with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyRemoteChainConfigUpdates with remoteChainConfigArgs = [configArgs123, configArgs456] gotCCV <- fromSome <$> queryContractId owner ccvCid assertMsg "Expected 2 remote chain configs" (Map.size gotCCV.remoteChainConfigs == 2) @@ -639,8 +641,8 @@ testCommitteeVerifier_ApplyRemoteChainConfigs = script do -- Test invalid chain selector submitMustFail owner do - exerciseCmd ccvCid CommitteeVerifier.ApplyRemoteChainConfigUpdates with - remoteChainConfigArgs = [CommitteeVerifier.RemoteChainConfigArgs with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyRemoteChainConfigUpdates with + remoteChainConfigArgs = [CCIP.CommitteeVerifierV1.RemoteChainConfigArgs with remoteChainSelector = -1.0 feeUSDCents = 100.0 gasForVerification = 5000 @@ -649,8 +651,8 @@ testCommitteeVerifier_ApplyRemoteChainConfigs = script do -- Test invalid gas for verification submitMustFail owner do - exerciseCmd ccvCid CommitteeVerifier.ApplyRemoteChainConfigUpdates with - remoteChainConfigArgs = [CommitteeVerifier.RemoteChainConfigArgs with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyRemoteChainConfigUpdates with + remoteChainConfigArgs = [CCIP.CommitteeVerifierV1.RemoteChainConfigArgs with remoteChainSelector = 123.0 feeUSDCents = 100.0 gasForVerification = 0 @@ -659,8 +661,8 @@ testCommitteeVerifier_ApplyRemoteChainConfigs = script do -- Test invalid negative payload size submitMustFail owner do - exerciseCmd ccvCid CommitteeVerifier.ApplyRemoteChainConfigUpdates with - remoteChainConfigArgs = [CommitteeVerifier.RemoteChainConfigArgs with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyRemoteChainConfigUpdates with + remoteChainConfigArgs = [CCIP.CommitteeVerifierV1.RemoteChainConfigArgs with remoteChainSelector = 123.0 feeUSDCents = 100.0 gasForVerification = 5000 @@ -669,8 +671,8 @@ testCommitteeVerifier_ApplyRemoteChainConfigs = script do -- Negative verifier fee fields are rejected. submitMustFail owner do - exerciseCmd ccvCid CommitteeVerifier.ApplyRemoteChainConfigUpdates with - remoteChainConfigArgs = [CommitteeVerifier.RemoteChainConfigArgs with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyRemoteChainConfigUpdates with + remoteChainConfigArgs = [CCIP.CommitteeVerifierV1.RemoteChainConfigArgs with remoteChainSelector = 123.0 feeUSDCents = -1.0 gasForVerification = 5000 @@ -688,21 +690,21 @@ testCommitteeVerifier_ApplyAllowListUpdates = script do allowedParty3 <- allocateParty "allowed-party-3" let rmnInstanceId = "test-rmn" - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId owner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId owner ccvCid <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv1" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = Some admin messageSentObservers = [owner] storageLocations = [] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.fromList [ - (123.0, CommitteeVerifier.RemoteChainConfig with + (123.0, CCIP.CommitteeVerifierV1.RemoteChainConfig with feeUSDCents = 50.0, gasForVerification = 1000, payloadSizeBytes = 100, @@ -710,13 +712,13 @@ testCommitteeVerifier_ApplyAllowListUpdates = script do allowedSendersList = [allowedParty1, allowedParty2]) ] signerConfigs = Map.empty - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- Test updating allow list as owner ccvCid <- submit owner do - exerciseCmd ccvCid CommitteeVerifier.ApplyAllowListUpdates with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyAllowListUpdates with allowListConfigArgsItems = [ - CommitteeVerifier.AllowListConfigArgs with + CCIP.CommitteeVerifierV1.AllowListConfigArgs with destChainSelector = 123.0 allowListEnabled = True addedAllowListedSenders = [allowedParty1, allowedParty3] -- party1 is already in the list, party3 is new @@ -732,9 +734,9 @@ testCommitteeVerifier_ApplyAllowListUpdates = script do -- Test updating allow list for a non-existing chain selector, should add new config with allow list enabled and only the added senders in the list ccvCid <- submit owner do - exerciseCmd ccvCid CommitteeVerifier.ApplyAllowListUpdates with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyAllowListUpdates with allowListConfigArgsItems = [ - CommitteeVerifier.AllowListConfigArgs with + CCIP.CommitteeVerifierV1.AllowListConfigArgs with destChainSelector = 456.0 allowListEnabled = True addedAllowListedSenders = [allowedParty2] @@ -753,9 +755,9 @@ testCommitteeVerifier_ApplyAllowListUpdates = script do -- Test updating allow list as allow list admin ccvCid <- submit admin do - exerciseCmd ccvCid CommitteeVerifier.ApplyAllowListUpdates with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyAllowListUpdates with allowListConfigArgsItems = [ - CommitteeVerifier.AllowListConfigArgs with + CCIP.CommitteeVerifierV1.AllowListConfigArgs with destChainSelector = 123.0 allowListEnabled = False addedAllowListedSenders = [] @@ -771,9 +773,9 @@ testCommitteeVerifier_ApplyAllowListUpdates = script do -- Test updating allow list with invalid dest chain selector submitMustFail admin do - exerciseCmd ccvCid CommitteeVerifier.ApplyAllowListUpdates with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyAllowListUpdates with allowListConfigArgsItems = [ - CommitteeVerifier.AllowListConfigArgs with + CCIP.CommitteeVerifierV1.AllowListConfigArgs with destChainSelector = -1.0 allowListEnabled = False addedAllowListedSenders = [] @@ -783,9 +785,9 @@ testCommitteeVerifier_ApplyAllowListUpdates = script do -- Test invalid update (cannot set to false and add allowed senders at the same time) submitMustFail admin do - exerciseCmd ccvCid CommitteeVerifier.ApplyAllowListUpdates with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ApplyAllowListUpdates with allowListConfigArgsItems = [ - CommitteeVerifier.AllowListConfigArgs with + CCIP.CommitteeVerifierV1.AllowListConfigArgs with destChainSelector = 123.0 allowListEnabled = False addedAllowListedSenders = [allowedParty1] @@ -801,14 +803,14 @@ testCommitteeVerifier_SetDynamicConfig = script do admin <- allocateParty "ccv-dynamic-config-admin" let rmnInstanceId = "test-rmn" - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId owner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId owner ccvCid <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv1" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = [] @@ -816,12 +818,12 @@ testCommitteeVerifier_SetDynamicConfig = script do pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty signerConfigs = Map.empty - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- Test updating dynamic config as owner ccvCid <- submit owner do - exerciseCmd ccvCid CommitteeVerifier.SetDynamicConfig with - dynamicConfig = CommitteeVerifier.DynamicConfig with + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.SetDynamicConfig with + dynamicConfig = CCIP.CommitteeVerifierV1.DynamicConfig with allowListAdmin = Some admin messageSentObservers = [owner, admin] @@ -831,7 +833,7 @@ testCommitteeVerifier_SetDynamicConfig = script do pure () --- VerifyMessage must reject an ExecutingMessageV1 whose ccipOwner differs +-- VerifyMessage must reject an ExecutingMessage whose ccipOwner differs -- from the verifier's, otherwise a verification produced under one ccipOwner domain could -- satisfy another domain's required verifier set because AddCCVVerification only records -- (ccvInstanceId, ccvOwner) without the ccipOwner. @@ -842,10 +844,10 @@ testVerifyMessage_RejectsCrossDomainExecutingMessage = script do rmnOwner <- allocateParty "rmn-owner" let rmnInstanceId = "test-rmn" - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = owner @@ -854,7 +856,7 @@ testVerifyMessage_RejectsCrossDomainExecutingMessage = script do disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote - -- ExecutingMessageV1 is under `owner`'s ccipOwner domain. + -- ExecutingMessage is under `owner`'s ccipOwner domain. executingMessageCid <- createExecMsg owner rmnOwner let indices = [0] @@ -863,25 +865,25 @@ testVerifyMessage_RejectsCrossDomainExecutingMessage = script do -- Verifier is under a DIFFERENT ccipOwner domain. ccvCid <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv-cross-domain" owner = owner ccipOwner = otherCcipOwner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [owner] storageLocations = [] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty - signerConfigs = Map.fromList [(123.0, CommitteeVerifier.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = pubKeys)] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + signerConfigs = Map.fromList [(123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = 1, signerKeys = pubKeys)] + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submitMustFail (actAs owner <> disclose disclosedRmnRemote) do - exerciseCmd ccvCid CommitteeVerifier.VerifyMessage with - rmnRemoteCid = rmnRemote - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.VerifyMessage with + rmnRemoteCid = toInterfaceContractId rmnRemote + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid verifierResults = verifierResults caller = owner @@ -899,18 +901,18 @@ syntheticCommitteePubKey i = testCommitteeVerifier_MaxSignaturesPerProofThreshold : Script () testCommitteeVerifier_MaxSignaturesPerProofThreshold = script do owner <- allocateParty "cv-max-threshold-owner" - let rmnRemoteInstanceAddress = RawInstanceAddress.make "test-rmn" owner - let n = CommitteeVerifier.maxCommitteeSignaturesPerProof + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make "test-rmn" owner + let n = CCIP.CommitteeVerifierV1.maxCommitteeSignaturesPerProof let keysN = map syntheticCommitteePubKey [0 .. (n - 1)] let keysNPlus1 = map syntheticCommitteePubKey [0 .. n] -- At the cap: create and update succeed. ccvOk <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv-max-threshold-ok" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [] storageLocations = [] @@ -918,25 +920,25 @@ testCommitteeVerifier_MaxSignaturesPerProofThreshold = script do pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty signerConfigs = Map.fromList [ - (123.0, CommitteeVerifier.SignatureConfig with + (123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = n, signerKeys = keysN) ] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress _ <- submit owner do - exerciseCmd ccvOk CommitteeVerifier.ApplySignatureConfigs with + exerciseCmd ccvOk CCIP.CommitteeVerifierV1.ApplySignatureConfigs with sourceChainSelectorsToRemove = [] signatureConfigs = [ - CommitteeVerifier.SignatureConfig with + CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 456.0, threshold = n, signerKeys = keysN ] -- One past the cap: create fails. submitMustFail owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv-max-threshold-bad-create" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [] storageLocations = [] @@ -944,18 +946,18 @@ testCommitteeVerifier_MaxSignaturesPerProofThreshold = script do pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty signerConfigs = Map.fromList [ - (123.0, CommitteeVerifier.SignatureConfig with + (123.0, CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 123.0, threshold = n + 1, signerKeys = keysNPlus1) ] - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress -- One past the cap: ApplySignatureConfigs fails. ccvUpd <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "test-ccv-max-threshold-bad-update" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 allowListAdmin = None messageSentObservers = [] storageLocations = [] @@ -963,12 +965,12 @@ testCommitteeVerifier_MaxSignaturesPerProofThreshold = script do pendingStorageLocationsAdmin = owner remoteChainConfigs = Map.empty signerConfigs = Map.empty - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress submitMustFail owner do - exerciseCmd ccvUpd CommitteeVerifier.ApplySignatureConfigs with + exerciseCmd ccvUpd CCIP.CommitteeVerifierV1.ApplySignatureConfigs with sourceChainSelectorsToRemove = [] signatureConfigs = [ - CommitteeVerifier.SignatureConfig with + CCIP.CommitteeVerifierV1.SignatureConfig with sourceChainSelector = 789.0, threshold = n + 1, signerKeys = keysNPlus1 ] @@ -981,17 +983,17 @@ testForwardToVerifier_AllowlistChecksSender = script do nonAllowlistedSender <- allocateParty "nonAllowlistedSender" let destChainSelector = 1.0 : Numeric 0 - rmnRemoteInstanceAddress = RawInstanceAddress.make "rmnRemote" owner + rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make "rmnRemote" owner rmnRemoteCid <- submit owner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "rmnRemote" rmnOwner = owner ccipOwner = owner customObservers = [allowlistedParty, nonAllowlistedSender] cursedSubjects = [] - let remoteChainConfig = CommitteeVerifier.RemoteChainConfig with + let remoteChainConfig = CCIP.CommitteeVerifierV1.RemoteChainConfig with feeUSDCents = 0.0 gasForVerification = 0 payloadSizeBytes = 0 @@ -999,11 +1001,11 @@ testForwardToVerifier_AllowlistChecksSender = script do allowedSendersList = [allowlistedParty] ccvCid <- submit owner do - createCmd CommitteeVerifier.CommitteeVerifier with + createCmd CCIP.CommitteeVerifierV1.CommitteeVerifier with instanceId = "ccv1" owner = owner ccipOwner = owner - versionTag = CommitteeVerifier.versionTagV2_0_0 + versionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 remoteChainConfigs = Map.fromList [(destChainSelector, remoteChainConfig)] signerConfigs = Map.empty allowListAdmin = None @@ -1011,19 +1013,19 @@ testForwardToVerifier_AllowlistChecksSender = script do storageLocations = [] storageLocationsAdmin = owner pendingStorageLocationsAdmin = owner - deps = CommitteeVerifier.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress + deps = CCIP.CommitteeVerifierV1.CommitteeVerifierDeps with rmnRemote = rmnRemoteInstanceAddress - let sendingMsgDeps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router" owner - onRamp = RawInstanceAddress.make "onRamp" owner - globalConfig = RawInstanceAddress.make "globalConfig" owner + let sendingMsgDeps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router" owner + onRamp = Chainlink.InstanceAddress.make "onRamp" owner + globalConfig = Chainlink.InstanceAddress.make "globalConfig" owner rmnRemote = rmnRemoteInstanceAddress - tokenAdminRegistry = RawInstanceAddress.make "tokenAdminRegistry" owner - feeQuoter = RawInstanceAddress.make "feeQuoter" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tokenAdminRegistry" owner + feeQuoter = Chainlink.InstanceAddress.make "feeQuoter" owner let feeToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner; id = "feeToken" - ccvAddress = RawInstanceAddress.make "ccv1" owner - mkSendingMsg senderParty seqNum msgId = SendingMessageV1.SendingMessageV1 with + ccvAddress = Chainlink.InstanceAddress.make "ccv1" owner + mkSendingMsg senderParty seqNum msgId = CCIP.CoreV1.SendingMessage.SendingMessage with deps = sendingMsgDeps ccipOwner = owner sender = senderParty @@ -1049,6 +1051,7 @@ testForwardToVerifier_AllowlistChecksSender = script do feeToken = feeToken networkFeeUSDCents = 0.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -1067,7 +1070,7 @@ testForwardToVerifier_AllowlistChecksSender = script do message = None encodedMessage = "" messageId = msgId - state = SendingMessageV1.SendingMessageState_FeeFinalized + state = CCIP.CoreV1.SendingMessage.SendingMessageState_FeeFinalized -- Message from non-allowlisted sender nonAllowlistedMsgCid <- submit owner do @@ -1079,10 +1082,10 @@ testForwardToVerifier_AllowlistChecksSender = script do -- Allowlisted party calls ForwardToVerifier for non-allowlisted sender's message → should FAIL submitMustFail (actAs allowlistedParty <> disclose disclosedCcv <> disclose disclosedRmn) do - exerciseCmd ccvCid CommitteeVerifier.ForwardToVerifier with - rmnRemoteCid = rmnRemoteCid - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - sendingMessageCid = nonAllowlistedMsgCid + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ForwardToVerifier with + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + sendingMessageCid = toInterfaceContractId nonAllowlistedMsgCid verifierArgs = "" caller = allowlistedParty @@ -1092,10 +1095,10 @@ testForwardToVerifier_AllowlistChecksSender = script do -- Allowlisted sender's message via ForwardToVerifier → should SUCCEED submit (actAs allowlistedParty <> disclose disclosedCcv <> disclose disclosedRmn) do - exerciseCmd ccvCid CommitteeVerifier.ForwardToVerifier with - rmnRemoteCid = rmnRemoteCid - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext - sendingMessageCid = allowlistedMsgCid + exerciseCmd ccvCid CCIP.CommitteeVerifierV1.ForwardToVerifier with + rmnRemoteCid = toInterfaceContractId rmnRemoteCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + sendingMessageCid = toInterfaceContractId allowlistedMsgCid verifierArgs = "" caller = allowlistedParty diff --git a/contracts/ccip/test/daml/ExecutorExpectedExecutorTest.daml b/contracts/ccip/test/daml/ExecutorExpectedExecutorTest.daml index 2c33c34ba..bb7750b8a 100644 --- a/contracts/ccip/test/daml/ExecutorExpectedExecutorTest.daml +++ b/contracts/ccip/test/daml/ExecutorExpectedExecutorTest.daml @@ -8,21 +8,24 @@ import DA.Optional (fromSome) import DA.Set qualified as Set import qualified DA.TextMap as TextMap +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.GlobalConfig +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.ClientV1 +import qualified CCIP.ExecutorV1 +import qualified CCIP.InterfacesV1.Executor +import qualified CCIP.RuntimeV1.OnRamp +import qualified CCIP.RuntimeV1.PerPartyRouter + + import qualified CCIP.CCIPSender -import qualified CCIP.Client -import qualified CCIP.Executor -import qualified CCIP.ExecutorTypes as CCIP.Executor -import qualified CCIP.FeeQuoter -import qualified CCIP.FinalityConfig -import qualified CCIP.GlobalConfig -import qualified CCIP.Interfaces.Executor -import qualified CCIP.OnRamp -import qualified CCIP.OnRampTypes -import qualified CCIP.PerPartyRouter -import qualified CCIP.PerPartyRouterTypes -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified Splice.Api.Token.HoldingV1 as HoldingV1 -import qualified Splice.Api.Token.MetadataV1 as MetadataV1 cents : Decimal -> Numeric 0 cents c = intToNumeric (truncate c) @@ -35,37 +38,37 @@ data FeeFixture = FeeFixture executorOwnerB : Party sourceChainSelector : Numeric 0 destChainSelector : Numeric 0 - feeToken : HoldingV1.InstrumentId - globalConfig : ContractId CCIP.GlobalConfig.GlobalConfig - feeQuoter : ContractId CCIP.FeeQuoter.FeeQuoter - onRamp : ContractId CCIP.OnRamp.OnRamp - router : ContractId CCIP.PerPartyRouter.PerPartyRouter + feeToken : Splice.Api.Token.HoldingV1.InstrumentId + globalConfig : ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + feeQuoter : ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter + onRamp : ContractId CCIP.RuntimeV1.OnRamp.OnRamp + router : ContractId CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter sender : ContractId CCIP.CCIPSender.CCIPSender - executorA : ContractId CCIP.Executor.Executor - executorB : ContractId CCIP.Executor.Executor - executorAAddress : RawInstanceAddress.RawInstanceAddress - executorBAddress : RawInstanceAddress.RawInstanceAddress + executorA : ContractId CCIP.ExecutorV1.Executor + executorB : ContractId CCIP.ExecutorV1.Executor + executorAAddress : Chainlink.InstanceAddress.RawInstanceAddress + executorBAddress : Chainlink.InstanceAddress.RawInstanceAddress -feeContext : FeeFixture -> MetadataV1.ChoiceContext +feeContext : FeeFixture -> Splice.Api.Token.MetadataV1.ChoiceContext feeContext f = - MetadataV1.ChoiceContext with + Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.FeeQuoter.feeQuoterKey, MetadataV1.AV_ContractId $ coerceContractId f.feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) - , (CCIP.OnRamp.onRampKey, MetadataV1.AV_ContractId $ coerceContractId f.onRamp) + [ (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId f.onRamp) ] messageWithExecutor : FeeFixture - -> CCIP.Client.ExecutorExtraArg - -> CCIP.Client.Canton2AnyMessage + -> CCIP.ClientV1.ExecutorExtraArg + -> CCIP.ClientV1.Canton2AnyMessage messageWithExecutor f executor = - CCIP.Client.Canton2AnyMessage with + CCIP.ClientV1.Canton2AnyMessage with receiver = "0000000000000000000000000000000000000001" payload = "abcd" tokenTransfer = None feeToken = f.feeToken - extraArgs = CCIP.Client.V3 CCIP.Client.GenericExtraArgsV3 with + extraArgs = CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = 0 ccvs = [] executor = executor @@ -73,25 +76,26 @@ messageWithExecutor f executor = tokenArgs = "" executorInput - : ContractId CCIP.Executor.Executor + : ContractId CCIP.ExecutorV1.Executor -> CCIP.CCIPSender.ExecutorInput executorInput executorCid = CCIP.CCIPSender.ExecutorInput with - executorCid = toInterfaceContractId @CCIP.Interfaces.Executor.IExecutor executorCid - executorExtraContext = MetadataV1.emptyChoiceContext + executorCid = toInterfaceContractId @CCIP.InterfacesV1.Executor.IExecutor executorCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext executorFeeQuote - : RawInstanceAddress.RawInstanceAddress + : Chainlink.InstanceAddress.RawInstanceAddress -> Numeric 0 - -> CCIP.Interfaces.Executor.ExecutorFeeQuote + -> CCIP.InterfacesV1.Executor.ExecutorFeeQuote executorFeeQuote executorAddress feeUSDCents = let executorInstanceId = - fromSome (RawInstanceAddress.parseInstanceIdText (RawInstanceAddress.toText executorAddress)) - executorOwner = RawInstanceAddress.ownerParty executorAddress - in CCIP.Interfaces.Executor.ExecutorFeeQuote with + fromSome (Chainlink.InstanceAddress.parseInstanceIdText (Chainlink.InstanceAddress.toText executorAddress)) + executorOwner = Chainlink.InstanceAddress.ownerParty executorAddress + in CCIP.InterfacesV1.Executor.ExecutorFeeQuote with executorInstanceId executorOwner feeUSDCents + context = Splice.Api.Token.MetadataV1.emptyChoiceContext setupFeeFixture : Text -> Bool -> Script FeeFixture setupFeeFixture suffix useDefaultExecutor = do @@ -109,19 +113,19 @@ setupFeeFixture suffix useDefaultExecutor = do let senderInstanceId = "sender-expected-executor-" <> suffix let executorAInstanceId = "executor-a-" <> suffix let executorBInstanceId = "executor-b-" <> suffix - let executorAAddress = RawInstanceAddress.make executorAInstanceId executorOwnerA - let executorBAddress = RawInstanceAddress.make executorBInstanceId executorOwnerB - let feeToken = HoldingV1.InstrumentId with + let executorAAddress = Chainlink.InstanceAddress.make executorAInstanceId executorOwnerA + let executorBAddress = Chainlink.InstanceAddress.make executorBInstanceId executorOwnerB + let feeToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "FeeToken" globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = sourceChainSelector destChainConfigs = Map.fromList - [ (destChainSelector, CCIP.GlobalConfig.DestChainConfig with + [ (destChainSelector, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False @@ -138,12 +142,12 @@ setupFeeFixture suffix useDefaultExecutor = do sourceChainConfigs = Map.empty feeQuoter <- submit ccipOwner do - createCmd CCIP.FeeQuoter.FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = feeQuoterInstanceId - owner = ccipOwner + ccipOwner = ccipOwner feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList - [ (destChainSelector, CCIP.FeeQuoter.FeeQuoterDestChainConfig with + [ (destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 1000000 @@ -157,13 +161,13 @@ setupFeeFixture suffix useDefaultExecutor = do ] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [ (destChainSelector, CCIP.FeeQuoter.TimestampedPrice with + [ (destChainSelector, CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 0.0 timestamp = datetime 2025 Jan 1 0 0 0 ) ] usdPerToken = Map.fromList - [ (feeToken, CCIP.FeeQuoter.TimestampedPrice with + [ (feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 100000000.0 timestamp = datetime 2025 Jan 1 0 0 0 ) @@ -172,29 +176,28 @@ setupFeeFixture suffix useDefaultExecutor = do priceUpdaters = [] onRamp <- submit ccipOwner do - createCmd CCIP.OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = onRampInstanceId ccipOwner = ccipOwner maxUSDCentsPerMsg = 1000000000.0 - deps = CCIP.OnRampTypes.OnRampDeps with - globalConfig = RawInstanceAddress.make globalConfigInstanceId ccipOwner - rmnRemote = RawInstanceAddress.make ("rmn-unused-" <> suffix) ccipOwner - tokenAdminRegistry = RawInstanceAddress.make ("tar-unused-" <> suffix) ccipOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner - ccvRegistry = RawInstanceAddress.make ("ccvregistry-unused-" <> suffix) ccipOwner + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + rmnRemote = Chainlink.InstanceAddress.make ("rmn-unused-" <> suffix) ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make ("tar-unused-" <> suffix) ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner router <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = routerInstanceId ccipOwner = ccipOwner partyOwner = user - deps = CCIP.PerPartyRouterTypes.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make onRampInstanceId ccipOwner - offRamp = RawInstanceAddress.make ("offramp-unused-" <> suffix) ccipOwner - globalConfig = RawInstanceAddress.make globalConfigInstanceId ccipOwner - tokenAdminRegistry = RawInstanceAddress.make ("tar-unused-" <> suffix) ccipOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner - rmnRemote = RawInstanceAddress.make ("rmn-unused-" <> suffix) ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make onRampInstanceId ccipOwner + offRamp = Chainlink.InstanceAddress.make ("offramp-unused-" <> suffix) ccipOwner + globalConfig = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make ("tar-unused-" <> suffix) ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner + rmnRemote = Chainlink.InstanceAddress.make ("rmn-unused-" <> suffix) ccipOwner outboundSequenceNumbers = Map.empty executedMessages = Set.empty archivedExecutionContractIds = [] @@ -206,34 +209,34 @@ setupFeeFixture suffix useDefaultExecutor = do owner = user executorA <- submit executorOwnerA do - createCmd CCIP.Executor.Executor with + createCmd CCIP.ExecutorV1.Executor with instanceId = executorAInstanceId owner = executorOwnerA maxCCVsPerMsg = 10 - dynamicConfig = CCIP.Executor.DynamicConfig with + dynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None - allowedFinalityConfig = CCIP.FinalityConfig.WaitForFinality + allowedFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality ccvAllowlistEnabled = False allowedCCVs = [] remoteChainConfigs = Map.fromList - [ (destChainSelector, CCIP.Executor.RemoteChainConfig with + [ (destChainSelector, CCIP.ExecutorV1.RemoteChainConfig with feeUSDCents = cents 5.0 enabled = True ) ] executorB <- submit executorOwnerB do - createCmd CCIP.Executor.Executor with + createCmd CCIP.ExecutorV1.Executor with instanceId = executorBInstanceId owner = executorOwnerB maxCCVsPerMsg = 10 - dynamicConfig = CCIP.Executor.DynamicConfig with + dynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None - allowedFinalityConfig = CCIP.FinalityConfig.WaitForFinality + allowedFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality ccvAllowlistEnabled = False allowedCCVs = [] remoteChainConfigs = Map.fromList - [ (destChainSelector, CCIP.Executor.RemoteChainConfig with + [ (destChainSelector, CCIP.ExecutorV1.RemoteChainConfig with feeUSDCents = cents 9.0 enabled = True ) @@ -264,11 +267,12 @@ testExecutorInterfaceRejectsMismatchedExpectedExecutor = script do disclosedExecutorA <- fromSome <$> queryDisclosure f.executorOwnerA f.executorA submitMustFail (actAs f.user <> disclose disclosedExecutorA) do - exerciseCmd (toInterfaceContractId @CCIP.Interfaces.Executor.IExecutor f.executorA) - CCIP.Interfaces.Executor.Executor_GetFee with + exerciseCmd (toInterfaceContractId @CCIP.InterfacesV1.Executor.IExecutor f.executorA) + CCIP.InterfacesV1.Executor.Executor_GetFee with expectedExecutor = f.executorBAddress destChainSelector = f.destChainSelector requiredCCVs = [] + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = f.user testSenderGetFeeRejectsWrongDefaultExecutorInput : Script () @@ -290,9 +294,9 @@ testSenderGetFeeRejectsWrongDefaultExecutorInput = script do ) do exerciseCmd f.sender CCIP.CCIPSender.GetFee with destinationChainSelector = f.destChainSelector - message = messageWithExecutor f (CCIP.Client.Executor_UseDefault "") + message = messageWithExecutor f (CCIP.ClientV1.Executor_UseDefault "") context = feeContext f - routerCid = f.router + routerCid = coerceContractId f.router ccvSendInputs = [] tokenTransferInput = None executorInput = Some (executorInput f.executorB) @@ -317,9 +321,9 @@ testSenderGetFeeRejectsWrongExplicitExecutorInput = script do exerciseCmd f.sender CCIP.CCIPSender.GetFee with destinationChainSelector = f.destChainSelector message = messageWithExecutor f - (CCIP.Client.Executor_WithAddress f.executorAAddress "") + (CCIP.ClientV1.Executor_WithAddress f.executorAAddress "") context = feeContext f - routerCid = f.router + routerCid = coerceContractId f.router ccvSendInputs = [] tokenTransferInput = None executorInput = Some (executorInput f.executorB) @@ -339,11 +343,11 @@ testRouterGetFeeRejectsMismatchedExecutorQuote = script do <> disclose disclosedGlobalConfig <> disclose disclosedFeeQuoter ) do - exerciseCmd f.router CCIP.PerPartyRouter.GetFee with + exerciseCmd f.router CCIP.RuntimeV1.PerPartyRouter.GetFee with context = feeContext f destChainSelector = f.destChainSelector message = messageWithExecutor f - (CCIP.Client.Executor_WithAddress f.executorAAddress "") + (CCIP.ClientV1.Executor_WithAddress f.executorAAddress "") ccvFeeQuotes = [] tokenPoolFeeQuote = None executorFeeQuote = Some (executorFeeQuote f.executorBAddress 9.0) @@ -363,11 +367,11 @@ testRouterGetFeeRequiresExplicitExecutorQuote = script do <> disclose disclosedGlobalConfig <> disclose disclosedFeeQuoter ) do - exerciseCmd f.router CCIP.PerPartyRouter.GetFee with + exerciseCmd f.router CCIP.RuntimeV1.PerPartyRouter.GetFee with context = feeContext f destChainSelector = f.destChainSelector message = messageWithExecutor f - (CCIP.Client.Executor_WithAddress f.executorAAddress "") + (CCIP.ClientV1.Executor_WithAddress f.executorAAddress "") ccvFeeQuotes = [] tokenPoolFeeQuote = None executorFeeQuote = None diff --git a/contracts/ccip/test/daml/FeeQuoter.daml b/contracts/ccip/test/daml/FeeQuoter.daml index 03d31a8e1..471bd59dd 100644 --- a/contracts/ccip/test/daml/FeeQuoter.daml +++ b/contracts/ccip/test/daml/FeeQuoter.daml @@ -10,19 +10,22 @@ import DA.Optional (fromSome) import DA.Set qualified as Set import DA.Time (time) -import CCIP.Client qualified as Client -import CCIP.FeeQuoter -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.GlobalConfig qualified as GlobalConfig -import CCIP.Interfaces.CrossChainVerifier qualified as ICCV -import CCIP.MessageCodecV1 qualified as MessageCodecV1 -import CCIP.OnRamp qualified as OnRamp -import CCIP.OnRampTypes qualified as OnRampTypes -import CCIP.Tickets qualified as Tickets -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.SendingMessageV1 qualified as SendingMessageV1 - -import Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.EventsV1.Receipts +import qualified CCIP.ClientV1 +import qualified CCIP.InterfacesV1.CrossChainVerifier +import qualified CCIP.RuntimeV1.OnRamp + +import qualified CCIP.CoreV1.SendingMessage usd : Decimal -> Decimal usd d = d @@ -38,14 +41,14 @@ mult m = intToNumeric (truncate (m * 100000000.0)) finalityConfig n = if n == 0 - then FinalityCodec.waitForFinalityFlag + then CCIP.CodecV1.FinalityConfig.waitForFinalityFlag else fromSome do - flagsHex <- MessageCodecV1.encodeUint16 0 - blockConfirmationsHex <- MessageCodecV1.encodeUint16 n + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 n pure (flagsHex <> blockConfirmationsHex) -testDestChainConfig : FeeQuoterDestChainConfig -testDestChainConfig = FeeQuoterDestChainConfig with +testDestChainConfig : CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig +testDestChainConfig = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 1000000 @@ -58,13 +61,13 @@ testDestChainConfig = FeeQuoterDestChainConfig with finalizeUsingQuote : Party - -> ContractId CCIP.FeeQuoter.FeeQuoter - -> ContractId SendingMessageV1.SendingMessageV1 - -> Script (ContractId SendingMessageV1.SendingMessageV1) + -> ContractId CCIP.CoreV1.FeeQuoter.FeeQuoter + -> ContractId CCIP.CoreV1.SendingMessage.SendingMessage + -> Script (ContractId CCIP.CoreV1.SendingMessage.SendingMessage) finalizeUsingQuote owner feeQuoter sendingMessageCid = do Some sm <- queryContractId owner sendingMessageCid quote <- submit owner do - exerciseCmd feeQuoter QuoteGasForExec with + exerciseCmd feeQuoter CCIP.CoreV1.FeeQuoter.QuoteGasForExec with destChainSelector = sm.destChainSelector nonCalldataGas = foldl (\acc fee -> acc + fee.destGasLimit) 0 sm.ccvFees @@ -79,9 +82,10 @@ finalizeUsingQuote owner feeQuoter sendingMessageCid = do None -> 0) + sm.executorDestBytesOverhead feeToken = sm.feeToken + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner submit owner do - exerciseCmd sendingMessageCid SendingMessageV1.FinalizeFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.FinalizeFee with feeTokenPrice = quote.feeTokenPrice premiumMultiplier = quote.premiumMultiplier totalExecutionGasLimit = quote.totalGas @@ -89,10 +93,10 @@ finalizeUsingQuote owner feeQuoter sendingMessageCid = do executorDestBytesOverhead = sm.executorDestBytesOverhead executionCostUSDCents = case sm.executionMode of - Some SendingMessageV1.ExecutionMode_NoExecutor -> 0.0 + Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor -> 0.0 _ -> quote.gasCostUSDCents -sumQuoteNonCalldataGas : SendingMessageV1.SendingMessageV1 -> Int +sumQuoteNonCalldataGas : CCIP.CoreV1.SendingMessage.SendingMessage -> Int sumQuoteNonCalldataGas sm = foldl (\acc fee -> acc + fee.destGasLimit) 0 sm.ccvFees + (case sm.tokenSendFee of @@ -100,7 +104,7 @@ sumQuoteNonCalldataGas sm = None -> 0) + sm.executorDestGasLimit -sumQuoteCalldataSize : SendingMessageV1.SendingMessageV1 -> Int +sumQuoteCalldataSize : CCIP.CoreV1.SendingMessage.SendingMessage -> Int sumQuoteCalldataSize sm = foldl (\acc fee -> acc + fee.destBytesOverhead) 0 sm.ccvFees + (case sm.tokenSendFee of @@ -108,29 +112,29 @@ sumQuoteCalldataSize sm = None -> 0) + sm.executorDestBytesOverhead -sumReceiptNonNetworkGas : [Tickets.Receipt] -> Int +sumReceiptNonNetworkGas : [CCIP.EventsV1.Receipts.Receipt] -> Int sumReceiptNonNetworkGas receipts = foldl (\acc r -> case r.issuerType of - Tickets.IssuerType_Network -> acc + CCIP.EventsV1.Receipts.IssuerType_Network -> acc _ -> acc + r.destGasLimit) 0 receipts -sumReceiptNonNetworkBytes : [Tickets.Receipt] -> Int +sumReceiptNonNetworkBytes : [CCIP.EventsV1.Receipts.Receipt] -> Int sumReceiptNonNetworkBytes receipts = foldl (\acc r -> case r.issuerType of - Tickets.IssuerType_Network -> acc + CCIP.EventsV1.Receipts.IssuerType_Network -> acc _ -> acc + r.destBytesOverhead) 0 receipts assertReceiptSumsMatchQuoteInputs - : SendingMessageV1.SendingMessageV1 - -> [Tickets.Receipt] + : CCIP.CoreV1.SendingMessage.SendingMessage + -> [CCIP.EventsV1.Receipts.Receipt] -> Script () assertReceiptSumsMatchQuoteInputs sm receipts = do sumQuoteNonCalldataGas sm === sumReceiptNonNetworkGas receipts @@ -151,29 +155,29 @@ setup = script do -- Create FeeQuoter fq <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter" feeTokens = Set.empty destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] usdPerToken = Map.empty linkTokenInstrumentId = instrumentIdLINK priceUpdaters = [owner] -- Apply price updates for destChainSelector1 and instrumentIdLINK fq <- submit owner do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [ - TokenPriceUpdate with + CCIP.CoreV1.FeeQuoter.TokenPriceUpdate with instrumentId = instrumentIdLINK usdPerToken = 17.77 ] gasPriceUpdates = [ - GasPriceUpdate with + CCIP.CoreV1.FeeQuoter.GasPriceUpdate with destChainSelector = destChainSelector1 usdPerUnitGas = 0.045 ] @@ -181,40 +185,44 @@ setup = script do -- retrieve prices and assert result <- submit owner do - exerciseCmd fq GetTokenPrice with - instrumentId = instrumentIdLINK + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetTokenPrice with + token = instrumentIdLINK + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner debug result result.price === 17.77 result <- submit owner do - exerciseCmd fq GetDestinationChainGasPrice with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetDestinationChainGasPrice with destChainSelector = destChainSelector1 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner debug result result.price === 0.045 resultFeeTokens <- submit owner do - exerciseCmd fq GetFeeTokens with caller = owner + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetFeeTokens with + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = owner Set.fromList resultFeeTokens === Set.fromList [instrumentIdLINK] -- Apply prices again, this time for two chains and two instruments fq <- submit owner do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [ - (TokenPriceUpdate with + (CCIP.CoreV1.FeeQuoter.TokenPriceUpdate with instrumentId = instrumentIdLINK usdPerToken = 20.0), - (TokenPriceUpdate with + (CCIP.CoreV1.FeeQuoter.TokenPriceUpdate with instrumentId = instrumentIdUSDC usdPerToken = 1.0) ] gasPriceUpdates = [ - (GasPriceUpdate with + (CCIP.CoreV1.FeeQuoter.GasPriceUpdate with destChainSelector = destChainSelector1 usdPerUnitGas = 0.05), - (GasPriceUpdate with + (CCIP.CoreV1.FeeQuoter.GasPriceUpdate with destChainSelector = destChainSelector2 usdPerUnitGas = 0.075) ] @@ -222,39 +230,45 @@ setup = script do -- retrieve prices for both and assert result <- submit owner do - exerciseCmd fq GetTokenPrice with - instrumentId = instrumentIdLINK + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetTokenPrice with + token = instrumentIdLINK + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner debug result result.price === 20.0 result <- submit owner do - exerciseCmd fq GetTokenPrice with - instrumentId = instrumentIdUSDC + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetTokenPrice with + token = instrumentIdUSDC + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner debug result result.price === 1.0 result <- submit owner do - exerciseCmd fq GetDestinationChainGasPrice with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetDestinationChainGasPrice with destChainSelector = destChainSelector1 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner debug result result.price === 0.05 result <- submit owner do - exerciseCmd fq GetDestinationChainGasPrice with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetDestinationChainGasPrice with destChainSelector = destChainSelector2 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner debug result result.price === 0.075 resultFeeTokens <- submit owner do - exerciseCmd fq GetFeeTokens with caller = owner + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetFeeTokens with + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + caller = owner Set.fromList resultFeeTokens === Set.fromList [instrumentIdLINK, instrumentIdUSDC] -- test ApplyFeeQuoterDestChainConfigUpdates - let destChainConfig1 = FeeQuoterDestChainConfig with + let destChainConfig1 = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 5000 destGasOverhead = 30000 @@ -264,7 +278,7 @@ setup = script do maxPerMsgGasLimit = 2000000 defaultTokenFeeUSD = usdToCents 0.50 defaultTokenDestGasOverhead = 0 - let destChainConfig2 = FeeQuoterDestChainConfig with + let destChainConfig2 = CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 8000 destGasOverhead = 40000 @@ -275,24 +289,24 @@ setup = script do defaultTokenFeeUSD = usdToCents 0.25 defaultTokenDestGasOverhead = 0 fq <- submit owner do - exerciseCmd fq ApplyFeeQuoterDestChainConfigUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdates with destChainConfigArgs = [ - (FeeQuoterDestChainConfigArgs with + (CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs with destChainSelector = destChainSelector1 destChainConfig = destChainConfig1), - (FeeQuoterDestChainConfigArgs with + (CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs with destChainSelector = destChainSelector2 destChainConfig = destChainConfig2) ] result <- submit owner do - exerciseCmd fq GetDestChainConfig with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetDestChainConfig with destChainSelector = destChainSelector1 caller = owner debug result result === destChainConfig1 result <- submit owner do - exerciseCmd fq GetDestChainConfig with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetDestChainConfig with destChainSelector = destChainSelector2 caller = owner debug result @@ -300,18 +314,18 @@ setup = script do -- try setting an invalid config (destChainSelector = 0.0), should fail submitMustFail owner do - exerciseCmd fq ApplyFeeQuoterDestChainConfigUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdates with destChainConfigArgs = [ - (FeeQuoterDestChainConfigArgs with + (CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs with destChainSelector = 0.0 destChainConfig = destChainConfig1) ] -- try setting an invalid config (destChainSelector = -123.0), should fail submitMustFail owner do - exerciseCmd fq ApplyFeeQuoterDestChainConfigUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdates with destChainConfigArgs = [ - (FeeQuoterDestChainConfigArgs with + (CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs with destChainSelector = -123.0 destChainConfig = destChainConfig1) ] @@ -323,15 +337,15 @@ setup = script do -- Add two price updaters fq <- submit owner do - exerciseCmd fq AddPriceUpdaters with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.AddPriceUpdaters with parties = [updater1, updater2] -- Verify updaters can call UpdatePrices fq <- submit updater1 do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [ - TokenPriceUpdate with + CCIP.CoreV1.FeeQuoter.TokenPriceUpdate with instrumentId = instrumentIdLINK usdPerToken = 30.0 ] @@ -339,30 +353,31 @@ setup = script do caller = updater1 result <- submit owner do - exerciseCmd fq GetTokenPrice with - instrumentId = instrumentIdLINK + exerciseCmd fq CCIP.CoreV1.FeeQuoter.GetTokenPrice with + token = instrumentIdLINK + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner result.price === 30.0 -- Non-updater should fail submitMustFail updater3 do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = updater3 -- Add another, including a duplicate fq <- submit owner do - exerciseCmd fq AddPriceUpdaters with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.AddPriceUpdaters with parties = [updater2, updater3] -- updater3 should now work fq <- submit updater3 do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [ - TokenPriceUpdate with + CCIP.CoreV1.FeeQuoter.TokenPriceUpdate with instrumentId = instrumentIdLINK usdPerToken = 40.0 ] @@ -371,28 +386,28 @@ setup = script do -- Remove updater1 fq <- submit owner do - exerciseCmd fq RemovePriceUpdaters with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.RemovePriceUpdaters with parties = [updater1] -- updater1 should now fail submitMustFail updater1 do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = updater1 -- updater2 should still work fq <- submit updater2 do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = updater2 -- Adding owner as price updater should be filtered out fq <- submit owner do - exerciseCmd fq AddPriceUpdaters with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.AddPriceUpdaters with parties = [owner] Some fqData <- queryContractId owner fq @@ -401,9 +416,9 @@ setup = script do -- try setting an invalid config (defaultTxGasLimit = 0), should fail let invalidDestChainConfig = destChainConfig1 with defaultTxGasLimit = 0 submitMustFail owner do - exerciseCmd fq ApplyFeeQuoterDestChainConfigUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.ApplyFeeQuoterDestChainConfigUpdates with destChainConfigArgs = [ - (FeeQuoterDestChainConfigArgs with + (CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfigArgs with destChainSelector = destChainSelector1 destChainConfig = invalidDestChainConfig) ] @@ -420,8 +435,8 @@ testFeeQuoter_ApplyPriceUpdatersUpdate = script do id = "LINK" fq <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter" feeTokens = Set.empty destChainConfigs = Map.empty @@ -433,84 +448,84 @@ testFeeQuoter_ApplyPriceUpdatersUpdate = script do -- owner can update prices directly without being in priceUpdaters fq <- submit owner do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = owner -- try updating prices as the price updater, should fail since not added yet submitMustFail owner do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = priceUpdater -- add price updater fq <- submit owner do - exerciseCmd fq ApplyPriceUpdatersUpdate with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.ApplyPriceUpdatersUpdate with addedPriceUpdaters = [priceUpdater] removedPriceUpdaters = [] -- try updating prices as the price updater, should succeed now fq <- submit priceUpdater do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = priceUpdater -- ApplyPriceUpdatersUpdate cannot add owner to priceUpdaters. - -- owner still updates via UpdatePrices when caller == owner. + -- owner still updates via CCIP.CoreV1.FeeQuoter.UpdatePrices when caller == owner. fq <- submit owner do - exerciseCmd fq ApplyPriceUpdatersUpdate with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.ApplyPriceUpdatersUpdate with addedPriceUpdaters = [owner] removedPriceUpdaters = [] -- test that both owner and priceUpdater can update prices now fq <- submit owner do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = owner fq <- submit priceUpdater do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = priceUpdater -- remove price updater fq <- submit owner do - exerciseCmd fq ApplyPriceUpdatersUpdate with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.ApplyPriceUpdatersUpdate with addedPriceUpdaters = [] removedPriceUpdaters = [priceUpdater] -- try updating prices as the removed price updater, should fail now submitMustFail priceUpdater do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = priceUpdater -- owner should still be able to update prices fq <- submit owner do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = owner -- test that removing and adding a price updater in the same update works fq <- submit owner do - exerciseCmd fq ApplyPriceUpdatersUpdate with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.ApplyPriceUpdatersUpdate with addedPriceUpdaters = [priceUpdater] removedPriceUpdaters = [priceUpdater, owner] -- also remove owner to test that removing a non-existing price updater is a no-op -- priceUpdater should be able to update prices again since re-added fq <- submit priceUpdater do - exerciseCmd fq UpdatePrices with - priceUpdates = PriceUpdates with + exerciseCmd fq CCIP.CoreV1.FeeQuoter.UpdatePrices with + priceUpdates = CCIP.CoreV1.FeeQuoter.PriceUpdates with tokenPriceUpdates = [] gasPriceUpdates = [] caller = priceUpdater @@ -529,37 +544,37 @@ testFinalizeFeeUsesEVMScaledPrices = script do id = "LINK" feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-finalize" feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] - usdPerToken = Map.fromList [(feeToken, TimestampedPrice 20.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + usdPerToken = Map.fromList [(feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 20.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = feeToken priceUpdaters = [owner] sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-finalize-fee" sender - onRamp = RawInstanceAddress.make "onramp-finalize-fee" owner - globalConfig = RawInstanceAddress.make "globalconfig-finalize-fee" owner - rmnRemote = RawInstanceAddress.make "rmn-finalize-fee" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-finalize-fee" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-finalize" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-finalize-fee" sender + onRamp = Chainlink.InstanceAddress.make "onramp-finalize-fee" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-finalize-fee" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-finalize-fee" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-finalize-fee" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-finalize" owner ccipOwner = owner sender = sender destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 - requiredCCVs = [RawInstanceAddress.make "ccv-premium" ccvOwner] + requiredCCVs = [Chainlink.InstanceAddress.make "ccv-premium" ccvOwner] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "executor-finalize-fee" executor) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "executor-finalize-fee" executor) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -574,6 +589,7 @@ testFinalizeFeeUsesEVMScaledPrices = script do feeToken = feeToken networkFeeUSDCents = cents 100.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -592,7 +608,7 @@ testFinalizeFeeUsesEVMScaledPrices = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid @@ -615,24 +631,24 @@ testAddCCVFeeRejectsWrongRawInstanceAddress = script do id = "LINK" sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-raw-ccv" sender - onRamp = RawInstanceAddress.make "onramp-raw-ccv" owner - globalConfig = RawInstanceAddress.make "globalconfig-raw-ccv" owner - rmnRemote = RawInstanceAddress.make "rmn-raw-ccv" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-raw-ccv" owner - feeQuoter = RawInstanceAddress.make "feequoter-raw-ccv" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-raw-ccv" sender + onRamp = Chainlink.InstanceAddress.make "onramp-raw-ccv" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-raw-ccv" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-raw-ccv" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-raw-ccv" owner + feeQuoter = Chainlink.InstanceAddress.make "feequoter-raw-ccv" owner ccipOwner = owner sender = sender destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 - requiredCCVs = [RawInstanceAddress.make "ccv-allowed" ccvOwner] + requiredCCVs = [Chainlink.InstanceAddress.make "ccv-allowed" ccvOwner] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "executor-raw-ccv" owner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "executor-raw-ccv" owner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -647,6 +663,7 @@ testAddCCVFeeRejectsWrongRawInstanceAddress = script do feeToken = feeToken networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -665,23 +682,25 @@ testAddCCVFeeRejectsWrongRawInstanceAddress = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedSm <- fromSome <$> queryDisclosure owner sendingMessageCid submitMustFail (actAs ccvOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-wrong" feeUSDCents = cents 1.0 destGasLimit = 10000 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner sendingMessageCid <- submit (actAs ccvOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-allowed" feeUSDCents = cents 1.0 destGasLimit = 10000 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner assertMsg "allowed raw instance should be accepted" True @@ -700,39 +719,39 @@ testFinalizeFee_PremiumAndExecutor = script do -- linkFeeMultiplierPercent = 90 means 10% LINK discount. -- feeTokenPrice = 20.0 (20 USD per LINK) feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-premium" feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig with linkFeeMultiplierPercent = 90.0)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] - usdPerToken = Map.fromList [(feeToken, TimestampedPrice 20.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + usdPerToken = Map.fromList [(feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 20.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = feeToken priceUpdaters = [owner] let senderAddr = "01" sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-premium" sender - onRamp = RawInstanceAddress.make "onramp-premium" owner - globalConfig = RawInstanceAddress.make "globalconfig-premium" owner - rmnRemote = RawInstanceAddress.make "rmn-premium" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-premium" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-premium" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-premium" sender + onRamp = Chainlink.InstanceAddress.make "onramp-premium" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-premium" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-premium" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-premium" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-premium" owner ccipOwner = owner sender = sender destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 - requiredCCVs = [RawInstanceAddress.make "ccv-premium" ccvOwner] + requiredCCVs = [Chainlink.InstanceAddress.make "ccv-premium" ccvOwner] destDefaultCCVs = [] - requiredExecutor = Some (RawInstanceAddress.make "executor-premium" executorOwner) - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "executor-premium" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_Executor + requiredExecutor = Some (Chainlink.InstanceAddress.make "executor-premium" executorOwner) + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "executor-premium" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor sourceChainSelector = 123.0 senderAddress = senderAddr receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -747,6 +766,7 @@ testFinalizeFee_PremiumAndExecutor = script do feeToken = feeToken networkFeeUSDCents = cents 100.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -765,29 +785,31 @@ testFinalizeFee_PremiumAndExecutor = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared -- Add CCV fee: 200 USD cents ($2.00) disclosedSm <- fromSome <$> queryDisclosure owner sendingMessageCid sendingMessageCid <- submit (actAs ccvOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-premium" feeUSDCents = cents 200.0 destGasLimit = 10000 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner -- AddExecutorFee: 300 USD cents ($3.00) -- After AddCCVFee, ccvOwner is a signatory so query from ccvOwner disclosedSm2 <- fromSome <$> queryDisclosure ccvOwner sendingMessageCid sendingMessageCid <- submit (actAs executorOwner <> disclose disclosedSm2) do - exerciseCmd sendingMessageCid SendingMessageV1.AddExecutorFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddExecutorFee with executorInstanceId = "executor-premium" executorArgs = "" feeUSDCents = cents 300.0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = executorOwner - -- Finalize using QuoteGasForExec + SendingMessageV1.FinalizeFee. + -- Finalize using QuoteGasForExec + CCIP.CoreV1.SendingMessage.FinalizeFee. sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid finalized <- queryContractId owner sendingMessageCid @@ -820,27 +842,27 @@ testFinalizeFee_SmallFee = script do -- feeTokenPrice = $20, non-LINK uses the implicit 100% multiplier. feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-small" feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] - usdPerToken = Map.fromList [(feeToken, TimestampedPrice 20.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + usdPerToken = Map.fromList [(feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 20.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = feeToken priceUpdaters = [owner] sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-small" sender - onRamp = RawInstanceAddress.make "onramp-small" owner - globalConfig = RawInstanceAddress.make "globalconfig-small" owner - rmnRemote = RawInstanceAddress.make "rmn-small" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-small" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-small" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-small" sender + onRamp = Chainlink.InstanceAddress.make "onramp-small" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-small" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-small" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-small" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-small" owner ccipOwner = owner sender = sender destChainSelector = 456.0 @@ -848,9 +870,9 @@ testFinalizeFee_SmallFee = script do sequenceNumber = 1.0 requiredCCVs = [] destDefaultCCVs = [] - requiredExecutor = Some (RawInstanceAddress.make "executor-small" executorOwner) - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "executor-small" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_Executor + requiredExecutor = Some (Chainlink.InstanceAddress.make "executor-small" executorOwner) + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "executor-small" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -865,6 +887,7 @@ testFinalizeFee_SmallFee = script do feeToken = feeToken networkFeeUSDCents = cents 1.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -883,14 +906,15 @@ testFinalizeFee_SmallFee = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedSm <- fromSome <$> queryDisclosure owner sendingMessageCid sendingMessageCid <- submit (actAs executorOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid SendingMessageV1.AddExecutorFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddExecutorFee with executorInstanceId = "executor-small" executorArgs = "" feeUSDCents = cents 1.0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = executorOwner sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid @@ -905,7 +929,7 @@ testFinalizeFee_SmallFee = script do debug "testFinalizeFee_SmallFee: PASSED" --- QuoteGasForExec + SendingMessageV1.FinalizeFee should still convert +-- QuoteGasForExec + CCIP.CoreV1.SendingMessage.FinalizeFee should still convert -- non-LINK fees into the selected fee token correctly. testFinalizeFee_LinkCapAfterConversion = script do owner <- allocateParty "owner-link-cap" @@ -923,30 +947,30 @@ testFinalizeFee_LinkCapAfterConversion = script do -- LINK price = $15 per token -- network fee = $1.50 -> 1.5 fee tokens -> 0.1 LINK feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-link-cap" feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] usdPerToken = Map.fromList - [ (feeToken, TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0)) - , (linkToken, TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0)) + [ (feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0)) + , (linkToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0)) ] linkTokenInstrumentId = linkToken priceUpdaters = [owner] sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-link-cap" sender - onRamp = RawInstanceAddress.make "onramp-link-cap" owner - globalConfig = RawInstanceAddress.make "globalconfig-link-cap" owner - rmnRemote = RawInstanceAddress.make "rmn-link-cap" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-link-cap" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-link-cap" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-link-cap" sender + onRamp = Chainlink.InstanceAddress.make "onramp-link-cap" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-link-cap" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-link-cap" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-link-cap" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-link-cap" owner ccipOwner = owner sender = sender destChainSelector = 456.0 @@ -955,8 +979,8 @@ testFinalizeFee_LinkCapAfterConversion = script do requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "executor-link-cap" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "executor-link-cap" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -971,6 +995,7 @@ testFinalizeFee_LinkCapAfterConversion = script do feeToken = feeToken networkFeeUSDCents = cents 150.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -989,7 +1014,7 @@ testFinalizeFee_LinkCapAfterConversion = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid @@ -998,7 +1023,7 @@ testFinalizeFee_LinkCapAfterConversion = script do debug "testFinalizeFee_LinkCapAfterConversion: PASSED" --- QuoteGasForExec + SendingMessageV1.FinalizeFee should convert direct LINK +-- QuoteGasForExec + CCIP.CoreV1.SendingMessage.FinalizeFee should convert direct LINK -- fees at par when LINK is the fee token. testFinalizeFee_LinkCapDirect = script do owner <- allocateParty "owner-link-direct-cap" @@ -1011,28 +1036,28 @@ testFinalizeFee_LinkCapDirect = script do -- $1.50 fee at $15/LINK -> 0.1 LINK feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-link-direct-cap" feeTokens = Set.fromList [linkToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] usdPerToken = Map.fromList - [ (linkToken, TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0)) ] + [ (linkToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0)) ] linkTokenInstrumentId = linkToken priceUpdaters = [owner] sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-link-direct-cap" sender - onRamp = RawInstanceAddress.make "onramp-link-direct-cap" owner - globalConfig = RawInstanceAddress.make "globalconfig-link-direct-cap" owner - rmnRemote = RawInstanceAddress.make "rmn-link-direct-cap" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-link-direct-cap" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-link-direct-cap" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-link-direct-cap" sender + onRamp = Chainlink.InstanceAddress.make "onramp-link-direct-cap" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-link-direct-cap" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-link-direct-cap" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-link-direct-cap" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-link-direct-cap" owner ccipOwner = owner sender = sender destChainSelector = 456.0 @@ -1041,8 +1066,8 @@ testFinalizeFee_LinkCapDirect = script do requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "executor-link-direct-cap" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "executor-link-direct-cap" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -1057,6 +1082,7 @@ testFinalizeFee_LinkCapDirect = script do feeToken = linkToken networkFeeUSDCents = cents 150.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -1075,7 +1101,7 @@ testFinalizeFee_LinkCapDirect = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid @@ -1084,7 +1110,7 @@ testFinalizeFee_LinkCapDirect = script do debug "testFinalizeFee_LinkCapDirect: PASSED" --- QuoteGasForExec + SendingMessageV1.FinalizeFee should still sum all +-- QuoteGasForExec + CCIP.CoreV1.SendingMessage.FinalizeFee should still sum all -- converted fee components correctly. testFinalizeFee_LinkCapMixedFees = script do owner <- allocateParty "owner-link-mixed-cap" @@ -1098,38 +1124,38 @@ testFinalizeFee_LinkCapMixedFees = script do id = "LINK" feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-link-mixed-cap" feeTokens = Set.fromList [linkToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] usdPerToken = Map.fromList - [ (linkToken, TimestampedPrice 20.0 (time (date 2026 Jan 1) 0 0 0)) ] + [ (linkToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 20.0 (time (date 2026 Jan 1) 0 0 0)) ] linkTokenInstrumentId = linkToken priceUpdaters = [owner] sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-link-mixed-cap" sender - onRamp = RawInstanceAddress.make "onramp-link-mixed-cap" owner - globalConfig = RawInstanceAddress.make "globalconfig-link-mixed-cap" owner - rmnRemote = RawInstanceAddress.make "rmn-link-mixed-cap" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-link-mixed-cap" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-link-mixed-cap" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-link-mixed-cap" sender + onRamp = Chainlink.InstanceAddress.make "onramp-link-mixed-cap" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-link-mixed-cap" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-link-mixed-cap" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-link-mixed-cap" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-link-mixed-cap" owner ccipOwner = owner sender = sender destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 - requiredCCVs = [RawInstanceAddress.make "ccv-link-mixed-cap" ccvOwner] + requiredCCVs = [Chainlink.InstanceAddress.make "ccv-link-mixed-cap" ccvOwner] destDefaultCCVs = [] - requiredExecutor = Some (RawInstanceAddress.make "executor-link-mixed-cap" executorOwner) - executorAddress = RawInstanceAddress.toInstanceAddress(RawInstanceAddress.make "executor-link-mixed-cap" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_Executor + requiredExecutor = Some (Chainlink.InstanceAddress.make "executor-link-mixed-cap" executorOwner) + executorAddress = Chainlink.InstanceAddress.toInstanceAddress(Chainlink.InstanceAddress.make "executor-link-mixed-cap" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -1144,6 +1170,7 @@ testFinalizeFee_LinkCapMixedFees = script do feeToken = linkToken networkFeeUSDCents = cents 100.0 expectedTokenInstrumentId = Some linkToken + tokenAmountBeforeTokenPoolFees = 10.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -1162,31 +1189,34 @@ testFinalizeFee_LinkCapMixedFees = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedSm <- fromSome <$> queryDisclosure owner sendingMessageCid sendingMessageCid <- submit (actAs ccvOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-link-mixed-cap" feeUSDCents = cents 100.0 destGasLimit = 10000 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner sendingMessageCid <- submit owner do - exerciseCmd sendingMessageCid SendingMessageV1.AddTokenSendFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSendFee with poolInstanceId = "pool-link-mixed-cap" poolOwner = poolOwner feeUSDCents = cents 100.0 destGasOverhead = 50000 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedSm <- fromSome <$> queryDisclosure ccvOwner sendingMessageCid sendingMessageCid <- submit (actAs executorOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid SendingMessageV1.AddExecutorFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddExecutorFee with executorInstanceId = "executor-link-mixed-cap" executorArgs = "" feeUSDCents = cents 100.0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = executorOwner sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid @@ -1207,12 +1237,12 @@ testCalculateFeeResult_CCVRoundingMatchesFinalizeFee = script do id = "USDC" globalConfig <- submit owner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = "globalconfig-ccv-rounding-quote" ccipOwner = owner chainSelector = 123.0 destChainConfigs = Map.fromList - [ (456.0, GlobalConfig.DestChainConfig with + [ (456.0, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False @@ -1228,64 +1258,65 @@ testCalculateFeeResult_CCVRoundingMatchesFinalizeFee = script do sourceChainConfigs = Map.empty feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-ccv-rounding-quote" feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] usdPerToken = Map.fromList - [(feeToken, TimestampedPrice 6.0 (time (date 2026 Jan 1) 0 0 0))] + [(feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 6.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "LINK" priceUpdaters = [owner] onRamp <- submit owner do - createCmd OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = "onramp-ccv-rounding-quote" ccipOwner = owner maxUSDCentsPerMsg = 1000000.0 - deps = OnRampTypes.OnRampDeps with - globalConfig = RawInstanceAddress.make "globalconfig-ccv-rounding-quote" owner - rmnRemote = RawInstanceAddress.make "rmn-ccv-rounding-quote" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-ccv-rounding-quote" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-ccv-rounding-quote" owner - ccvRegistry = RawInstanceAddress.make "ccvregistry-ccv-rounding-quote" owner + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with + globalConfig = Chainlink.InstanceAddress.make "globalconfig-ccv-rounding-quote" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-ccv-rounding-quote" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-ccv-rounding-quote" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-ccv-rounding-quote" owner feeQuote <- submit owner do - exerciseCmd onRamp OnRamp.GetFeeFromRouter with + exerciseCmd onRamp CCIP.RuntimeV1.OnRamp.GetFeeFromRouter with routerPartyOwner = owner routerInstanceId = "router-ccv-rounding-quote" globalConfigCid = globalConfig feeQuoterCid = feeQuoter destChainSelector = 456.0 - message = Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" payload = "" tokenTransfer = None feeToken = feeToken - extraArgs = Client.V3 Client.GenericExtraArgsV3 with + extraArgs = CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = 0 ccvs = [] - executor = Client.Executor_NoExecutor + executor = CCIP.ClientV1.Executor_NoExecutor tokenReceiver = "" tokenArgs = "" ccvFeeQuotes = - [ ICCV.CrossChainVerifierFeeQuote with + [ CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote with ccvInstanceId = "ccv-rounding-quote-1" ccvOwner = owner feeUSDCents = 1.0 gasForVerification = 0 payloadSizeBytes = 0 - , ICCV.CrossChainVerifierFeeQuote with + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + , CCIP.InterfacesV1.CrossChainVerifier.CrossChainVerifierFeeQuote with ccvInstanceId = "ccv-rounding-quote-2" ccvOwner = owner feeUSDCents = 1.0 gasForVerification = 0 payloadSizeBytes = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext ] tokenPoolFeeQuote = None executorFeeQuote = None @@ -1308,41 +1339,41 @@ testFinalizeFee_ReceiptSumsMatchQuoteInputs_MixedFees = script do id = "USDC" feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-receipt-mixed" feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] usdPerToken = Map.fromList - [(feeToken, TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0))] + [(feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "LINK" priceUpdaters = [owner] sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-receipt-mixed" sender - onRamp = RawInstanceAddress.make "onramp-receipt-mixed" owner - globalConfig = RawInstanceAddress.make "globalconfig-receipt-mixed" owner - rmnRemote = RawInstanceAddress.make "rmn-receipt-mixed" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-receipt-mixed" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-receipt-mixed" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-receipt-mixed" sender + onRamp = Chainlink.InstanceAddress.make "onramp-receipt-mixed" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-receipt-mixed" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-receipt-mixed" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-receipt-mixed" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-receipt-mixed" owner ccipOwner = owner sender = sender destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 - requiredCCVs = [RawInstanceAddress.make "ccv-receipt-mixed" ccvOwner] + requiredCCVs = [Chainlink.InstanceAddress.make "ccv-receipt-mixed" ccvOwner] destDefaultCCVs = [] - requiredExecutor = Some (RawInstanceAddress.make "executor-receipt-mixed" executorOwner) - executorAddress = RawInstanceAddress.toInstanceAddress - (RawInstanceAddress.make "executor-receipt-mixed" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_Executor + requiredExecutor = Some (Chainlink.InstanceAddress.make "executor-receipt-mixed" executorOwner) + executorAddress = Chainlink.InstanceAddress.toInstanceAddress + (Chainlink.InstanceAddress.make "executor-receipt-mixed" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -1357,6 +1388,7 @@ testFinalizeFee_ReceiptSumsMatchQuoteInputs_MixedFees = script do feeToken = feeToken networkFeeUSDCents = cents 100.0 expectedTokenInstrumentId = Some feeToken + tokenAmountBeforeTokenPoolFees = 10.0 outboundPoolCCVs = Some [] executorArgs = "beef" executorFee = None @@ -1371,7 +1403,7 @@ testFinalizeFee_ReceiptSumsMatchQuoteInputs_MixedFees = script do networkFeeTokenAmount = 0.0 tokenSendData = None verifierData = - [SendingMessageV1.VerifierData with + [CCIP.CoreV1.SendingMessage.VerifierData with ccvInstanceId = "ccv-receipt-mixed" ccvOwner = ccvOwner versionTag = "" @@ -1382,53 +1414,57 @@ testFinalizeFee_ReceiptSumsMatchQuoteInputs_MixedFees = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedSm <- fromSome <$> queryDisclosure owner sendingMessageCid sendingMessageCid <- submit (actAs ccvOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-receipt-mixed" feeUSDCents = cents 100.0 destGasLimit = 10000 destBytesOverhead = 111 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner sendingMessageCid <- submit owner do - exerciseCmd sendingMessageCid SendingMessageV1.AddTokenSendFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSendFee with poolInstanceId = "pool-receipt-mixed" poolOwner = poolOwner feeUSDCents = cents 100.0 destGasOverhead = 50000 destBytesOverhead = 222 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedSm2 <- fromSome <$> queryDisclosure ccvOwner sendingMessageCid sendingMessageCid <- submit (actAs executorOwner <> disclose disclosedSm2) do - exerciseCmd sendingMessageCid SendingMessageV1.AddExecutorFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddExecutorFee with executorInstanceId = "executor-receipt-mixed" executorArgs = "beef" feeUSDCents = cents 100.0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = executorOwner sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid sendingMessageCid <- submit owner do - exerciseCmd sendingMessageCid SendingMessageV1.AddTokenSend with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSend with poolInstanceId = "pool-receipt-mixed" poolOwner = poolOwner instrumentId = feeToken - amount = fromSome (MessageCodecV1.encodeUint256 1.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1.0) destTokenAddress = "c5eca3e3acae6461d1f3f7f01fb60993c4b129e3" extraData = "" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext Some sm <- queryContractId owner sendingMessageCid - let receipts = OnRamp.assembleReceipts sm + let receipts = CCIP.RuntimeV1.OnRamp.assembleReceipts sm assertReceiptSumsMatchQuoteInputs sm receipts map (.issuerType) receipts === - [ Tickets.IssuerType_CCV - , Tickets.IssuerType_Pool - , Tickets.IssuerType_Executor - , Tickets.IssuerType_Network + [ CCIP.EventsV1.Receipts.IssuerType_CCV + , CCIP.EventsV1.Receipts.IssuerType_Pool + , CCIP.EventsV1.Receipts.IssuerType_Executor + , CCIP.EventsV1.Receipts.IssuerType_Network ] debug "testFinalizeFee_ReceiptSumsMatchQuoteInputs_MixedFees: PASSED" @@ -1444,41 +1480,41 @@ testFinalizeFee_ReceiptSumsMatchQuoteInputs_CCVAndExecutor = script do id = "USDC" feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-receipt-msg" feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList [(456.0, testDestChainConfig)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(456.0, TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] + [(456.0, CCIP.CoreV1.FeeQuoter.TimestampedPrice 0.0 (time (date 2026 Jan 1) 0 0 0))] usdPerToken = Map.fromList - [(feeToken, TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0))] + [(feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "LINK" priceUpdaters = [owner] sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-receipt-msg" sender - onRamp = RawInstanceAddress.make "onramp-receipt-msg" owner - globalConfig = RawInstanceAddress.make "globalconfig-receipt-msg" owner - rmnRemote = RawInstanceAddress.make "rmn-receipt-msg" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-receipt-msg" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-receipt-msg" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-receipt-msg" sender + onRamp = Chainlink.InstanceAddress.make "onramp-receipt-msg" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-receipt-msg" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-receipt-msg" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-receipt-msg" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-receipt-msg" owner ccipOwner = owner sender = sender destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 - requiredCCVs = [RawInstanceAddress.make "ccv-receipt-msg" ccvOwner] + requiredCCVs = [Chainlink.InstanceAddress.make "ccv-receipt-msg" ccvOwner] destDefaultCCVs = [] - requiredExecutor = Some (RawInstanceAddress.make "executor-receipt-msg" executorOwner) - executorAddress = RawInstanceAddress.toInstanceAddress - (RawInstanceAddress.make "executor-receipt-msg" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_Executor + requiredExecutor = Some (Chainlink.InstanceAddress.make "executor-receipt-msg" executorOwner) + executorAddress = Chainlink.InstanceAddress.toInstanceAddress + (Chainlink.InstanceAddress.make "executor-receipt-msg" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -1493,6 +1529,7 @@ testFinalizeFee_ReceiptSumsMatchQuoteInputs_CCVAndExecutor = script do feeToken = feeToken networkFeeUSDCents = cents 100.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "00" executorFee = None @@ -1507,7 +1544,7 @@ testFinalizeFee_ReceiptSumsMatchQuoteInputs_CCVAndExecutor = script do networkFeeTokenAmount = 0.0 tokenSendData = None verifierData = - [SendingMessageV1.VerifierData with + [CCIP.CoreV1.SendingMessage.VerifierData with ccvInstanceId = "ccv-receipt-msg" ccvOwner = ccvOwner versionTag = "" @@ -1518,35 +1555,37 @@ testFinalizeFee_ReceiptSumsMatchQuoteInputs_CCVAndExecutor = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedSm <- fromSome <$> queryDisclosure owner sendingMessageCid sendingMessageCid <- submit (actAs ccvOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-receipt-msg" feeUSDCents = cents 25.0 destGasLimit = 1234 destBytesOverhead = 44 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner disclosedSm2 <- fromSome <$> queryDisclosure ccvOwner sendingMessageCid sendingMessageCid <- submit (actAs executorOwner <> disclose disclosedSm2) do - exerciseCmd sendingMessageCid SendingMessageV1.AddExecutorFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddExecutorFee with executorInstanceId = "executor-receipt-msg" executorArgs = "00" feeUSDCents = cents 50.0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = executorOwner sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid Some sm <- queryContractId owner sendingMessageCid - let receipts = OnRamp.assembleReceipts sm + let receipts = CCIP.RuntimeV1.OnRamp.assembleReceipts sm assertReceiptSumsMatchQuoteInputs sm receipts map (.issuerType) receipts === - [ Tickets.IssuerType_CCV - , Tickets.IssuerType_Executor - , Tickets.IssuerType_Network + [ CCIP.EventsV1.Receipts.IssuerType_CCV + , CCIP.EventsV1.Receipts.IssuerType_Executor + , CCIP.EventsV1.Receipts.IssuerType_Network ] debug "testFinalizeFee_ReceiptSumsMatchQuoteInputs_CCVAndExecutor: PASSED" @@ -1567,8 +1606,8 @@ testFinalizeFee_PayloadBytesCountedOnce = script do let destChainSelector = 456.0 feeQuoter <- submit owner do - createCmd CCIP.FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-payload-once" feeTokens = Set.fromList [feeToken] destChainConfigs = Map.fromList @@ -1578,9 +1617,9 @@ testFinalizeFee_PayloadBytesCountedOnce = script do ] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList - [(destChainSelector, TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0))] + [(destChainSelector, CCIP.CoreV1.FeeQuoter.TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0))] usdPerToken = Map.fromList - [(feeToken, TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0))] + [(feeToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 1.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "LINK" @@ -1597,14 +1636,14 @@ testFinalizeFee_PayloadBytesCountedOnce = script do + (2 + payloadBytes) sendingMessageCid <- submit owner do - createCmd SendingMessageV1.SendingMessageV1 with - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-payload-once" sender - onRamp = RawInstanceAddress.make "onramp-payload-once" owner - globalConfig = RawInstanceAddress.make "globalconfig-payload-once" owner - rmnRemote = RawInstanceAddress.make "rmn-payload-once" owner - tokenAdminRegistry = RawInstanceAddress.make "tar-payload-once" owner - feeQuoter = RawInstanceAddress.make "test-feequoter-payload-once" owner + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-payload-once" sender + onRamp = Chainlink.InstanceAddress.make "onramp-payload-once" owner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-payload-once" owner + rmnRemote = Chainlink.InstanceAddress.make "rmn-payload-once" owner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-payload-once" owner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-payload-once" owner ccipOwner = owner sender = sender destChainSelector = destChainSelector @@ -1614,7 +1653,7 @@ testFinalizeFee_PayloadBytesCountedOnce = script do destDefaultCCVs = [] requiredExecutor = None executorAddress = "00" - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = "01" receiver = "cbabbd0f4cddee14bc07072de46d2a78a2ed3f17" @@ -1629,6 +1668,7 @@ testFinalizeFee_PayloadBytesCountedOnce = script do feeToken = feeToken networkFeeUSDCents = 0.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -1647,13 +1687,13 @@ testFinalizeFee_PayloadBytesCountedOnce = script do message = None encodedMessage = "" messageId = "" - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared sendingMessageCid <- finalizeUsingQuote owner feeQuoter sendingMessageCid Some sm <- queryContractId owner sendingMessageCid let expectedGas = executorDestBytesOverhead * destGasPerPayloadByteBase - let expectedExecutionCost = SendingMessageV1.gasCostUsdCents 1.0 expectedGas + let expectedExecutionCost = CCIP.CoreV1.SendingMessage.gasCostUsdCents 1.0 expectedGas sm.executorDestBytesOverhead === executorDestBytesOverhead sm.executionGasLimit === expectedGas @@ -1662,20 +1702,21 @@ testFinalizeFee_PayloadBytesCountedOnce = script do -- If payload were double-counted, both totalGas and gasCostUSDCents would be larger -- by payloadBytes * destGasPerPayloadByteBase. quote <- submit owner do - exerciseCmd feeQuoter QuoteGasForExec with + exerciseCmd feeQuoter CCIP.CoreV1.FeeQuoter.QuoteGasForExec with destChainSelector = destChainSelector nonCalldataGas = sm.executorDestGasLimit calldataSize = sm.executorDestBytesOverhead feeToken = feeToken + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner quote.totalGas === expectedGas quote.gasCostUSDCents === expectedExecutionCost - let receipts = OnRamp.assembleReceipts sm + let receipts = CCIP.RuntimeV1.OnRamp.assembleReceipts sm assertReceiptSumsMatchQuoteInputs sm receipts map (.issuerType) receipts === - [ Tickets.IssuerType_Executor - , Tickets.IssuerType_Network + [ CCIP.EventsV1.Receipts.IssuerType_Executor + , CCIP.EventsV1.Receipts.IssuerType_Network ] case receipts of [executorReceipt, networkReceipt] -> do diff --git a/contracts/ccip/test/daml/LockReleaseTokenPoolTest.daml b/contracts/ccip/test/daml/LockReleaseTokenPoolTest.daml index 632b1bb4f..800908c8d 100644 --- a/contracts/ccip/test/daml/LockReleaseTokenPoolTest.daml +++ b/contracts/ccip/test/daml/LockReleaseTokenPoolTest.daml @@ -12,29 +12,32 @@ import DA.Optional import DA.Set qualified as Set import DA.TextMap qualified as TextMap import DA.Time (time) -import qualified CCIP.Context -import CCIP.Events qualified as Events -import CCIP.ExecutingMessageV1 qualified as ExecutingMessageV1 -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.FeeQuoter qualified as FeeQuoter -import CCIP.Internal qualified as Internal -import CCIP.Interfaces.TokenPool qualified as ITokenPool -import CCIP.LockReleaseTokenPool qualified as LockReleaseTokenPool -import CCIP.MessageCodecV1 qualified as MessageCodecV1 -import CCIP.RateLimiter qualified as RateLimiter -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.RMNRemote qualified as RMNRemote -import CCIP.SendingMessageV1 qualified as SendingMessageV1 -import CCIP.Tickets qualified as Tickets -import CCIP.TokenAdminRegistry qualified as TokenAdminRegistry -import CCIP.TokenAdminRegistryTypes qualified as TokenAdminRegistryTypes -import CCIP.Uint256 qualified as Uint256 - -import Splice.Api.Token.HoldingV1 qualified as HoldingV1 -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 -import Splice.Api.Token.TransferInstructionV1 qualified as TransferInstructionV1 - -import TestToken qualified + +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 +import qualified Splice.Api.Token.TransferInstructionV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.SendingMessage +import qualified CCIP.EventsV1.Events +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CodecV1.Uint256 +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.SendingMessage +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.InterfacesV1.TokenPool +import qualified CCIP.LockReleaseTokenPoolV1 +import qualified CCIP.RateLimiterV1 +import qualified CCIP.TicketsV1 +import qualified CCIP.UtilsV1.Context + +import qualified TestToken usd : Decimal -> Numeric 0 usd d = intToNumeric (truncate (d * 100000000.0)) @@ -50,34 +53,34 @@ mult m = intToNumeric (truncate (m * 100000000.0)) finalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n rawFinalityConfig n = if n == 0 - then FinalityCodec.waitForFinalityFlag + then CCIP.CodecV1.FinalityConfig.waitForFinalityFlag else fromSome do - flagsHex <- MessageCodecV1.encodeUint16 0 - blockConfirmationsHex <- MessageCodecV1.encodeUint16 n + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 n pure (flagsHex <> blockConfirmationsHex) unsafeDecodeRequestedFinality finalityConfig = fromSomeNote "unsafeDecodeRequestedFinality: invalid finality config" - (FinalityCodec.decodeRequestedFinality finalityConfig) + (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalityConfig) messageFinality n = unsafeDecodeRequestedFinality (rawFinalityConfig n) -mkPoolContext : ContractId RateLimiter.RateLimiter -> ContractId TransferInstructionV1.TransferFactory -> [ContractId HoldingV1.Holding] -> [(Party, ContractId TestToken.TestTransferPreapproval)] -> MetadataV1.ChoiceContext +mkPoolContext : ContractId CCIP.RateLimiterV1.RateLimiter -> ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory -> [ContractId Splice.Api.Token.HoldingV1.Holding] -> [(Party, ContractId TestToken.TestTransferPreapproval)] -> Splice.Api.Token.MetadataV1.ChoiceContext mkPoolContext rateLimiterCid burnMintFactoryCid tokenPoolHoldings preapprovals = - let preapprovalMap = TextMap.fromList [(show p, MetadataV1.AV_ContractId $ coerceContractId cid) | (p, cid) <- preapprovals] + let preapprovalMap = TextMap.fromList [(show p, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId cid) | (p, cid) <- preapprovals] extraArgsContextEntry = case preapprovals of [] -> [] - _ -> [(LockReleaseTokenPool.transferFactoryExtraArgsContextValuesContextKey, MetadataV1.AV_Map preapprovalMap)] - in MetadataV1.ChoiceContext with + _ -> [(CCIP.LockReleaseTokenPoolV1.transferFactoryExtraArgsContextValuesContextKey, Splice.Api.Token.MetadataV1.AV_Map preapprovalMap)] + in Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList ( - [ (RateLimiter.rateLimiterKey, CCIP.Context.toAnyValue rateLimiterCid) - , (LockReleaseTokenPool.transferFactoryContextKey, CCIP.Context.toAnyValue burnMintFactoryCid) - , (LockReleaseTokenPool.tokenPoolHoldingsContextKey, CCIP.Context.toAnyValue tokenPoolHoldings) + [ (CCIP.RateLimiterV1.rateLimiterContextKey, CCIP.UtilsV1.Context.toAnyValue rateLimiterCid) + , (CCIP.LockReleaseTokenPoolV1.transferFactoryContextKey, CCIP.UtilsV1.Context.toAnyValue burnMintFactoryCid) + , (CCIP.LockReleaseTokenPoolV1.tokenPoolHoldingsContextKey, CCIP.UtilsV1.Context.toAnyValue tokenPoolHoldings) ] ++ extraArgsContextEntry) template ParseSourcePoolDecimalsHarness @@ -91,7 +94,7 @@ template ParseSourcePoolDecimalsHarness localDecimals : Int sourcePoolData : BytesHex controller owner - do pure (LockReleaseTokenPool.parseSourcePoolDecimals localDecimals sourcePoolData) + do pure (CCIP.LockReleaseTokenPoolV1.parseSourcePoolDecimals localDecimals sourcePoolData) template CalculateLocalAmountHarness with @@ -106,85 +109,88 @@ template CalculateLocalAmountHarness localDecimals : Int controller owner do - pure (LockReleaseTokenPool.calculateLocalAmount amount remoteDecimals localDecimals) + pure (CCIP.LockReleaseTokenPoolV1.calculateLocalAmount amount remoteDecimals localDecimals) -mkPoolDeps : Text -> Text -> Text -> Party -> Party -> LockReleaseTokenPool.LockReleaseTokenPoolDeps +mkPoolDeps : Text -> Text -> Text -> Party -> Party -> CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPoolDeps mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner = - LockReleaseTokenPool.LockReleaseTokenPoolDeps with - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner + CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPoolDeps with + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner createRateLimiter : Party -> Text -> Numeric 0 - -> RateLimiter.RateLimitDirection + -> CCIP.RateLimiterV1.RateLimitDirection -> Numeric 0 -> Numeric 0 - -> Script (ContractId RateLimiter.RateLimiter, RawInstanceAddress.RawInstanceAddress) + -> Script (ContractId CCIP.RateLimiterV1.RateLimiter, Chainlink.InstanceAddress.RawInstanceAddress) createRateLimiter poolOwner poolInstanceId remoteChainSelector direction capacity rate = do now <- getTime let instanceId = poolInstanceId <> "-" <> (case direction of - RateLimiter.RateLimitDirection_Outbound -> "outbound" - RateLimiter.RateLimitDirection_Inbound -> "inbound") + CCIP.RateLimiterV1.RateLimitDirection_Outbound -> "outbound" + CCIP.RateLimiterV1.RateLimitDirection_Inbound -> "inbound") <> "-" <> show remoteChainSelector rateLimiterCid <- submit poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = instanceId poolInstanceId = poolInstanceId poolOwner = poolOwner remoteChainSelector = remoteChainSelector direction = direction - mode = RateLimiter.RateLimitMode_DefaultFinality + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = capacity rate = rate tokens = capacity lastUpdated = now - pure (rateLimiterCid, RawInstanceAddress.make instanceId poolOwner) + pure (rateLimiterCid, Chainlink.InstanceAddress.make instanceId poolOwner) setupTokenAdminRegistryWithPool : Party -> Party -> Text - -> HoldingV1.InstrumentId + -> Splice.Api.Token.HoldingV1.InstrumentId -> Text - -> Script (ContractId TokenAdminRegistry.TokenAdminRegistry, ContractId TokenAdminRegistry.TokenConfig) + -> Script (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry, ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) setupTokenAdminRegistryWithPool ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId = do tokenAdminRegistry0 <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with - owner = ccipOwner + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with + ccipOwner = ccipOwner instanceId = tokenAdminRegistryInstanceId entryCount = 0 proposeResult <- submit ccipOwner do - exerciseCmd tokenAdminRegistry0 TokenAdminRegistry.ProposeAdministrator with + exerciseCmd tokenAdminRegistry0 CCIP.CoreV1.TokenAdminRegistry.ProposeAdministrator with tokenConfigCid = None instrumentId = instrumentId newAdmin = poolOwner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccipOwner let tokenAdminRegistry = proposeResult.tokenAdminRegistryCid tokenConfigCid0 = proposeResult.tokenConfigCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry tokenConfigCid1 <- submit (actAs poolOwner <> disclose disclosedTar) do - exerciseCmd tokenAdminRegistry TokenAdminRegistry.AcceptAdminRole with + exerciseCmd tokenAdminRegistry CCIP.CoreV1.TokenAdminRegistry.AcceptAdminRole with tokenConfigCid = tokenConfigCid0 instrumentId = instrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry tokenConfigCid2 <- submit (actAs poolOwner <> disclose disclosedTar) do - exerciseCmd tokenAdminRegistry TokenAdminRegistry.SetPool with + exerciseCmd tokenAdminRegistry CCIP.CoreV1.TokenAdminRegistry.SetPool with tokenConfigCid = tokenConfigCid1 instrumentId = instrumentId - tokenPool = Some TokenAdminRegistryTypes.PoolRegistration with + tokenPool = Some CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner = poolOwner poolInstanceId = tokenPoolInstanceId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner pure (tokenAdminRegistry, tokenConfigCid2) @@ -207,16 +213,16 @@ testLockOrBurn = script do let destChainSelector : Numeric 0 = 456.0 let sourceChainSelector : Numeric 0 = 123.0 - let linkToken = HoldingV1.InstrumentId with + let linkToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -253,10 +259,11 @@ testLockOrBurn = script do disclosedTarForFactorySet <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry disclosedTransferFactoryForSet <- fromSome <$> queryDisclosure ccipOwner transferFactory tokenConfigCid <- submit (actAs poolOwner <> disclose disclosedTarForFactorySet <> disclose disclosedTransferFactoryForSet) do - exerciseCmd tokenAdminRegistry TokenAdminRegistry.SetTransferFactory with + exerciseCmd tokenAdminRegistry CCIP.CoreV1.TokenAdminRegistry.SetTransferFactory with tokenConfigCid instrumentId = testInstrumentId transferFactory = Some (toInterfaceContractId transferFactory) + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner badTransferFactory <- submit ccipOwner do @@ -271,22 +278,22 @@ testLockOrBurn = script do poolOwner tokenPoolInstanceId destChainSelector - RateLimiter.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitDirection_Outbound 100000000000.0 10000000.0 -- Deploy LockReleaseTokenPool with remote chain config - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder outboundRateLimiter = outboundRateLimiterAddr tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -294,38 +301,38 @@ testLockOrBurn = script do decimals = 10 rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, existingConfig)] - tokenTransferFeeConfigs = Map.fromList [(destChainSelector, LockReleaseTokenPool.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(destChainSelector, CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfig with isEnabled = False feeUSDCents = cents 0.0 feeBps = 750.0 destGasOverhead = 0 destBytesOverhead = 32)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner - -- Create SendingMessageV1 with token transfer fields. + -- Create SendingMessage with token transfer fields. -- LockOrBurn reads dest chain, token amount, and receiver from here. - let senderAddr = MessageCodecV1.encodePartyAddress sender + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router" sender - onRamp = RawInstanceAddress.make "test-onramp" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig" ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner destChainSelector = destChainSelector destAddressBytesLength = 20 sequenceNumber = 1.0 requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor" ccipOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor" ccipOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = sourceChainSelector senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -343,6 +350,7 @@ testLockOrBurn = script do feeToken = testInstrumentId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some testInstrumentId + tokenAmountBeforeTokenPoolFees = 5.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -350,7 +358,7 @@ testLockOrBurn = script do executorDestBytesOverhead = 0 executorFeeTokenAmount = 0.0 ccvFees = [] - tokenSendFee = Some (SendingMessageV1.TokenSendFee with + tokenSendFee = Some (CCIP.CoreV1.SendingMessage.TokenSendFee with poolInstanceId = "test-lock-release-pool" poolOwner = poolOwner feeUSDCents = cents 0.0 @@ -363,7 +371,7 @@ testLockOrBurn = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_FeeFinalized + state = CCIP.CoreV1.SendingMessage.SendingMessageState_FeeFinalized -- Disclose contracts disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool @@ -380,14 +388,14 @@ testLockOrBurn = script do <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [toInterfaceContractId senderHolding] amount = 0.0 - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [] [(poolOwner, poolPreapproval)] + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [] [(poolOwner, poolPreapproval)] caller = sender -- Test that LockOrBurn with a negative amount fails. @@ -395,14 +403,14 @@ testLockOrBurn = script do <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [toInterfaceContractId senderHolding] amount = -5.0 - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [] [(poolOwner, poolPreapproval)] + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [] [(poolOwner, poolPreapproval)] caller = sender -- Configured TokenConfig pins the real transfer factory and rejects a mismatched context factory. @@ -410,14 +418,14 @@ testLockOrBurn = script do <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedBadFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [toInterfaceContractId senderHolding] amount = 5.0 - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext outboundRateLimiter (toInterfaceContractId badTransferFactory) [] [(poolOwner, poolPreapproval)] + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext outboundRateLimiter (toInterfaceContractId badTransferFactory) [] [(poolOwner, poolPreapproval)] caller = sender -- LockOrBurn stores token data via AddTokenSend @@ -425,14 +433,14 @@ testLockOrBurn = script do <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [toInterfaceContractId senderHolding] amount = 5.0 - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [] [(poolOwner, poolPreapproval)] + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [] [(poolOwner, poolPreapproval)] caller = sender -- Verify pool received tokens (5 tokens) @@ -451,9 +459,9 @@ testLockOrBurn = script do senderC.amount === 5.0 senderC.owner === sender - Some updatedSendingMessage <- queryContractId ccipOwner result.sendingMessageCid + Some updatedSendingMessage <- queryContractId ccipOwner (coerceContractId result.sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) let tokenSendData = fromSome updatedSendingMessage.tokenSendData - tokenSendData.amount === fromSome (MessageCodecV1.encodeUint256 50000000000.0) + tokenSendData.amount === fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 50000000000.0) debug "testLockOrBurn: PASSED" @@ -474,14 +482,14 @@ testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem = script do let destChainSelector : Numeric 0 = 456.0 let sourceChainSelector : Numeric 0 = 123.0 - let linkToken = HoldingV1.InstrumentId with + let linkToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -522,21 +530,21 @@ testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem = script do poolOwner tokenPoolInstanceId destChainSelector - RateLimiter.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitDirection_Outbound 100000000000.0 10000000.0 - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" outboundRateLimiter = outboundRateLimiterAddr tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -544,36 +552,36 @@ testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem = script do decimals = 10 rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, existingConfig)] - tokenTransferFeeConfigs = Map.fromList [(destChainSelector, LockReleaseTokenPool.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(destChainSelector, CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfig with isEnabled = False feeUSDCents = cents 0.0 feeBps = 750.0 destGasOverhead = 0 destBytesOverhead = 32)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner - let senderAddr = MessageCodecV1.encodePartyAddress sender + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router" sender - onRamp = RawInstanceAddress.make "test-onramp" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig" ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner destChainSelector = destChainSelector destAddressBytesLength = 20 sequenceNumber = 1.0 requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor" ccipOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor" ccipOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = sourceChainSelector senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -591,6 +599,7 @@ testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem = script do feeToken = testInstrumentId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some testInstrumentId + tokenAmountBeforeTokenPoolFees = 5.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -598,7 +607,7 @@ testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem = script do executorDestBytesOverhead = 0 executorFeeTokenAmount = 0.0 ccvFees = [] - tokenSendFee = Some (SendingMessageV1.TokenSendFee with + tokenSendFee = Some (CCIP.CoreV1.SendingMessage.TokenSendFee with poolInstanceId = tokenPoolInstanceId poolOwner = poolOwner feeUSDCents = cents 0.0 @@ -611,7 +620,7 @@ testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_FeeFinalized + state = CCIP.CoreV1.SendingMessage.SendingMessageState_FeeFinalized disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry @@ -627,14 +636,14 @@ testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem = script do <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedExistingPoolHolding) do - exerciseCmd tokenPool LockReleaseTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [toInterfaceContractId senderHolding] amount = 5.0 - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId existingPoolHolding] [(poolOwner, poolPreapproval)] + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId existingPoolHolding] [(poolOwner, poolPreapproval)] caller = sender assertMsg "Pool should see one new holding plus one existing holding" (length result.poolChangeCids == 2) @@ -648,9 +657,9 @@ testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem = script do let existingPoolH = fromSome existingPoolHoldingFetched existingPoolH.amount === 3.0 - Some updatedSendingMessage <- queryContractId ccipOwner result.sendingMessageCid + Some updatedSendingMessage <- queryContractId ccipOwner (coerceContractId result.sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) let tokenSendData = fromSome updatedSendingMessage.tokenSendData - tokenSendData.amount === fromSome (MessageCodecV1.encodeUint256 50000000000.0) + tokenSendData.amount === fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 50000000000.0) debug "testLockOrBurnValidatesExistingPoolHoldingsAndPreservesThem: PASSED" @@ -670,15 +679,15 @@ testLockOrBurnDeductsFeeBps = script do let destChainSelector : Numeric 0 = 456.0 let sourceChainSelector : Numeric 0 = 123.0 - let linkToken = HoldingV1.InstrumentId with + let linkToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -712,21 +721,21 @@ testLockOrBurnDeductsFeeBps = script do poolOwner tokenPoolInstanceId destChainSelector - RateLimiter.RateLimitDirection_Outbound + CCIP.RateLimiterV1.RateLimitDirection_Outbound 100000000000.0 10000000.0 - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" outboundRateLimiter = outboundRateLimiterAddr tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -734,36 +743,36 @@ testLockOrBurnDeductsFeeBps = script do decimals = 10 rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, existingConfig)] - tokenTransferFeeConfigs = Map.fromList [(destChainSelector, LockReleaseTokenPool.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(destChainSelector, CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfig with isEnabled = True feeUSDCents = cents 0.0 feeBps = 500.0 destGasOverhead = 0 destBytesOverhead = 32)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId feeQuoterInstanceId ccipOwner rmnOwner - let senderAddr = MessageCodecV1.encodePartyAddress sender + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router-bps" sender - onRamp = RawInstanceAddress.make "test-onramp-bps" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig-bps" ccipOwner - rmnRemote = RawInstanceAddress.make rmnInstanceId rmnOwner - tokenAdminRegistry = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router-bps" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp-bps" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-bps" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner destChainSelector = destChainSelector destAddressBytesLength = 20 sequenceNumber = 1.0 requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor-bps" ccipOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor-bps" ccipOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = sourceChainSelector senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -781,6 +790,7 @@ testLockOrBurnDeductsFeeBps = script do feeToken = testInstrumentId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some testInstrumentId + tokenAmountBeforeTokenPoolFees = 5.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -788,7 +798,7 @@ testLockOrBurnDeductsFeeBps = script do executorDestBytesOverhead = 0 executorFeeTokenAmount = 0.0 ccvFees = [] - tokenSendFee = Some (SendingMessageV1.TokenSendFee with + tokenSendFee = Some (CCIP.CoreV1.SendingMessage.TokenSendFee with poolInstanceId = "test-lock-release-pool-bps" poolOwner = poolOwner feeUSDCents = cents 0.0 @@ -801,7 +811,7 @@ testLockOrBurnDeductsFeeBps = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_FeeFinalized + state = CCIP.CoreV1.SendingMessage.SendingMessageState_FeeFinalized disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry @@ -815,21 +825,21 @@ testLockOrBurnDeductsFeeBps = script do <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.LockOrBurn with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - sendingMessageCid = sendingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.LockOrBurn with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [toInterfaceContractId senderHolding] amount = 5.0 - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [] [(poolOwner, poolPreapproval)] + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext outboundRateLimiter (toInterfaceContractId transferFactory) [] [(poolOwner, poolPreapproval)] caller = sender - Some sm <- queryContractId ccipOwner result.sendingMessageCid + Some sm <- queryContractId ccipOwner (coerceContractId result.sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) let tokenSendData = fromSome sm.tokenSendData -- 5% feeBps deducted from bridged amount. - tokenSendData.amount === fromSome (MessageCodecV1.encodeUint256 47500000000.0) - rateLimiters <- query @RateLimiter.RateLimiter poolOwner + tokenSendData.amount === fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 47500000000.0) + rateLimiters <- query @CCIP.RateLimiterV1.RateLimiter poolOwner let [(_, updatedOutboundRateLimiter)] = rateLimiters updatedOutboundRateLimiter.tokens === 52500000000.0 @@ -848,7 +858,7 @@ testReleaseFromTicket = script do let sourceChainSelector : Numeric 0 = 123.0 - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" @@ -881,7 +891,7 @@ testReleaseFromTicket = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "test-rmn-release" rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -892,12 +902,12 @@ testReleaseFromTicket = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 100000000000.0 10000000.0 -- Deploy LockReleaseTokenPool with remote chain config for inbound - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] @@ -905,9 +915,9 @@ testReleaseFromTicket = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -916,28 +926,29 @@ testReleaseFromTicket = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId "test-rmn-release" "test-feequoter-release" ccipOwner rmnOwner -- Create TokenReceiveTicket (simulating what OffRamp creates via finalize) tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Disclose contracts disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool @@ -955,17 +966,17 @@ testReleaseFromTicket = script do <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver -- Verify result is completed case result.output of - ITokenPool.ReleaseOrMintResult_Completed receiverCids -> do + CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed receiverCids -> do assertMsg "Receiver should have 1 holding" (length receiverCids == 1) receiverHolding <- queryContractId receiver (fromInterfaceContractId @TestToken.TestHolding (head receiverCids)) assertMsg "Receiver holding should exist" (isSome receiverHolding) @@ -974,13 +985,13 @@ testReleaseFromTicket = script do receiverH.owner === receiver _ -> abort "Expected completed result" - claimedEvent <- queryContractId receiver result.claimedEventCid + claimedEvent <- queryContractId receiver (coerceContractId result.claimedEventCid : ContractId CCIP.EventsV1.Events.TokenReceiveTicketClaimed) assertMsg "Claimed event should exist" (isSome claimedEvent) let claimed = fromSome claimedEvent - claimed.tokenReceiveTicketCid === tokenReceiveTicket + claimed.tokenReceiveTicketCid === coerceContractId tokenReceiveTicket claimed.event.messageId === "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" case claimed.event.output of - Events.TokenReceiveTicketClaimed_Completed receiverCids -> + CCIP.EventsV1.Events.TokenReceiveTicketClaimed_Completed receiverCids -> length receiverCids === 1 _ -> abort "Expected completed claimed event output" @@ -1006,10 +1017,10 @@ testReleaseFromTicketRejectsBadTransferFactoryResults = script do let tokenPoolInstanceId = "test-lock-release-pool-bad-release" let sourceChainSelector : Numeric 0 = 123.0 - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" - let wrongInstrumentId = HoldingV1.InstrumentId with + let wrongInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "WrongToken" @@ -1051,7 +1062,7 @@ testReleaseFromTicketRejectsBadTransferFactoryResults = script do completedAmount = Some 2.0 pendingTransfer = None - let pendingWrongInstrumentTransfer = TransferInstructionV1.Transfer with + let pendingWrongInstrumentTransfer = Splice.Api.Token.TransferInstructionV1.Transfer with sender = poolOwner receiver = receiver amount = 3.0 @@ -1059,7 +1070,7 @@ testReleaseFromTicketRejectsBadTransferFactoryResults = script do requestedAt = time (date 2026 Jan 1) 0 0 0 executeBefore = time (date 2026 Jan 1) 0 1 0 inputHoldingCids = [toInterfaceContractId poolHolding] - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata badPendingWrongInstrumentFactory <- submit ccipOwner do createCmd TestToken.BadTransferFactory with admin = ccipOwner @@ -1076,7 +1087,7 @@ testReleaseFromTicketRejectsBadTransferFactoryResults = script do tokenPoolInstanceId rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = "test-rmn-bad-release" rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1087,11 +1098,11 @@ testReleaseFromTicketRejectsBadTransferFactoryResults = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 100000000000.0 10000000.0 - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] @@ -1099,9 +1110,9 @@ testReleaseFromTicketRejectsBadTransferFactoryResults = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1110,27 +1121,28 @@ testReleaseFromTicketRejectsBadTransferFactoryResults = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId "test-rmn-bad-release" "test-feequoter-bad-release" ccipOwner rmnOwner tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedPoolHolding <- fromSome <$> queryDisclosure poolOwner poolHolding @@ -1148,56 +1160,56 @@ testReleaseFromTicketRejectsBadTransferFactoryResults = script do submitMustFail (actAs receiver <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedBadWrongOwnerFactory <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId badWrongOwnerFactory) [toInterfaceContractId poolHolding] [] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId badWrongOwnerFactory) [toInterfaceContractId poolHolding] [] caller = receiver submitMustFail (actAs receiver <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedBadWrongInstrumentFactory <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId badWrongInstrumentFactory) [toInterfaceContractId poolHolding] [] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId badWrongInstrumentFactory) [toInterfaceContractId poolHolding] [] caller = receiver submitMustFail (actAs receiver <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedBadWrongAmountFactory <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId badWrongAmountFactory) [toInterfaceContractId poolHolding] [] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId badWrongAmountFactory) [toInterfaceContractId poolHolding] [] caller = receiver submitMustFail (actAs receiver <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedBadPendingWrongInstrumentFactory <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId badPendingWrongInstrumentFactory) [toInterfaceContractId poolHolding] [] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId badPendingWrongInstrumentFactory) [toInterfaceContractId poolHolding] [] caller = receiver submitMustFail (actAs receiver <> disclose disclosedPool <> disclose disclosedBadPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedBadWrongInstrumentFactory <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId badWrongInstrumentFactory) [toInterfaceContractId badPoolHolding] [] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId badWrongInstrumentFactory) [toInterfaceContractId badPoolHolding] [] caller = receiver -- | Test ReleaseFromTicket remains valid after post-ticket inbound CCV config drift. @@ -1215,10 +1227,10 @@ testReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do let tokenPoolInstanceId = "test-lock-release-pool-drift" let sourceChainSelector : Numeric 0 = 123.0 - let requiredCcv = RawInstanceAddress.make "required-ccv-drift" ccipOwner - let driftCcv = RawInstanceAddress.make "drift-ccv" ccvOwner + let requiredCcv = Chainlink.InstanceAddress.make "required-ccv-drift" ccipOwner + let driftCcv = Chainlink.InstanceAddress.make "drift-ccv" ccvOwner - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" @@ -1246,7 +1258,7 @@ testReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do tokenPoolInstanceId rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1257,13 +1269,13 @@ testReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 100000000000.0 10000000.0 let remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] let remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" - let initialConfig = LockReleaseTokenPool.RemoteChainConfig with + let initialConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = remotePools remoteTokenAddress = remoteTokenAddress inboundCCVs = [] @@ -1271,10 +1283,10 @@ testReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1283,29 +1295,30 @@ testReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, initialConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId "test-feequoter-release-drift" ccipOwner rmnOwner tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner <> actAs ccvOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [requiredCcv] requiredInboundPoolCCVs = [requiredCcv] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext - let driftUpdate = LockReleaseTokenPool.ChainUpdate with + let driftUpdate = CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = sourceChainSelector remotePools = remotePools remoteTokenAddress = remoteTokenAddress @@ -1314,9 +1327,9 @@ testReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - exerciseCmd tokenPool LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [sourceChainSelector] chainsToAdd = [driftUpdate] @@ -1334,16 +1347,16 @@ testReleaseFromTicketIgnoresPostTicketInboundConfigDrift = script do <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter <> disclose disclosedTicket) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver case result.output of - ITokenPool.ReleaseOrMintResult_Completed receiverCids -> do + CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed receiverCids -> do assertMsg "receiver should receive one holding" (length receiverCids == 1) _ -> abort "Expected completed result despite config drift" @@ -1365,10 +1378,10 @@ testReleaseFromTicketRejectsWrongCCVInstance = script do let sourceChainSelector : Numeric 0 = 123.0 - let requiredCcv = RawInstanceAddress.make "required-ccv" ccvOwner - let otherCcv = RawInstanceAddress.make "other-ccv" ccvOwner + let requiredCcv = Chainlink.InstanceAddress.make "required-ccv" ccvOwner + let otherCcv = Chainlink.InstanceAddress.make "other-ccv" ccvOwner - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" @@ -1396,7 +1409,7 @@ testReleaseFromTicketRejectsWrongCCVInstance = script do tokenPoolInstanceId rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1407,11 +1420,11 @@ testReleaseFromTicketRejectsWrongCCVInstance = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 100000000000.0 10000000.0 - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] @@ -1419,9 +1432,9 @@ testReleaseFromTicketRejectsWrongCCVInstance = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1430,45 +1443,47 @@ testReleaseFromTicketRejectsWrongCCVInstance = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId "test-feequoter-release-instance" ccipOwner rmnOwner tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner <> actAs ccvOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [ccvOwner] verifiedCCVs = [otherCcv] requiredInboundPoolCCVs = [requiredCcv] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext wrongPoolAddressTicket <- submit (actAs ccipOwner <> actAs poolOwner <> actAs ccvOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [ccvOwner] verifiedCCVs = [requiredCcv] requiredInboundPoolCCVs = [requiredCcv] - poolAddress = RawInstanceAddress.make "stale-lock-release-pool-instance" poolOwner + poolAddress = Chainlink.InstanceAddress.make "stale-lock-release-pool-instance" poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedPoolHolding <- fromSome <$> queryDisclosure poolOwner poolHolding @@ -1483,24 +1498,24 @@ testReleaseFromTicketRejectsWrongCCVInstance = script do <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = wrongPoolAddressTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId wrongPoolAddressTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver submitMustFail (actAs receiver <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver -- | Test ReleaseFromTicket converts source decimals to local decimals. @@ -1517,12 +1532,12 @@ testReleaseFromTicketDecimalConversion = script do let sourceChainSelector : Numeric 0 = 123.0 - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1556,12 +1571,12 @@ testReleaseFromTicketDecimalConversion = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 9999999999999999999999999999.0 9999999999999999999999999999.0 -- Create token pool - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] @@ -1569,9 +1584,9 @@ testReleaseFromTicketDecimalConversion = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1580,28 +1595,29 @@ testReleaseFromTicketDecimalConversion = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId "test-feequoter-decimals" ccipOwner rmnOwner - let sourcePoolData = fromSome (MessageCodecV1.encodeUint256 18.0) + let sourcePoolData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 18.0) tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 1234567890123456789.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1234567890123456789.0) sourcePoolData = sourcePoolData messageId = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedPoolHolding <- fromSome <$> queryDisclosure poolOwner poolHolding @@ -1616,32 +1632,32 @@ testReleaseFromTicketDecimalConversion = script do <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver case result.output of - ITokenPool.ReleaseOrMintResult_Completed receiverCids -> do + CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed receiverCids -> do receiverHolding <- queryContractId receiver (fromInterfaceContractId @TestToken.TestHolding (head receiverCids)) let receiverH = fromSome receiverHolding receiverH.amount === 1.2345678901 _ -> abort "Expected completed result" - claimedEvent <- queryContractId receiver result.claimedEventCid + claimedEvent <- queryContractId receiver (coerceContractId result.claimedEventCid : ContractId CCIP.EventsV1.Events.TokenReceiveTicketClaimed) let claimed = fromSome claimedEvent claimed.event.messageId === "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" case claimed.event.output of - Events.TokenReceiveTicketClaimed_Completed receiverCids -> + CCIP.EventsV1.Events.TokenReceiveTicketClaimed_Completed receiverCids -> length receiverCids === 1 _ -> abort "Expected completed claimed event output" -- ConsumeCapacity archives the old rate limiter and creates a new one, -- so query by template type instead of the stale CID. - rateLimiters <- query @RateLimiter.RateLimiter poolOwner + rateLimiters <- query @CCIP.RateLimiterV1.RateLimiter poolOwner let [(_, updatedRateLimiter)] = rateLimiters updatedRateLimiter.tokens === 9999999999999999987654321098.0 @@ -1661,12 +1677,12 @@ testReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = script do let tokenPoolInstanceId = "test-lock-release-pool-raw-uint256-downscale" let sourceChainSelector : Numeric 0 = 123.0 - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1700,11 +1716,11 @@ testReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 9999999999999999999999999999.0 9999999999999999999999999999.0 - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] @@ -1712,9 +1728,9 @@ testReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1723,20 +1739,20 @@ testReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId "test-feequoter-raw-uint256-downscale" ccipOwner rmnOwner - let sourcePoolData = fromSome (MessageCodecV1.encodeUint256 38.0) - let sourceAmount = fromSome (Uint256.decimalTextToUint256Bytes "100000000000000000000000000000000000000") + let sourcePoolData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 38.0) + let sourceAmount = fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "100000000000000000000000000000000000000") tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver @@ -1746,6 +1762,7 @@ testReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = script do messageId = "dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedPoolHolding <- fromSome <$> queryDisclosure poolOwner poolHolding @@ -1760,22 +1777,22 @@ testReleaseFromTicketRawUint256AmountAboveNumeric0Downscales = script do <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver case result.output of - ITokenPool.ReleaseOrMintResult_Completed receiverCids -> do + CCIP.InterfacesV1.TokenPool.ReleaseOrMintResult_Completed receiverCids -> do receiverHolding <- queryContractId receiver (fromInterfaceContractId @TestToken.TestHolding (head receiverCids)) let receiverH = fromSome receiverHolding receiverH.amount === 1.0 _ -> abort "Expected completed result" - claimedEvent <- queryContractId receiver result.claimedEventCid + claimedEvent <- queryContractId receiver (coerceContractId result.claimedEventCid : ContractId CCIP.EventsV1.Events.TokenReceiveTicketClaimed) let claimed = fromSome claimedEvent claimed.event.sourceAmount === sourceAmount claimed.event.localAmount === 10000000000.0 @@ -1795,12 +1812,12 @@ testReleaseFromTicketDecimalConversionOverflowFails = script do let sourceChainSelector : Numeric 0 = 123.0 let originalPoolAmount : Decimal = 9999999999999999999999999999.0 - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1834,11 +1851,11 @@ testReleaseFromTicketDecimalConversionOverflowFails = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 9999999999999999999999999999.0 9999999999999999999999999999.0 - let remoteChainCfg = LockReleaseTokenPool.RemoteChainConfig with + let remoteChainCfg = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] @@ -1846,9 +1863,9 @@ testReleaseFromTicketDecimalConversionOverflowFails = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1857,29 +1874,30 @@ testReleaseFromTicketDecimalConversionOverflowFails = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainCfg)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId "test-feequoter-decimals-overflow" ccipOwner rmnOwner - let sourcePoolData = fromSome (MessageCodecV1.encodeUint256 6.0) + let sourcePoolData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 6.0) let overflowingAmount : Numeric 0 = 100000000000000000000000000.0 tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 overflowingAmount) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 overflowingAmount) sourcePoolData = sourcePoolData messageId = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedPoolHolding <- fromSome <$> queryDisclosure poolOwner poolHolding @@ -1894,12 +1912,12 @@ testReleaseFromTicketDecimalConversionOverflowFails = script do <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver receiverHoldings <- query @TestToken.TestHolding receiver @@ -1931,12 +1949,12 @@ testReleaseFromTicketDecimalConversionTruncatesToZeroFails = script do let sourceChainSelector : Numeric 0 = 123.0 let originalPoolAmount : Decimal = 10.0 - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1970,11 +1988,11 @@ testReleaseFromTicketDecimalConversionTruncatesToZeroFails = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 100000000000.0 10000000.0 - let remoteChainCfg = LockReleaseTokenPool.RemoteChainConfig with + let remoteChainCfg = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["d2ff32a3f0bb7b9b5afcfbaaa9ae629449ef2ff0"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] @@ -1982,9 +2000,9 @@ testReleaseFromTicketDecimalConversionTruncatesToZeroFails = script do finalityConfig = finalityConfig 0 inboundRateLimiter = inboundRateLimiterAddr inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -1993,28 +2011,29 @@ testReleaseFromTicketDecimalConversionTruncatesToZeroFails = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, remoteChainCfg)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId "test-feequoter-decimals-zero" ccipOwner rmnOwner - let sourcePoolData = fromSome (MessageCodecV1.encodeUint256 18.0) + let sourcePoolData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 18.0) tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [] verifiedCCVs = [] requiredInboundPoolCCVs = [] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 999999999999.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 999999999999.0) sourcePoolData = sourcePoolData messageId = "eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedPoolHolding <- fromSome <$> queryDisclosure poolOwner poolHolding @@ -2029,12 +2048,12 @@ testReleaseFromTicketDecimalConversionTruncatesToZeroFails = script do <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver receiverHoldings <- query @TestToken.TestHolding receiver @@ -2070,12 +2089,12 @@ testReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do let sourceChainSelector : Numeric 0 = 123.0 - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -2109,11 +2128,11 @@ testReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do poolOwner tokenPoolInstanceId sourceChainSelector - RateLimiter.RateLimitDirection_Inbound + CCIP.RateLimiterV1.RateLimitDirection_Inbound 100000000000.0 10000000.0 - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = [] remoteTokenAddress = "" inboundCCVs = [] @@ -2123,7 +2142,7 @@ testReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do inboundCustomBlockConfirmationsRateLimiter = inboundRateLimiterAddr outboundRateLimiter = inboundRateLimiterAddr tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -2132,28 +2151,29 @@ testReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId rmnInstanceId "test-feequoter-ccv-auth" ccipOwner rmnOwner - let nonsignatoryVerifiedCCV = RawInstanceAddress.make "ccv-not-signer" wrongCcvOwner + let nonsignatoryVerifiedCCV = Chainlink.InstanceAddress.make "ccv-not-signer" wrongCcvOwner tokenReceiveTicket <- submit (actAs ccipOwner <> actAs poolOwner <> actAs ccvOwner) do - createCmd Tickets.TokenReceiveTicket with + createCmd CCIP.TicketsV1.TokenReceiveTicket with tokenAdminRegistryInstanceId = tokenAdminRegistryInstanceId ccipOwner = ccipOwner ccvOwners = [ccvOwner] verifiedCCVs = [nonsignatoryVerifiedCCV] requiredInboundPoolCCVs = [] - poolAddress = RawInstanceAddress.make tokenPoolInstanceId poolOwner + poolAddress = Chainlink.InstanceAddress.make tokenPoolInstanceId poolOwner poolOwner = poolOwner receiver = receiver tokenReceiver = receiver instrumentId = testInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 30000000000.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 30000000000.0) sourcePoolData = "" messageId = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" sourceChainSelector = sourceChainSelector finality = finalityConfig 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedPoolHolding <- fromSome <$> queryDisclosure poolOwner poolHolding @@ -2168,12 +2188,12 @@ testReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory = script do <> disclose disclosedPool <> disclose disclosedPoolHolding <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFactory <> disclose disclosedPreapproval <> disclose disclosedRmn <> disclose disclosedRateLimiter) do - exerciseCmd tokenPool LockReleaseTokenPool.ReleaseFromTicket with - tokenReceiveTicketCid = tokenReceiveTicket - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - rmnRemoteCid = rmnRemote - extraContext = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.ReleaseFromTicket with + tokenReceiveTicketCid = coerceContractId tokenReceiveTicket + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + rmnRemoteCid = toInterfaceContractId rmnRemote + context = mkPoolContext inboundRateLimiter (toInterfaceContractId transferFactory) [toInterfaceContractId poolHolding] [(receiver, receiverPreapproval)] caller = receiver debug "testReleaseFromTicketRejectsVerifiedCCVOwnerNotSignatory: PASSED" @@ -2186,34 +2206,34 @@ testExecutionGasLimitAggregation = script do ccvOwner2 <- allocateParty "ccv-owner-gas-2" executorOwner <- allocateParty "executor-owner-gas" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "FeeToken" - let senderAddr = MessageCodecV1.encodePartyAddress sender + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router-gas" sender - onRamp = RawInstanceAddress.make "test-onramp-gas" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig-gas" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-gas" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tar-gas" ccipOwner - feeQuoter = RawInstanceAddress.make "test-feequoter-gas" ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router-gas" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp-gas" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-gas" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-gas" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tar-gas" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-gas" ccipOwner destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 requiredCCVs = - [ RawInstanceAddress.make "ccv-1" ccvOwner1 - , RawInstanceAddress.make "ccv-2" ccvOwner2 + [ Chainlink.InstanceAddress.make "ccv-1" ccvOwner1 + , Chainlink.InstanceAddress.make "ccv-2" ccvOwner2 ] destDefaultCCVs = [] - requiredExecutor = Some (RawInstanceAddress.make "default-executor-gas" executorOwner) + requiredExecutor = Some (Chainlink.InstanceAddress.make "default-executor-gas" executorOwner) -- executorAddress is specified, only the specified executor can add executor fee - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor-gas" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_Executor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor-gas" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor sourceChainSelector = 123.0 senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -2231,6 +2251,7 @@ testExecutionGasLimitAggregation = script do feeToken = testInstrumentId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -2246,36 +2267,39 @@ testExecutionGasLimitAggregation = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedSM <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid sendingMessageCid <- submit (actAs ccvOwner1 <> disclose disclosedSM) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-1" feeUSDCents = cents 1.0 destGasLimit = 12345 destBytesOverhead = 0 caller = ccvOwner1 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext disclosedSM <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid sendingMessageCid <- submit (actAs ccvOwner2 <> disclose disclosedSM) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-2" feeUSDCents = cents 2.0 destGasLimit = 23456 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner2 disclosedSM <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid sendingMessageCid <- submit (actAs executorOwner <> disclose disclosedSM) do - exerciseCmd sendingMessageCid SendingMessageV1.AddExecutorFee with + coerceContractId @_ @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddExecutorFee with executorInstanceId = "default-executor-gas" executorArgs = "" feeUSDCents = cents 3.0 caller = executorOwner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.FinalizeFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.FinalizeFee with feeTokenPrice = 1.0 premiumMultiplier = 1.0 totalExecutionGasLimit = 285801 @@ -2284,11 +2308,10 @@ testExecutionGasLimitAggregation = script do executionCostUSDCents = 0.0 sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.BuildMessage with - caller = ccipOwner + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.BuildMessage with + context = Splice.Api.Token.MetadataV1.emptyChoiceContext - finalized <- queryContractId ccipOwner sendingMessageCid - let sm = fromSome finalized + Some sm <- queryContractId ccipOwner sendingMessageCid sm.executionGasLimit === 285801 let outboundMessage = fromSome sm.message outboundMessage.executionGasLimit === 285801 @@ -2299,20 +2322,20 @@ testExecutionGasLimitAggregation = script do testDecimalConversion_ScaleUp : Script () testDecimalConversion_ScaleUp = script do -- remote=6, local=18: 1000000 (1 USDC in 6 decimals) -> 1000000000000000000 (1e18) - let result = LockReleaseTokenPool.calculateLocalAmount 1000000.0 6 18 + let result = CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1000000.0 6 18 result === 1000000000000000000.0 -- Smaller amount: 1.0 in 6 decimals -> 1e12 in 18 decimals - let result2 = LockReleaseTokenPool.calculateLocalAmount 1.0 6 18 + let result2 = CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1.0 6 18 result2 === 1000000000000.0 debug "testDecimalConversion_ScaleUp: PASSED" testDecimalConversion_ScaleUpBoundary_Succeeds : Script () testDecimalConversion_ScaleUpBoundary_Succeeds = script do let largestPassing : Numeric 0 = 99999999999999999999999999.0 - LockReleaseTokenPool.calculateLocalAmount largestPassing 6 18 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount largestPassing 6 18 === 99999999999999999999999999000000000000.0 - LockReleaseTokenPool.calculateLocalAmount 9.0 0 37 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 9.0 0 37 === 90000000000000000000000000000000000000.0 debug "testDecimalConversion_ScaleUpBoundary_Succeeds: PASSED" @@ -2339,10 +2362,10 @@ testDecimalConversion_ScaleUpBoundary_Fails = script do -- C-1: Equal decimals (no conversion). testDecimalConversion_EqualDecimals : Script () testDecimalConversion_EqualDecimals = script do - let result = LockReleaseTokenPool.calculateLocalAmount 1234567890.0 18 18 + let result = CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1234567890.0 18 18 result === 1234567890.0 - let result2 = LockReleaseTokenPool.calculateLocalAmount 42.0 6 6 + let result2 = CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 42.0 6 6 result2 === 42.0 debug "testDecimalConversion_EqualDecimals: PASSED" @@ -2350,15 +2373,15 @@ testDecimalConversion_EqualDecimals = script do testDecimalConversion_ScaleDown : Script () testDecimalConversion_ScaleDown = script do -- 1e18 in 18 decimals = 1 token -> 1e6 in 6 decimals - LockReleaseTokenPool.calculateLocalAmount 1000000000000000000.0 18 6 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1000000000000000000.0 18 6 === 1000000.0 -- 1234567890123456789 in 18 decimals -> floor(1234567890123456789 / 1e12) = 1234567 - LockReleaseTokenPool.calculateLocalAmount 1234567890123456789.0 18 6 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1234567890123456789.0 18 6 === 1234567.0 -- Large value near Numeric 0 range: 10^37 in 18 decimals -> 10^25 in 6 decimals - LockReleaseTokenPool.calculateLocalAmount 10000000000000000000000000000000000000.0 18 6 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 10000000000000000000000000000000000000.0 18 6 === 10000000000000000000000000.0 debug "testDecimalConversion_ScaleDown: PASSED" @@ -2367,37 +2390,37 @@ testDecimalConversion_ScaleDown = script do testDecimalConversion_EdgeCases : Script () testDecimalConversion_EdgeCases = script do -- Zero amount stays zero regardless of decimal difference - LockReleaseTokenPool.calculateLocalAmount 0.0 6 18 === 0.0 - LockReleaseTokenPool.calculateLocalAmount 0.0 18 6 === 0.0 - LockReleaseTokenPool.calculateLocalAmount 0.0 18 18 === 0.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 0.0 6 18 === 0.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 0.0 18 6 === 0.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 0.0 18 18 === 0.0 -- Amount smaller than scale factor truncates to zero (floor) -- 999999 in 18 decimals / 1e12 = 0.000000999999, floor = 0 - LockReleaseTokenPool.calculateLocalAmount 999999.0 18 6 === 0.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 999999.0 18 6 === 0.0 -- Exactly at scale factor boundary: 1e12 in 18 decimals -> 1 in 6 decimals - LockReleaseTokenPool.calculateLocalAmount 1000000000000.0 18 6 === 1.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1000000000000.0 18 6 === 1.0 -- One below scale factor: floor(999999999999 / 1e12) = 0 - LockReleaseTokenPool.calculateLocalAmount 999999999999.0 18 6 === 0.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 999999999999.0 18 6 === 0.0 -- Floor behavior: verify no rounding up -- floor(1500000000000 / 1e12) = 1, not 2 - LockReleaseTokenPool.calculateLocalAmount 1500000000000.0 18 6 === 1.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1500000000000.0 18 6 === 1.0 -- floor(1999999999999 / 1e12) = 1, not 2 - LockReleaseTokenPool.calculateLocalAmount 1999999999999.0 18 6 === 1.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1999999999999.0 18 6 === 1.0 -- Large decimal gap (remote=18, local=0): divide by 1e18 -- 1e18 -> 1 - LockReleaseTokenPool.calculateLocalAmount 1000000000000000000.0 18 0 === 1.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1000000000000000000.0 18 0 === 1.0 -- 5e18 -> 5 - LockReleaseTokenPool.calculateLocalAmount 5000000000000000000.0 18 0 === 5.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 5000000000000000000.0 18 0 === 5.0 -- Scale up: 1 in 0 decimals -> 1e18 in 18 decimals - LockReleaseTokenPool.calculateLocalAmount 1.0 0 18 === 1000000000000000000.0 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1.0 0 18 === 1000000000000000000.0 -- Large amount scale-up: 1e18 in 8 decimals -> 1e28 in 18 decimals - LockReleaseTokenPool.calculateLocalAmount 1000000000000000000.0 8 18 + CCIP.LockReleaseTokenPoolV1.calculateLocalAmount 1000000000000000000.0 8 18 === 10000000000000000000000000000.0 debug "testDecimalConversion_EdgeCases: PASSED" @@ -2405,15 +2428,15 @@ testDecimalConversion_EdgeCases = script do -- C-1: Empty sourcePoolData defaults to local decimals (no conversion). testParseSourcePoolDecimals_Empty : Script () testParseSourcePoolDecimals_Empty = script do - let result = LockReleaseTokenPool.parseSourcePoolDecimals 18 "" + let result = CCIP.LockReleaseTokenPoolV1.parseSourcePoolDecimals 18 "" result === 18 debug "testParseSourcePoolDecimals_Empty: PASSED" -- C-1: Valid sourcePoolData parses correctly. testParseSourcePoolDecimals_Valid : Script () testParseSourcePoolDecimals_Valid = script do - let encoded = fromSome (MessageCodecV1.encodeUint256 6.0) - let result = LockReleaseTokenPool.parseSourcePoolDecimals 18 encoded + let encoded = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 6.0) + let result = CCIP.LockReleaseTokenPoolV1.parseSourcePoolDecimals 18 encoded result === 6 debug "testParseSourcePoolDecimals_Valid: PASSED" @@ -2423,7 +2446,7 @@ testParseSourcePoolDecimals_TooLarge = script do harnessCid <- submit owner do createCmd ParseSourcePoolDecimalsHarness with owner - let encoded = fromSome (MessageCodecV1.encodeUint256 3000000000.0) + let encoded = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 3000000000.0) submitMustFail owner do exerciseCmd harnessCid ParseSourcePoolDecimals with @@ -2441,33 +2464,33 @@ testExecutionGasLimitWithTokenSendFee = script do executorOwner <- allocateParty "executor-owner-gas-pool" poolOwner <- allocateParty "pool-owner-gas-pool" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "FeeToken" - let testTokenInstrumentId = HoldingV1.InstrumentId with + let testTokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "SendToken" - let senderAddr = MessageCodecV1.encodePartyAddress sender + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router-gas-pool" sender - onRamp = RawInstanceAddress.make "test-onramp-gas-pool" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig-gas-pool" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-gas-pool" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tar-gas-pool" ccipOwner - feeQuoter = RawInstanceAddress.make "test-feequoter-gas-pool" ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router-gas-pool" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp-gas-pool" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-gas-pool" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-gas-pool" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tar-gas-pool" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-gas-pool" ccipOwner destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 - requiredCCVs = [RawInstanceAddress.make "ccv-pool" ccvOwner] + requiredCCVs = [Chainlink.InstanceAddress.make "ccv-pool" ccvOwner] destDefaultCCVs = [] - requiredExecutor = Some (RawInstanceAddress.make "default-executor-gas-pool" executorOwner) - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor-gas-pool" executorOwner) - executionMode = Some SendingMessageV1.ExecutionMode_Executor + requiredExecutor = Some (Chainlink.InstanceAddress.make "default-executor-gas-pool" executorOwner) + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor-gas-pool" executorOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_Executor sourceChainSelector = 123.0 senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -2485,6 +2508,7 @@ testExecutionGasLimitWithTokenSendFee = script do feeToken = testInstrumentId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some testTokenInstrumentId + tokenAmountBeforeTokenPoolFees = 100.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -2500,43 +2524,46 @@ testExecutionGasLimitWithTokenSendFee = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.SendingMessage.SendingMessageState_RequirePoolCCVs -- Resolve outbound pool CCVs before any token-send fee/send mutation. sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.SetOutboundPoolCCVs with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.SetOutboundPoolCCVs with poolCCVs = [] -- Add CCV fee with gas 10000 disclosedSM <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid sendingMessageCid <- submit (actAs ccvOwner <> disclose disclosedSM) do - exerciseCmd sendingMessageCid SendingMessageV1.AddCCVFee with + fromInterfaceContractId @CCIP.CoreV1.SendingMessage.SendingMessage <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.SendingMessage.ISendingMessage sendingMessageCid) CCIP.APIV1.SendingMessage.SendingMessage_AddCCVFee with ccvInstanceId = "ccv-pool" feeUSDCents = cents 1.0 destGasLimit = 10000 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner -- Add token send fee with destGasOverhead 50000 sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.AddTokenSendFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSendFee with poolInstanceId = "pool-gas" poolOwner = poolOwner feeUSDCents = cents 2.0 destGasOverhead = 50000 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- AddExecutorFee, then finalize fee before the pool appends token data. disclosedSM <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid sendingMessageCid <- submit (actAs executorOwner <> disclose disclosedSM) do - exerciseCmd sendingMessageCid SendingMessageV1.AddExecutorFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddExecutorFee with executorInstanceId = "default-executor-gas-pool" executorArgs = "" feeUSDCents = cents 3.0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = executorOwner sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.FinalizeFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.FinalizeFee with feeTokenPrice = 1.0 premiumMultiplier = 1.0 totalExecutionGasLimit = 310000 @@ -2545,17 +2572,17 @@ testExecutionGasLimitWithTokenSendFee = script do executionCostUSDCents = 0.0 sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.AddTokenSend with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSend with poolInstanceId = "pool-gas" poolOwner = poolOwner instrumentId = testTokenInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 100.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 100.0) destTokenAddress = "0000000000000000000000000000000000000099" extraData = "" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext -- Verify: CCV (10000) + pool (50000) + ccipReceiveGasLimit (250000) = 310000 - finalized <- queryContractId ccipOwner sendingMessageCid - let sm = fromSome finalized + Some sm <- queryContractId ccipOwner sendingMessageCid sm.executionGasLimit === 310000 let outboundMessage = fromSome sm.message outboundMessage.executionGasLimit === 310000 @@ -2571,28 +2598,28 @@ testSetOutboundPoolCCVsResolvesDefaults = script do defaultCCVOwner <- allocateParty "default-ccv-owner-pool-default-resolve" poolCCVOwner <- allocateParty "pool-ccv-owner-pool-default-resolve" - let feeInstrumentId = HoldingV1.InstrumentId with + let feeInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "FeeToken" - let tokenInstrumentId = HoldingV1.InstrumentId with + let tokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "SendToken" - let senderAddr = MessageCodecV1.encodePartyAddress sender - let defaultCCV1 = RawInstanceAddress.make "default-ccv-1" defaultCCVOwner - let defaultCCV2 = RawInstanceAddress.make "default-ccv-2" defaultCCVOwner - let poolCCV = RawInstanceAddress.make "pool-ccv-1" poolCCVOwner + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender + let defaultCCV1 = Chainlink.InstanceAddress.make "default-ccv-1" defaultCCVOwner + let defaultCCV2 = Chainlink.InstanceAddress.make "default-ccv-2" defaultCCVOwner + let poolCCV = Chainlink.InstanceAddress.make "pool-ccv-1" poolCCVOwner let mkSendingMessage sequenceNumber = submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-pool-default-resolve" sender - onRamp = RawInstanceAddress.make "onramp-pool-default-resolve" ccipOwner - globalConfig = RawInstanceAddress.make "globalconfig-pool-default-resolve" ccipOwner - rmnRemote = RawInstanceAddress.make "rmn-pool-default-resolve" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "tar-pool-default-resolve" ccipOwner - feeQuoter = RawInstanceAddress.make "feequoter-pool-default-resolve" ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-pool-default-resolve" sender + onRamp = Chainlink.InstanceAddress.make "onramp-pool-default-resolve" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-pool-default-resolve" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-pool-default-resolve" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-pool-default-resolve" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "feequoter-pool-default-resolve" ccipOwner destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = sequenceNumber @@ -2600,7 +2627,7 @@ testSetOutboundPoolCCVsResolvesDefaults = script do destDefaultCCVs = [defaultCCV1, defaultCCV2] requiredExecutor = None executorAddress = "" - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -2618,6 +2645,7 @@ testSetOutboundPoolCCVsResolvesDefaults = script do feeToken = feeInstrumentId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some tokenInstrumentId + tokenAmountBeforeTokenPoolFees = 100.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -2633,34 +2661,34 @@ testSetOutboundPoolCCVsResolvesDefaults = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.SendingMessage.SendingMessageState_RequirePoolCCVs -- Empty pool CCV list resolves to destination defaults. smEmptyPool <- mkSendingMessage 1.0 smEmptyPool <- submit ccipOwner do - exerciseCmd smEmptyPool SendingMessageV1.SetOutboundPoolCCVs with + exerciseCmd smEmptyPool CCIP.CoreV1.SendingMessage.SetOutboundPoolCCVs with poolCCVs = [] Some smEmptyPoolData <- queryContractId ccipOwner smEmptyPool smEmptyPoolData.outboundPoolCCVs === Some [defaultCCV1, defaultCCV2] - smEmptyPoolData.state === SendingMessageV1.SendingMessageState_Prepared + smEmptyPoolData.state === CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared -- Sentinel expands defaults and preserves explicit pool CCVs. smSentinelPool <- mkSendingMessage 2.0 smSentinelPool <- submit ccipOwner do - exerciseCmd smSentinelPool SendingMessageV1.SetOutboundPoolCCVs with - poolCCVs = [Internal.useDefaultCCVs, poolCCV] + exerciseCmd smSentinelPool CCIP.CoreV1.SendingMessage.SetOutboundPoolCCVs with + poolCCVs = [CCIP.CodecV1.CCVCodec.useDefaultCCVs, poolCCV] Some smSentinelPoolData <- queryContractId ccipOwner smSentinelPool smSentinelPoolData.outboundPoolCCVs === Some [defaultCCV1, defaultCCV2, poolCCV] - smSentinelPoolData.state === SendingMessageV1.SendingMessageState_Prepared + smSentinelPoolData.state === CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared -- Explicit pool-only CCVs do not auto-append defaults. smExplicitPool <- mkSendingMessage 3.0 smExplicitPool <- submit ccipOwner do - exerciseCmd smExplicitPool SendingMessageV1.SetOutboundPoolCCVs with + exerciseCmd smExplicitPool CCIP.CoreV1.SendingMessage.SetOutboundPoolCCVs with poolCCVs = [poolCCV] Some smExplicitPoolData <- queryContractId ccipOwner smExplicitPool smExplicitPoolData.outboundPoolCCVs === Some [poolCCV] - smExplicitPoolData.state === SendingMessageV1.SendingMessageState_Prepared + smExplicitPoolData.state === CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared debug "testSetOutboundPoolCCVsResolvesDefaults: PASSED" @@ -2670,30 +2698,30 @@ testAddTokenSendRejectsExtraDataBeyondQuotedOverhead = script do ccipOwner <- allocateParty "ccip-owner-extra-bound" poolOwner <- allocateParty "pool-owner-extra-bound" - let testTokenInstrumentId = HoldingV1.InstrumentId with + let testTokenInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" - let senderAddr = MessageCodecV1.encodePartyAddress poolOwner + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress poolOwner sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = poolOwner - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router-extra-bound" poolOwner - onRamp = RawInstanceAddress.make "test-onramp-extra-bound" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig-extra-bound" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-extra-bound" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tar-extra-bound" ccipOwner - feeQuoter = RawInstanceAddress.make "test-feequoter-extra-bound" ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router-extra-bound" poolOwner + onRamp = Chainlink.InstanceAddress.make "test-onramp-extra-bound" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-extra-bound" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-extra-bound" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tar-extra-bound" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-extra-bound" ccipOwner destChainSelector = 456.0 destAddressBytesLength = 20 sequenceNumber = 1.0 requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor-extra-bound" ccipOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor-extra-bound" ccipOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -2711,6 +2739,7 @@ testAddTokenSendRejectsExtraDataBeyondQuotedOverhead = script do feeToken = testTokenInstrumentId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some testTokenInstrumentId + tokenAmountBeforeTokenPoolFees = 100.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -2726,18 +2755,19 @@ testAddTokenSendRejectsExtraDataBeyondQuotedOverhead = script do ccvOwners = [] tokenSendData = None observingParties = [poolOwner] - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.AddTokenSendFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSendFee with poolInstanceId = "pool-extra-bound" poolOwner = poolOwner feeUSDCents = cents 0.0 destGasOverhead = 0 destBytesOverhead = 4 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.FinalizeFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.FinalizeFee with feeTokenPrice = 1.0 premiumMultiplier = 1.0 totalExecutionGasLimit = 0 @@ -2746,22 +2776,24 @@ testAddTokenSendRejectsExtraDataBeyondQuotedOverhead = script do executionCostUSDCents = 0.0 submitMustFail ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.AddTokenSend with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSend with poolInstanceId = "pool-extra-bound" poolOwner = poolOwner instrumentId = testTokenInstrumentId - amount = fromSome (MessageCodecV1.encodeUint256 100.0) + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 100.0) destTokenAddress = "0000000000000000000000000000000000000099" extraData = "0011223344" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext submitMustFail ccipOwner do - exerciseCmd sendingMessageCid SendingMessageV1.AddTokenSend with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddTokenSend with poolInstanceId = "pool-extra-bound" poolOwner = poolOwner instrumentId = testTokenInstrumentId amount = "00" destTokenAddress = "0000000000000000000000000000000000000099" extraData = "" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext debug "testAddTokenSendRejectsExtraDataBeyondQuotedOverhead: PASSED" @@ -2777,7 +2809,7 @@ testVerifyInboundMessage = script do let tokenAdminRegistryInstanceId = "test-tar-verify" let allowedSourcePool = "000000000000000000000000aaaaaaaaaaaaaaaa" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" @@ -2790,18 +2822,18 @@ testVerifyInboundMessage = script do "test-lock-release-pool-verify" -- Create pool with chain config including allowed remote pool - let ccvAddr = RawInstanceAddress.make "test-ccv" ccipOwner - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let ccvAddr = Chainlink.InstanceAddress.make "test-ccv" ccipOwner + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = [allowedSourcePool] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [ccvAddr] outboundCCVs = [] finalityConfig = finalityConfig 2000 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = "test-lock-release-pool-verify" @@ -2810,13 +2842,13 @@ testVerifyInboundMessage = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId "test-rmn-verify" "test-feequoter-verify" ccipOwner ccipOwner -- Build message with token transfer from allowed source pool - let destTokenAddr = MessageCodecV1.encodeInstrumentId testInstrumentId - let message = MessageCodecV1.MessageV1 with + let destTokenAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId testInstrumentId + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -2827,22 +2859,22 @@ testVerifyInboundMessage = script do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 5000000.0) + tokenTransfer = Some CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 5000000.0) sourcePoolAddress = allowedSourcePool sourceTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" destTokenAddress = destTokenAddr - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "" messageData = "" - -- Create ExecutingMessageV1 - let offRampInstanceAddress = RawInstanceAddress.make "test-offramp" ccipOwner - let tarInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + -- Create ExecutingMessage + let offRampInstanceAddress = Chainlink.InstanceAddress.make "test-offramp" ccipOwner + let tarInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -2858,12 +2890,12 @@ testVerifyInboundMessage = script do receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampInstanceAddress - globalConfig = RawInstanceAddress.make "test-globalconfig" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-verify" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-verify" ccipOwner tokenAdminRegistry = tarInstanceAddress - state = ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs -- Exercise VerifyInboundMessage - should succeed disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool @@ -2872,18 +2904,16 @@ testVerifyInboundMessage = script do disclosedEm <- fromSome <$> queryDisclosure ccipOwner executingMessageCid newEmCid <- submit (actAs receiver <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedEm) do - exerciseCmd tokenPool LockReleaseTokenPool.VerifyInboundMessage with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.VerifyInboundMessage with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid caller = receiver -- Verify inbound pool CCVs were recorded - newExecMsg <- queryContractId ccipOwner newEmCid - assertMsg "ExecutingMessageV1 should exist" (isSome newExecMsg) - let em = fromSome newExecMsg - em.inboundPoolVerification === Some (ExecutingMessageV1.InboundPoolVerification with + Some newExecMsg <- queryContractId ccipOwner (coerceContractId @_ @CCIP.CoreV1.ExecutingMessage.ExecutingMessage newEmCid) + newExecMsg.inboundPoolVerification === Some (CCIP.CoreV1.ExecutingMessage.InboundPoolVerification with poolInstanceId = "test-lock-release-pool-verify" poolOwner = poolOwner poolCCVs = [ccvAddr]) @@ -2900,9 +2930,9 @@ testVerifyInboundMessageAllowsSafeFinalityConfig = script do let destChainSelector : Numeric 0 = 456.0 let tokenAdminRegistryInstanceId = "test-tar-verify-safe" let allowedSourcePool = "000000000000000000000000aaaaaaaaaaaaaaaa" - let safeFinality = FinalityCodec.WaitForSafe + let safeFinality = CCIP.CodecV1.FinalityConfig.WaitForSafe - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" @@ -2913,18 +2943,18 @@ testVerifyInboundMessageAllowsSafeFinalityConfig = script do testInstrumentId "test-lock-release-pool-verify-safe" - let ccvAddr = RawInstanceAddress.make "test-ccv-safe" ccipOwner - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let ccvAddr = Chainlink.InstanceAddress.make "test-ccv-safe" ccipOwner + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = [allowedSourcePool] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [ccvAddr] outboundCCVs = [] finalityConfig = safeFinality - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-safe@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in-safe@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out-safe@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-safe@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in-safe@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out-safe@owner" tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = "test-lock-release-pool-verify-safe" @@ -2933,37 +2963,37 @@ testVerifyInboundMessageAllowsSafeFinalityConfig = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId "test-rmn-verify-safe" "test-feequoter-verify-safe" ccipOwner ccipOwner - let destTokenAddr = MessageCodecV1.encodeInstrumentId testInstrumentId - let message = MessageCodecV1.MessageV1 with + let destTokenAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId testInstrumentId + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 100000 - finality = fromSomeNote "safe finality must decode" (FinalityCodec.decodeRequestedFinality "00010000") + finality = fromSomeNote "safe finality must decode" (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality "00010000") ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 5000000.0) + tokenTransfer = Some CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 5000000.0) sourcePoolAddress = allowedSourcePool sourceTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" destTokenAddress = destTokenAddr - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "" messageData = "" - let offRampInstanceAddress = RawInstanceAddress.make "test-offramp-safe" ccipOwner - let tarInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampInstanceAddress = Chainlink.InstanceAddress.make "test-offramp-safe" ccipOwner + let tarInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" @@ -2979,12 +3009,12 @@ testVerifyInboundMessageAllowsSafeFinalityConfig = script do receiverFinalityConfig = safeFinality sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampInstanceAddress - globalConfig = RawInstanceAddress.make "test-globalconfig-safe" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-verify-safe" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-safe" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-verify-safe" ccipOwner tokenAdminRegistry = tarInstanceAddress - state = ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry @@ -2992,17 +3022,15 @@ testVerifyInboundMessageAllowsSafeFinalityConfig = script do disclosedEm <- fromSome <$> queryDisclosure ccipOwner executingMessageCid newEmCid <- submit (actAs receiver <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedEm) do - exerciseCmd tokenPool LockReleaseTokenPool.VerifyInboundMessage with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.VerifyInboundMessage with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid caller = receiver - newExecMsg <- queryContractId ccipOwner newEmCid - assertMsg "ExecutingMessageV1 should exist" (isSome newExecMsg) - let em = fromSome newExecMsg - em.inboundPoolVerification === Some (ExecutingMessageV1.InboundPoolVerification with + Some newExecMsg <- queryContractId ccipOwner (coerceContractId @_ @CCIP.CoreV1.ExecutingMessage.ExecutingMessage newEmCid) + newExecMsg.inboundPoolVerification === Some (CCIP.CoreV1.ExecutingMessage.InboundPoolVerification with poolInstanceId = "test-lock-release-pool-verify-safe" poolOwner = poolOwner poolCCVs = [ccvAddr]) @@ -3022,7 +3050,7 @@ testVerifyInboundMessageInvalidSourcePool = script do let allowedSourcePool = "000000000000000000000000aaaaaaaaaaaaaaaa" let disallowedSourcePool = "000000000000000000000000cccccccccccccccc" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" @@ -3035,17 +3063,17 @@ testVerifyInboundMessageInvalidSourcePool = script do "test-pool-verify-invalid" -- Deploy pool with only allowedSourcePool in remotePools - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = [allowedSourcePool] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = "test-pool-verify-invalid" @@ -3054,13 +3082,13 @@ testVerifyInboundMessageInvalidSourcePool = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId "test-rmn-verify-invalid" "test-feequoter-verify-invalid" ccipOwner ccipOwner -- Build message with disallowed source pool - let destTokenAddr = MessageCodecV1.encodeInstrumentId testInstrumentId - let message = MessageCodecV1.MessageV1 with + let destTokenAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId testInstrumentId + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -3071,21 +3099,21 @@ testVerifyInboundMessageInvalidSourcePool = script do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 5000000.0) + tokenTransfer = Some CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 5000000.0) sourcePoolAddress = disallowedSourcePool sourceTokenAddress = "000000000000000000000000bbbbbbbbbbbbbbbb" destTokenAddress = destTokenAddr - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "" messageData = "" - let offRampInstanceAddress = RawInstanceAddress.make "test-offramp" ccipOwner - let tarInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampInstanceAddress = Chainlink.InstanceAddress.make "test-offramp" ccipOwner + let tarInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -3101,23 +3129,23 @@ testVerifyInboundMessageInvalidSourcePool = script do receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampInstanceAddress - globalConfig = RawInstanceAddress.make "test-globalconfig" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn" ccipOwner tokenAdminRegistry = tarInstanceAddress - state = ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs -- Exercise VerifyInboundMessage - should fail disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry disclosedTokenConfig <- fromSome <$> queryDisclosure ccipOwner tokenConfigCid submitMustFail (actAs poolOwner <> actAs ccipOwner <> actAs receiver <> disclose disclosedTar <> disclose disclosedTokenConfig) do - exerciseCmd tokenPool LockReleaseTokenPool.VerifyInboundMessage with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.VerifyInboundMessage with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid caller = receiver debug "testVerifyInboundMessageInvalidSourcePool: PASSED" @@ -3134,7 +3162,7 @@ testVerifyInboundMessageMissingChainConfig = script do let unconfiguredChainSelector : Numeric 0 = 999.0 let tokenAdminRegistryInstanceId = "test-tar-verify-nochain" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" @@ -3147,17 +3175,17 @@ testVerifyInboundMessageMissingChainConfig = script do "test-pool-verify-nochain" -- Deploy pool with config for sourceChainSelector only (not unconfiguredChainSelector) - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["000000000000000000000000aaaaaaaaaaaaaaaa"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = "test-pool-verify-nochain" @@ -3166,13 +3194,13 @@ testVerifyInboundMessageMissingChainConfig = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId "test-rmn-verify-nochain" "test-feequoter-verify-nochain" ccipOwner ccipOwner -- Build message from an unconfigured source chain - let destTokenAddr = MessageCodecV1.encodeInstrumentId testInstrumentId - let message = MessageCodecV1.MessageV1 with + let destTokenAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId testInstrumentId + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = unconfiguredChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -3183,21 +3211,21 @@ testVerifyInboundMessageMissingChainConfig = script do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 5000000.0) + tokenTransfer = Some CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 5000000.0) sourcePoolAddress = "000000000000000000000000aaaaaaaaaaaaaaaa" sourceTokenAddress = "000000000000000000000000bbbbbbbbbbbbbbbb" destTokenAddress = destTokenAddr - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "" messageData = "" - let offRampInstanceAddress = RawInstanceAddress.make "test-offramp" ccipOwner - let tarInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampInstanceAddress = Chainlink.InstanceAddress.make "test-offramp" ccipOwner + let tarInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" @@ -3213,23 +3241,23 @@ testVerifyInboundMessageMissingChainConfig = script do receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampInstanceAddress - globalConfig = RawInstanceAddress.make "test-globalconfig" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn" ccipOwner tokenAdminRegistry = tarInstanceAddress - state = ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs -- Exercise VerifyInboundMessage - should fail (missing chain config) disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry disclosedTokenConfig <- fromSome <$> queryDisclosure ccipOwner tokenConfigCid submitMustFail (actAs poolOwner <> actAs ccipOwner <> actAs receiver <> disclose disclosedTar <> disclose disclosedTokenConfig) do - exerciseCmd tokenPool LockReleaseTokenPool.VerifyInboundMessage with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.VerifyInboundMessage with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid caller = receiver debug "testVerifyInboundMessageMissingChainConfig: PASSED" @@ -3249,7 +3277,7 @@ testVerifyInboundMessage_RejectsMismatchedSourceToken = script do let configuredRemoteToken = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" let wrongSourceToken = "ffffffffffffffffffffffffffffffffffffffff" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" @@ -3260,17 +3288,17 @@ testVerifyInboundMessage_RejectsMismatchedSourceToken = script do testInstrumentId "test-pool-verify-mismatch" - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = [allowedSourcePool] remoteTokenAddress = configuredRemoteToken inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 2000 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = "test-pool-verify-mismatch" @@ -3279,12 +3307,12 @@ testVerifyInboundMessage_RejectsMismatchedSourceToken = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId "test-rmn-verify-mismatch" "test-feequoter-verify-mismatch" ccipOwner ccipOwner - let destTokenAddr = MessageCodecV1.encodeInstrumentId testInstrumentId - let message = MessageCodecV1.MessageV1 with + let destTokenAddr = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId testInstrumentId + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -3295,21 +3323,21 @@ testVerifyInboundMessage_RejectsMismatchedSourceToken = script do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 5000000.0) + tokenTransfer = Some CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 5000000.0) sourcePoolAddress = allowedSourcePool sourceTokenAddress = wrongSourceToken destTokenAddress = destTokenAddr - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "" messageData = "" - let offRampInstanceAddress = RawInstanceAddress.make "test-offramp-mismatch" ccipOwner - let tarInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampInstanceAddress = Chainlink.InstanceAddress.make "test-offramp-mismatch" ccipOwner + let tarInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc" @@ -3325,22 +3353,22 @@ testVerifyInboundMessage_RejectsMismatchedSourceToken = script do receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampInstanceAddress - globalConfig = RawInstanceAddress.make "test-globalconfig" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-verify-mismatch" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-verify-mismatch" ccipOwner tokenAdminRegistry = tarInstanceAddress - state = ExecutingMessageV1.ExecutingMessageState_RequirePoolCCVs + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry disclosedTokenConfig <- fromSome <$> queryDisclosure ccipOwner tokenConfigCid submitMustFail (actAs poolOwner <> actAs ccipOwner <> actAs receiver <> disclose disclosedTar <> disclose disclosedTokenConfig) do - exerciseCmd tokenPool LockReleaseTokenPool.VerifyInboundMessage with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - executingMessageCid = executingMessageCid + exerciseCmd tokenPool CCIP.LockReleaseTokenPoolV1.VerifyInboundMessage with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + executingMessageCid = coerceContractId executingMessageCid caller = receiver debug "testVerifyInboundMessage_RejectsMismatchedSourceToken: PASSED" @@ -3359,19 +3387,19 @@ testCalculateFeeFallsBackToFeeQuoter = script do let destChainSelector : Numeric 0 = 456.0 let sourceChainSelector : Numeric 0 = 123.0 - let feeTokenId = HoldingV1.InstrumentId with + let feeTokenId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" feeQuoter <- submit ccipOwner do - createCmd FeeQuoter.FeeQuoter with - owner = ccipOwner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = ccipOwner instanceId = feeQuoterInstanceId feeTokens = Set.fromList [feeTokenId] - destChainConfigs = Map.fromList [(destChainSelector, FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 5000000 @@ -3381,13 +3409,13 @@ testCalculateFeeFallsBackToFeeQuoter = script do linkFeeMultiplierPercent = 100.0 defaultTokenFeeUSD = usdToCents 0.5 defaultTokenDestGasOverhead = 11111)] - tokenTransferFeeConfigs = Map.fromList [(destChainSelector, Map.fromList [(testInstrumentId, FeeQuoter.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(destChainSelector, Map.fromList [(testInstrumentId, CCIP.CoreV1.FeeQuoter.TokenTransferFeeConfig with isEnabled = True feeUSD = usdToCents 3.0 destGasOverhead = 70000 destBytesOverhead = 64)])] usdPerUnitGasByDestChainSelector = Map.empty - usdPerToken = Map.fromList [(feeTokenId, FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] + usdPerToken = Map.fromList [(feeTokenId, CCIP.CoreV1.FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = feeTokenId priceUpdaters = [ccipOwner] @@ -3399,17 +3427,17 @@ testCalculateFeeFallsBackToFeeQuoter = script do tokenPoolInstanceId -- Create token pool - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["000000000000000000000000aaaaaaaaaaaaaaaa"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = tokenPoolInstanceId @@ -3418,30 +3446,30 @@ testCalculateFeeFallsBackToFeeQuoter = script do rateLimitAdmin = None remoteChainConfigs = Map.fromList [(sourceChainSelector, existingConfig)] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps tokenAdminRegistryInstanceId "test-rmn-fallback" feeQuoterInstanceId ccipOwner ccipOwner - let senderAddr = MessageCodecV1.encodePartyAddress sender + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router-fallback" sender - onRamp = RawInstanceAddress.make "test-onramp-fallback" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig-fallback" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-fallback" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tar-fallback" ccipOwner - feeQuoter = RawInstanceAddress.make "test-feequoter-fallback" ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router-fallback" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp-fallback" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-fallback" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-fallback" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tar-fallback" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-fallback" ccipOwner destChainSelector = destChainSelector destAddressBytesLength = 20 sequenceNumber = 1.0 requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor-fallback" ccipOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor-fallback" ccipOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = sourceChainSelector senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -3459,6 +3487,7 @@ testCalculateFeeFallsBackToFeeQuoter = script do feeToken = feeTokenId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some testInstrumentId + tokenAmountBeforeTokenPoolFees = 100.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -3474,7 +3503,7 @@ testCalculateFeeFallsBackToFeeQuoter = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry @@ -3482,17 +3511,17 @@ testCalculateFeeFallsBackToFeeQuoter = script do disclosedFq <- fromSome <$> queryDisclosure ccipOwner feeQuoter sendingMessageCid <- submit (actAs sender <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFq) do - exerciseCmd (toInterfaceContractId @ITokenPool.ITokenPool tokenPool) - ITokenPool.TokenPool_CalculateFee with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - sendingMessageCid = sendingMessageCid - feeQuoterCid = feeQuoter + exerciseCmd (toInterfaceContractId @CCIP.InterfacesV1.TokenPool.ITokenPool tokenPool) + CCIP.InterfacesV1.TokenPool.TokenPool_CalculateFee with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + sendingMessageCid = coerceContractId sendingMessageCid + feeQuoterCid = coerceContractId feeQuoter tokenInstrumentId = testInstrumentId caller = sender - Some sm <- queryContractId ccipOwner sendingMessageCid + Some sm <- queryContractId ccipOwner (coerceContractId sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) let tokenSendFee = fromSome sm.tokenSendFee tokenSendFee.feeUSDCents === usdToCents 3.0 tokenSendFee.destGasOverhead === 70000 @@ -3508,19 +3537,19 @@ testCalculateFeePrefersPoolOverride = script do sender <- allocateParty "sender-pool-override" let destChainSelector : Numeric 0 = 456.0 - let feeTokenId = HoldingV1.InstrumentId with + let feeTokenId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" feeQuoter <- submit ccipOwner do - createCmd FeeQuoter.FeeQuoter with - owner = ccipOwner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = ccipOwner instanceId = "test-feequoter-pool-override" feeTokens = Set.fromList [feeTokenId] - destChainConfigs = Map.fromList [(destChainSelector, FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 5000000 @@ -3530,13 +3559,13 @@ testCalculateFeePrefersPoolOverride = script do linkFeeMultiplierPercent = 100.0 defaultTokenFeeUSD = usdToCents 0.5 defaultTokenDestGasOverhead = 11111)] - tokenTransferFeeConfigs = Map.fromList [(destChainSelector, Map.fromList [(testInstrumentId, FeeQuoter.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(destChainSelector, Map.fromList [(testInstrumentId, CCIP.CoreV1.FeeQuoter.TokenTransferFeeConfig with isEnabled = True feeUSD = usdToCents 9.0 destGasOverhead = 90000 destBytesOverhead = 96)])] usdPerUnitGasByDestChainSelector = Map.empty - usdPerToken = Map.fromList [(feeTokenId, FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] + usdPerToken = Map.fromList [(feeTokenId, CCIP.CoreV1.FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = feeTokenId priceUpdaters = [ccipOwner] @@ -3548,17 +3577,17 @@ testCalculateFeePrefersPoolOverride = script do "test-lock-release-pool-override" -- Create token pool with fee config that should override FeeQuoter's - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["000000000000000000000000aaaaaaaaaaaaaaaa"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = "test-lock-release-pool-override" @@ -3566,36 +3595,36 @@ testCalculateFeePrefersPoolOverride = script do decimals = 10 rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, existingConfig)] - tokenTransferFeeConfigs = Map.fromList [(destChainSelector, LockReleaseTokenPool.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(destChainSelector, CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfig with isEnabled = True feeUSDCents = cents 2.0 feeBps = 0.0 destGasOverhead = 50000 destBytesOverhead = 32)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps "test-tar-override" "test-rmn-override" "test-feequoter-pool-override" ccipOwner ccipOwner - let senderAddr = MessageCodecV1.encodePartyAddress sender + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router-override" sender - onRamp = RawInstanceAddress.make "test-onramp-override" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig-override" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-override" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tar-override" ccipOwner - feeQuoter = RawInstanceAddress.make "test-feequoter-pool-override" ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router-override" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp-override" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-override" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-override" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tar-override" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-pool-override" ccipOwner destChainSelector = destChainSelector destAddressBytesLength = 20 sequenceNumber = 1.0 requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor-override" ccipOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor-override" ccipOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -3613,6 +3642,7 @@ testCalculateFeePrefersPoolOverride = script do feeToken = feeTokenId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some testInstrumentId + tokenAmountBeforeTokenPoolFees = 100.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -3628,7 +3658,7 @@ testCalculateFeePrefersPoolOverride = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry @@ -3636,17 +3666,17 @@ testCalculateFeePrefersPoolOverride = script do disclosedFq <- fromSome <$> queryDisclosure ccipOwner feeQuoter disclosedSm <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid sendingMessageCid <- submit (actAs sender <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFq <> disclose disclosedSm) do - exerciseCmd (toInterfaceContractId @ITokenPool.ITokenPool tokenPool) - ITokenPool.TokenPool_CalculateFee with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - sendingMessageCid = sendingMessageCid - feeQuoterCid = feeQuoter + exerciseCmd (toInterfaceContractId @CCIP.InterfacesV1.TokenPool.ITokenPool tokenPool) + CCIP.InterfacesV1.TokenPool.TokenPool_CalculateFee with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + sendingMessageCid = coerceContractId sendingMessageCid + feeQuoterCid = coerceContractId feeQuoter tokenInstrumentId = testInstrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = sender - Some sm <- queryContractId ccipOwner sendingMessageCid + Some sm <- queryContractId ccipOwner (coerceContractId sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) let tokenSendFee = fromSome sm.tokenSendFee tokenSendFee.feeUSDCents === cents 2.0 tokenSendFee.destGasOverhead === 50000 @@ -3654,7 +3684,7 @@ testCalculateFeePrefersPoolOverride = script do debug "testCalculateFeePrefersPoolOverride: PASSED" --- M-6: disabled pool fee config should fall back to FeeQuoter. +-- M-6: disabled pool fee config should fall back to CCIP.CoreV1.FeeQuoter. testCalculateFeeFallsBackWhenPoolFeeDisabled : Script () testCalculateFeeFallsBackWhenPoolFeeDisabled = script do ccipOwner <- allocateParty "ccip-owner-pool-disabled" @@ -3662,19 +3692,19 @@ testCalculateFeeFallsBackWhenPoolFeeDisabled = script do sender <- allocateParty "sender-pool-disabled" let destChainSelector : Numeric 0 = 456.0 - let feeTokenId = HoldingV1.InstrumentId with + let feeTokenId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TestToken" feeQuoter <- submit ccipOwner do - createCmd FeeQuoter.FeeQuoter with - owner = ccipOwner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = ccipOwner instanceId = "test-feequoter-pool-disabled" feeTokens = Set.fromList [feeTokenId] - destChainConfigs = Map.fromList [(destChainSelector, FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 5000000 @@ -3684,13 +3714,13 @@ testCalculateFeeFallsBackWhenPoolFeeDisabled = script do linkFeeMultiplierPercent = 100.0 defaultTokenFeeUSD = usdToCents 0.5 defaultTokenDestGasOverhead = 11111)] - tokenTransferFeeConfigs = Map.fromList [(destChainSelector, Map.fromList [(testInstrumentId, FeeQuoter.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(destChainSelector, Map.fromList [(testInstrumentId, CCIP.CoreV1.FeeQuoter.TokenTransferFeeConfig with isEnabled = True feeUSD = usdToCents 4.0 destGasOverhead = 71000 destBytesOverhead = 65)])] usdPerUnitGasByDestChainSelector = Map.empty - usdPerToken = Map.fromList [(feeTokenId, FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] + usdPerToken = Map.fromList [(feeTokenId, CCIP.CoreV1.FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = feeTokenId priceUpdaters = [ccipOwner] @@ -3701,17 +3731,17 @@ testCalculateFeeFallsBackWhenPoolFeeDisabled = script do testInstrumentId "test-lock-release-pool-disabled" - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["000000000000000000000000aaaaaaaaaaaaaaaa"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-in@owner" -- placeholder + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "rate-limiter-out@owner" -- placeholder tokenPool <- submit poolOwner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = poolOwner ccipOwner = ccipOwner instanceId = "test-lock-release-pool-disabled" @@ -3719,36 +3749,36 @@ testCalculateFeeFallsBackWhenPoolFeeDisabled = script do decimals = 10 rateLimitAdmin = None remoteChainConfigs = Map.fromList [(destChainSelector, existingConfig)] - tokenTransferFeeConfigs = Map.fromList [(destChainSelector, LockReleaseTokenPool.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(destChainSelector, CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfig with isEnabled = False feeUSDCents = cents 2.0 feeBps = 0.0 destGasOverhead = 50000 destBytesOverhead = 32)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps "test-tar-disabled" "test-rmn-disabled" "test-feequoter-pool-disabled" ccipOwner ccipOwner - let senderAddr = MessageCodecV1.encodePartyAddress sender + let senderAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress sender sendingMessageCid <- submit ccipOwner do - createCmd SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with ccipOwner = ccipOwner sender = sender - deps = SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "test-router-disabled" sender - onRamp = RawInstanceAddress.make "test-onramp-disabled" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalconfig-disabled" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmn-disabled" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tar-disabled" ccipOwner - feeQuoter = RawInstanceAddress.make "test-feequoter-pool-disabled" ccipOwner + deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "test-router-disabled" sender + onRamp = Chainlink.InstanceAddress.make "test-onramp-disabled" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalconfig-disabled" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmn-disabled" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tar-disabled" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-pool-disabled" ccipOwner destChainSelector = destChainSelector destAddressBytesLength = 20 sequenceNumber = 1.0 requiredCCVs = [] destDefaultCCVs = [] requiredExecutor = None - executorAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "default-executor-disabled" ccipOwner) - executionMode = Some SendingMessageV1.ExecutionMode_NoExecutor + executorAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "default-executor-disabled" ccipOwner) + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = senderAddr receiver = "0000000000000000000000000000000000000001" @@ -3766,6 +3796,7 @@ testCalculateFeeFallsBackWhenPoolFeeDisabled = script do feeToken = feeTokenId networkFeeUSDCents = cents 0.0 expectedTokenInstrumentId = Some testInstrumentId + tokenAmountBeforeTokenPoolFees = 100.0 outboundPoolCCVs = Some [] executorArgs = "" executorFee = None @@ -3781,7 +3812,7 @@ testCalculateFeeFallsBackWhenPoolFeeDisabled = script do ccvOwners = [] tokenSendData = None observingParties = [sender] - state = SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared disclosedPool <- fromSome <$> queryDisclosure poolOwner tokenPool disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry @@ -3789,17 +3820,17 @@ testCalculateFeeFallsBackWhenPoolFeeDisabled = script do disclosedFq <- fromSome <$> queryDisclosure ccipOwner feeQuoter disclosedSm <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid sendingMessageCid <- submit (actAs sender <> disclose disclosedPool <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedFq <> disclose disclosedSm) do - exerciseCmd (toInterfaceContractId @ITokenPool.ITokenPool tokenPool) - ITokenPool.TokenPool_CalculateFee with - tokenAdminRegistryCid = tokenAdminRegistry - tokenConfigCid = tokenConfigCid - extraContext = MetadataV1.emptyChoiceContext - sendingMessageCid = sendingMessageCid - feeQuoterCid = feeQuoter + exerciseCmd (toInterfaceContractId @CCIP.InterfacesV1.TokenPool.ITokenPool tokenPool) + CCIP.InterfacesV1.TokenPool.TokenPool_CalculateFee with + tokenAdminRegistryCid = coerceContractId tokenAdminRegistry + tokenConfigCid = coerceContractId tokenConfigCid + context = Splice.Api.Token.MetadataV1.emptyChoiceContext + sendingMessageCid = coerceContractId sendingMessageCid + feeQuoterCid = coerceContractId feeQuoter tokenInstrumentId = testInstrumentId caller = sender - Some sm <- queryContractId ccipOwner sendingMessageCid + Some sm <- queryContractId ccipOwner (coerceContractId sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) let tokenSendFee = fromSome sm.tokenSendFee tokenSendFee.feeUSDCents === usdToCents 4.0 tokenSendFee.destGasOverhead === 71000 @@ -3812,19 +3843,19 @@ testFeeQuoterGetTokenTransferFee_Defaults : Script () testFeeQuoterGetTokenTransferFee_Defaults = script do owner <- allocateParty "owner-feequoter-defaults" let destChainSelector : Numeric 0 = 456.0 - let linkToken = HoldingV1.InstrumentId with + let linkToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "LINK" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "TestToken" feeQuoter <- submit owner do - createCmd FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-defaults" feeTokens = Set.fromList [linkToken] - destChainConfigs = Map.fromList [(destChainSelector, FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 5000000 @@ -3836,14 +3867,15 @@ testFeeQuoterGetTokenTransferFee_Defaults = script do defaultTokenDestGasOverhead = 12345)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.empty - usdPerToken = Map.fromList [(linkToken, FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] + usdPerToken = Map.fromList [(linkToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = linkToken priceUpdaters = [owner] (feeUSD, destGasOverhead, destBytesOverhead) <- submit owner do - exerciseCmd feeQuoter FeeQuoter.GetTokenTransferFee with + exerciseCmd (coerceContractId @_ @CCIP.APIV1.FeeQuoter.IFeeQuoter feeQuoter) CCIP.APIV1.FeeQuoter.FeeQuoter_GetTokenTransferFee with destChainSelector = destChainSelector token = testInstrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner feeUSD === usdToCents 0.75 @@ -3858,45 +3890,47 @@ testFeeQuoterGetTokenTransferFee_PerDestination = script do owner <- allocateParty "owner-feequoter-per-dest" let destChainSelector1 : Numeric 0 = 456.0 let destChainSelector2 : Numeric 0 = 789.0 - let linkToken = HoldingV1.InstrumentId with + let linkToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "LINK" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "TestToken" feeQuoter <- submit owner do - createCmd FeeQuoter.FeeQuoter with - owner = owner + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with + ccipOwner = owner instanceId = "test-feequoter-per-dest" feeTokens = Set.fromList [linkToken] destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.fromList - [ (destChainSelector1, Map.fromList [(testInstrumentId, FeeQuoter.TokenTransferFeeConfig with + [ (destChainSelector1, Map.fromList [(testInstrumentId, CCIP.CoreV1.FeeQuoter.TokenTransferFeeConfig with isEnabled = True feeUSD = usdToCents 1.0 destGasOverhead = 10000 destBytesOverhead = 32)]) - , (destChainSelector2, Map.fromList [(testInstrumentId, FeeQuoter.TokenTransferFeeConfig with + , (destChainSelector2, Map.fromList [(testInstrumentId, CCIP.CoreV1.FeeQuoter.TokenTransferFeeConfig with isEnabled = True feeUSD = usdToCents 2.0 destGasOverhead = 20000 destBytesOverhead = 64)]) ] usdPerUnitGasByDestChainSelector = Map.empty - usdPerToken = Map.fromList [(linkToken, FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] + usdPerToken = Map.fromList [(linkToken, CCIP.CoreV1.FeeQuoter.TimestampedPrice 15.0 (time (date 2026 Jan 1) 0 0 0))] linkTokenInstrumentId = linkToken priceUpdaters = [owner] (fee1, gas1, bytes1) <- submit owner do - exerciseCmd feeQuoter FeeQuoter.GetTokenTransferFee with + exerciseCmd (coerceContractId @_ @CCIP.APIV1.FeeQuoter.IFeeQuoter feeQuoter) CCIP.APIV1.FeeQuoter.FeeQuoter_GetTokenTransferFee with destChainSelector = destChainSelector1 token = testInstrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner (fee2, gas2, bytes2) <- submit owner do - exerciseCmd feeQuoter FeeQuoter.GetTokenTransferFee with + exerciseCmd (coerceContractId @_ @CCIP.APIV1.FeeQuoter.IFeeQuoter feeQuoter) CCIP.APIV1.FeeQuoter.FeeQuoter_GetTokenTransferFee with destChainSelector = destChainSelector2 token = testInstrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner fee1 === usdToCents 1.0 @@ -3916,19 +3950,19 @@ testLockReleaseTokenPool_ApplyChainUpdates = script do -- | Create LockReleaseTokenPool without any remote chain configs tokenPoolCid <- submit owner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = owner ccipOwner = ccipOwner instanceId = "test-lock-release-pool" - instrumentId = HoldingV1.InstrumentId with + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" decimals = 8 rateLimitAdmin = None remoteChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps "test-tar" "test-rmn" "test-feequoter-pool" ccipOwner ccipOwner -- | ======== Test 1 ======== @@ -3936,29 +3970,29 @@ testLockReleaseTokenPool_ApplyChainUpdates = script do -- | ======================== let remoteChainSelectorsToRemove1 = [] chainsToAdd1 = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 123.0 remotePools = [] remoteTokenAddress = "f43dc4783082e7f5ceb0f5e3bdff4a9acc3b0ace" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.empty - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" - ,LockReleaseTokenPool.ChainUpdate with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.empty + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" + ,CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 456.0 remotePools = ["11111111"] remoteTokenAddress = "cf383e3c65a8f8ec69b3a4fbdf0ceed7de4cd6a2cdf1ff6f82fa2eb3addf7b2e960f" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = remoteChainSelectorsToRemove1 chainsToAdd = chainsToAdd1 -- Fetch the updated TokenPool and verify the chain configs were added correctly @@ -3976,29 +4010,29 @@ testLockReleaseTokenPool_ApplyChainUpdates = script do -- | ======================== let remoteChainSelectorsToRemove2 = [456.0] -- remove the chain config for 456.0 so we can test that it gets replaced with the updated config chainsToAdd2 = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 456.0 remotePools = ["d4c6971c2ddba89df0e572d6f3bc5369da4af478"] remoteTokenAddress = "410933dc7dd6966ba1c875ab1e19a997fd82c968" - inboundCCVs = [RawInstanceAddress.RawInstanceAddress "inbound-ccv-1@owner"] - outboundCCVs = [RawInstanceAddress.RawInstanceAddress "outbound-ccv-1@owner"] + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "inbound-ccv-1@owner"] + outboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "outbound-ccv-1@owner"] finalityConfig = finalityConfig 12 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-updated@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom-updated@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-updated@owner" - ,LockReleaseTokenPool.ChainUpdate with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-updated@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom-updated@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-updated@owner" + ,CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 789.0 remotePools = ["0e924f6aa7efe932fab131bfc7baa7a684dbb1f8", "ac5fab2bda87e867accdede1c7ff1eeaadb2dcac"] remoteTokenAddress = "f43dc4783082e7f5ceb0f5e3bdff4a9acc3b0ace" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = remoteChainSelectorsToRemove2 chainsToAdd = chainsToAdd2 -- Fetch the updated TokenPool and verify the chain configs were updated/added correctly @@ -4020,7 +4054,7 @@ testLockReleaseTokenPool_ApplyChainUpdates = script do let remoteChainSelectorsToRemove3 = [123.0] chainsToAdd3 = [] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = remoteChainSelectorsToRemove3 chainsToAdd = chainsToAdd3 -- Fetch the updated TokenPool and verify the chain config was removed @@ -4040,253 +4074,253 @@ testLockReleaseTokenPool_ApplyChainUpdates = script do -- | Empty custom-finality rate limiter is allowed when finalityConfig = finalized-only -- | ======================== tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 123.0 remotePools = [] remoteTokenAddress = "f43dc4783082e7f5ceb0f5e3bdff4a9acc3b0ace" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-no-custom@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.empty - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-no-custom@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-no-custom@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.empty + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-no-custom@owner" ] tokenPool <- fromSome <$> queryContractId owner tokenPoolCid case Map.lookup 123.0 tokenPool.remoteChainConfigs of None -> assertMsg "Missing chain config for selector 123.0" False Some config -> assertMsg "Expected empty custom-finality rate limiter when finalityConfig is finalized-only" - (config.inboundCustomBlockConfirmationsRateLimiter == RawInstanceAddress.empty) + (config.inboundCustomBlockConfirmationsRateLimiter == Chainlink.InstanceAddress.empty) -- | ======== Test 5 ======== -- | Test invalid updates -- | ======================== -- Attempt to remove a non-existent chain config submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [999.0] -- does not exist chainsToAdd = [] -- Attempt to add a chain that already exists without removing it first submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 456.0 -- already exists from Test 2 remotePools = [] remoteTokenAddress = "0dc30564e1ee874ad293fe9562714b2d0c2e2b6c" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to add a chain with an invalid chain selector (negative) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = -1.0 -- invalid remotePools = [] remoteTokenAddress = "0dc30564e1ee874ad293fe9562714b2d0c2e2b6c" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to add an invalid chain config (empty remote token address) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 999.0 remotePools = [] remoteTokenAddress = "" -- invalid inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to add an invalid chain config (duplicate CCVs in inboundCCVs) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 999.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" - inboundCCVs = [RawInstanceAddress.RawInstanceAddress "inbound-ccv-1@owner", RawInstanceAddress.RawInstanceAddress "inbound-ccv-1@owner"] -- duplicate + inboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "inbound-ccv-1@owner", Chainlink.InstanceAddress.RawInstanceAddress "inbound-ccv-1@owner"] -- duplicate outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to add an invalid chain config (duplicate CCVs in outboundCCVs) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 999.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] - outboundCCVs = [RawInstanceAddress.RawInstanceAddress "outbound-ccv-1@owner", RawInstanceAddress.RawInstanceAddress "outbound-ccv-1@owner"] -- duplicate + outboundCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "outbound-ccv-1@owner", Chainlink.InstanceAddress.RawInstanceAddress "outbound-ccv-1@owner"] -- duplicate finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to add an invalid chain config (empty inbound rate limiter address) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 999.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "" -- invalid - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "" -- invalid + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to add an invalid chain config (empty outbound rate limiter address) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 999.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "" -- invalid + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "" -- invalid ] -- Attempt to add an invalid chain config (empty custom-finality rate limiter when finalityConfig is faster than finality) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 999.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 7 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.empty - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.empty + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Duplicate remote chain selectors within chainsToAdd submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 996.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" - , LockReleaseTokenPool.ChainUpdate with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" + , CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 996.0 remotePools = [] remoteTokenAddress = "d8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-b@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom-b@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-b@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-b@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom-b@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-b@owner" ] -- Custom-finality limiter must not reuse inbound limiter instance submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 995.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 7 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "shared-with-custom@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "shared-with-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "shared-with-custom@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "shared-with-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Custom-finality limiter must not reuse outbound limiter instance submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 994.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 7 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-shared@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-shared@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-shared@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-shared@owner" ] -- Attempt to add an invalid chain config (duplicate remote pool addresses) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 999.0 remotePools = ["11111111", "11111111"] -- duplicate remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to add an invalid chain config (identical rate limiter for inbound and outbound) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyChainUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyChainUpdates with remoteChainSelectorsToRemove = [] chainsToAdd = [ - LockReleaseTokenPool.ChainUpdate with + CCIP.LockReleaseTokenPoolV1.ChainUpdate with remoteChainSelector = 999.0 remotePools = [] remoteTokenAddress = "c8481ffd74cf5648c48ed4cebabf6c6006d8bffe" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "same-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "same-rl@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "same-rl@owner" -- invalid + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-rl@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-rl@owner" -- invalid ] pure () @@ -4300,58 +4334,58 @@ testLockReleaseTokenPool_SetRateLimiterReferences = script do -- | Create LockReleaseTokenPool without existing remote chain config tokenPoolCid <- submit owner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = owner ccipOwner = ccipOwner instanceId = "test-lock-release-pool" - instrumentId = HoldingV1.InstrumentId with + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" decimals = 8 rateLimitAdmin = Some rateLimitAdmin remoteChainConfigs = Map.fromList [ - (123.0, LockReleaseTokenPool.RemoteChainConfig with + (123.0, CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = [] remoteTokenAddress = "f43dc4783082e7f5ceb0f5e3bdff4a9acc3b0ace" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.empty - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner") - ,(456.0, LockReleaseTokenPool.RemoteChainConfig with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.empty + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner") + ,(456.0, CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["11111111"] remoteTokenAddress = "cf383e3c65a8f8ec69b3a4fbdf0ceed7de4cd6a2cdf1ff6f82fa2eb3addf7b2e960f" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 12 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ) ] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps "test-tar" "test-rmn" "test-feequoter-pool" ccipOwner ccipOwner -- | ========= Test 1 ======== -- | Update multiple rate limiters for existing chain config -- | ======================== let rateLimitConfigArgs1 = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 123.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-updated-123@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-123@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-updated-123@owner" - ,LockReleaseTokenPool.RateLimitConfigArgs with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-updated-123@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-123@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-updated-123@owner" + ,CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 456.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-updated-456@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-456@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-updated-456@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-updated-456@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-456@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-updated-456@owner" ] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = rateLimitConfigArgs1 -- Fetch the updated TokenPool and verify the rate limiters were updated correctly tokenPool <- fromSome <$> queryContractId owner tokenPoolCid @@ -4367,14 +4401,14 @@ testLockReleaseTokenPool_SetRateLimiterReferences = script do -- | Update a single rate limiter for existing chain config -- | ======================== let rateLimitConfigArgs2 = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 123.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-updated-again@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-again@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-updated@owner" -- unchanged + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-updated-again@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-again@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-updated@owner" -- unchanged ] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = rateLimitConfigArgs2 -- Fetch the updated TokenPool and verify the rate limiters were updated correctly tokenPool <- fromSome <$> queryContractId owner tokenPoolCid @@ -4390,38 +4424,38 @@ testLockReleaseTokenPool_SetRateLimiterReferences = script do -- | rateLimitAdmin cannot redirect rate limiter identities -- | ======================== let rateLimitConfigArgs3 = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 456.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-updated-again-3@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-again-3@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-updated-3@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-updated-again-3@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-again-3@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-updated-3@owner" ] submitMustFail rateLimitAdmin do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = rateLimitConfigArgs3 -- | ========= Test 3b ======== -- | poolOwner may tune the deployed inbound limiter for chain 456 via SetRateLimitConfig -- | ======================== - (inbound456Cid, inbound456Addr) <- createRateLimiter owner "test-lock-release-pool" 456.0 RateLimiter.RateLimitDirection_Inbound 100.0 10.0 + (inbound456Cid, inbound456Addr) <- createRateLimiter owner "test-lock-release-pool" 456.0 CCIP.RateLimiterV1.RateLimitDirection_Inbound 100.0 10.0 tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 456.0 inboundRateLimiter = inbound456Addr - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-456@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-updated-456@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom-updated-456@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-updated-456@owner" ] submitMustFail rateLimitAdmin do - exerciseCmd inbound456Cid RateLimiter.SetConfig with + exerciseCmd inbound456Cid CCIP.RateLimiterV1.SetConfig with newIsEnabled = True newCapacity = 99.0 newRate = 9.0 updatedInbound456Cid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimitConfig with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimitConfig with caller = rateLimitAdmin rateLimiterCid = inbound456Cid newIsEnabled = True @@ -4436,14 +4470,14 @@ testLockReleaseTokenPool_SetRateLimiterReferences = script do -- | Empty custom-finality rate limiter is allowed when finalityConfig = finalized-only -- | ======================== let rateLimitConfigArgs4 = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 123.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-no-custom@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.empty - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl-no-custom@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-no-custom@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.empty + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl-no-custom@owner" ] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = rateLimitConfigArgs4 tokenPool <- fromSome <$> queryContractId owner tokenPoolCid case Map.lookup 123.0 tokenPool.remoteChainConfigs of @@ -4455,83 +4489,83 @@ testLockReleaseTokenPool_SetRateLimiterReferences = script do -- | ======================== -- Attempt to update rate limiters for a non-existent chain config submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 999.0 -- does not exist - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to update with an invalid chain selector (negative) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = -1.0 -- invalid - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to update with an invalid inbound rate limiter address (empty) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 123.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "" -- invalid - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "" -- invalid + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Attempt to update with an invalid outbound rate limiter address (empty) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 123.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "" -- invalid + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "" -- invalid ] -- Attempt to update with an identical rate limiter for both inbound and outbound (invalid) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 123.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "same-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "same-rl@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "same-rl@owner" -- invalid + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-rl@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-rl@owner" -- invalid ] -- Attempt to update a chain that requires custom finality with an empty custom rate limiter submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 456.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.empty - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.empty + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ] -- Chain requires custom finality: custom limiter must not equal inbound submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 456.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "same-as-custom-in@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "same-as-custom-in@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-distinct@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-as-custom-in@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-as-custom-in@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-distinct@owner" ] -- Chain requires custom finality: custom limiter must not equal outbound submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.SetRateLimiterReferences with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.SetRateLimiterReferences with rateLimitConfigArgs = [ - LockReleaseTokenPool.RateLimitConfigArgs with + CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs with remoteChainSelector = 456.0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-distinct@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "same-as-out@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "same-as-out@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-distinct@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-as-out@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "same-as-out@owner" ] pure () @@ -4540,21 +4574,21 @@ testPoolTokenTransferFeeConfigRejectsInvalidFeeBps : Script () testPoolTokenTransferFeeConfigRejectsInvalidFeeBps = script do owner <- allocateParty "owner-invalid-fee-bps" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "TestToken" - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["000000000000000000000000aaaaaaaaaaaaaaaa"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" submitMustFail owner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = owner ccipOwner = owner instanceId = "test-lock-release-invalid-fee-bps" @@ -4562,14 +4596,14 @@ testPoolTokenTransferFeeConfigRejectsInvalidFeeBps = script do decimals = 10 rateLimitAdmin = None remoteChainConfigs = Map.fromList [(123.0, existingConfig)] - tokenTransferFeeConfigs = Map.fromList [(123.0, LockReleaseTokenPool.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(123.0, CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfig with isEnabled = True feeUSDCents = cents 0.0 feeBps = 10000.0 destGasOverhead = 0 destBytesOverhead = 32)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps "test-tar-invalid-fee-bps" "test-rmn-invalid-fee-bps" "test-fq-invalid-fee-bps" owner owner pure () @@ -4578,21 +4612,21 @@ testPoolTokenTransferFeeConfigRejectsSmallDestBytesOverhead : Script () testPoolTokenTransferFeeConfigRejectsSmallDestBytesOverhead = script do owner <- allocateParty "owner-invalid-dest-bytes-overhead" - let testInstrumentId = HoldingV1.InstrumentId with + let testInstrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = owner id = "TestToken" - let existingConfig = LockReleaseTokenPool.RemoteChainConfig with + let existingConfig = CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["000000000000000000000000aaaaaaaaaaaaaaaa"] remoteTokenAddress = "dde9af410cc4f737a136d87d3d4a4deeff1d26fc" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" submitMustFail owner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = owner ccipOwner = owner instanceId = "test-lock-release-invalid-dest-bytes-overhead" @@ -4600,14 +4634,14 @@ testPoolTokenTransferFeeConfigRejectsSmallDestBytesOverhead = script do decimals = 10 rateLimitAdmin = None remoteChainConfigs = Map.fromList [(123.0, existingConfig)] - tokenTransferFeeConfigs = Map.fromList [(123.0, LockReleaseTokenPool.TokenTransferFeeConfig with + tokenTransferFeeConfigs = Map.fromList [(123.0, CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfig with isEnabled = True feeUSDCents = cents 0.0 feeBps = 0.0 destGasOverhead = 0 destBytesOverhead = 31)] - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps "test-tar-invalid-dest-bytes-overhead" "test-rmn-invalid-dest-bytes-overhead" "test-fq-invalid-dest-bytes-overhead" owner owner pure () @@ -4620,39 +4654,39 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do -- | Create LockReleaseTokenPool with existing remote chain config but no token transfer fee config tokenPoolCid <- submit owner do - createCmd LockReleaseTokenPool.LockReleaseTokenPool with + createCmd CCIP.LockReleaseTokenPoolV1.LockReleaseTokenPool with poolOwner = owner ccipOwner = ccipOwner instanceId = "test-lock-release-pool" - instrumentId = HoldingV1.InstrumentId with + instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "LINK" decimals = 8 rateLimitAdmin = None remoteChainConfigs = Map.fromList [ - (123.0, LockReleaseTokenPool.RemoteChainConfig with + (123.0, CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = [] remoteTokenAddress = "f43dc4783082e7f5ceb0f5e3bdff4a9acc3b0ace" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner") - ,(456.0, LockReleaseTokenPool.RemoteChainConfig with + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner") + ,(456.0, CCIP.LockReleaseTokenPoolV1.RemoteChainConfig with remotePools = ["11111111"] remoteTokenAddress = "cf383e3c65a8f8ec69b3a4fbdf0ceed7de4cd6a2cdf1ff6f82fa2eb3addf7b2e960f" inboundCCVs = [] outboundCCVs = [] finalityConfig = finalityConfig 0 - inboundRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl@owner" - inboundCustomBlockConfirmationsRateLimiter = RawInstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" - outboundRateLimiter = RawInstanceAddress.RawInstanceAddress "outbound-rl@owner" + inboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl@owner" + inboundCustomBlockConfirmationsRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "inbound-rl-custom@owner" + outboundRateLimiter = Chainlink.InstanceAddress.RawInstanceAddress "outbound-rl@owner" ) ] tokenTransferFeeConfigs = Map.empty - poolReceiveContext = MetadataV1.emptyChoiceContext - transferTimeout = LockReleaseTokenPool.Indefinite + poolReceiveContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + transferTimeout = CCIP.LockReleaseTokenPoolV1.Indefinite deps = mkPoolDeps "test-tar" "test-rmn" "test-feequoter-pool" ccipOwner ccipOwner -- | ========= Test 1 ======== @@ -4660,14 +4694,14 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do -- | ======================== let tokenTransferFeeConfigArgs1 = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 123.0 isEnabled = True feeUSDCents = cents 1.0 feeBps = 50.0 destGasOverhead = 21000 destBytesOverhead = 32 - ,LockReleaseTokenPool.TokenTransferFeeConfigArgs with + ,CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 456.0 isEnabled = True feeUSDCents = cents 2.0 @@ -4676,7 +4710,7 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do destBytesOverhead = 64 ] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = tokenTransferFeeConfigArgs1 -- immediately disable the config for 123.0 to test that both enable and disable can be done in the same update -- delete the config for 789.0 which does not exist to test that deleting a non-existent config is a no-op @@ -4693,7 +4727,7 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do -- | Update an existing token transfer fee config -- | ======================== let tokenTransferFeeConfigArgs2 = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 456.0 isEnabled = True feeUSDCents = cents 3.0 -- updated fee @@ -4702,7 +4736,7 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do destBytesOverhead = 96 -- updated bytes overhead ] tokenPoolCid <- submit owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = tokenTransferFeeConfigArgs2 disableTokenTransferFeeConfigArgs = [] -- Fetch the updated TokenPool and verify the token transfer fee config was updated correctly @@ -4717,9 +4751,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do -- | ======================== -- Attempt to add a token transfer fee config for a non-existent remote chain selector submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 999.0 -- does not exist isEnabled = True feeUSDCents = cents 1.0 @@ -4730,9 +4764,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid chain selector (negative) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = -1.0 -- invalid isEnabled = True feeUSDCents = cents 1.0 @@ -4743,9 +4777,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid chain selector (zero) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 0.0 -- invalid isEnabled = True feeUSDCents = cents 1.0 @@ -4756,9 +4790,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid feeBps (negative) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 123.0 isEnabled = True feeUSDCents = cents 1.0 @@ -4769,9 +4803,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid feeBps (at max bps denominator) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 123.0 isEnabled = True feeUSDCents = cents 1.0 @@ -4782,9 +4816,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid feeUSDCents (negative) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 456.0 isEnabled = True feeUSDCents = -1.0 @@ -4795,9 +4829,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid feeBps (too high) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 123.0 isEnabled = True feeUSDCents = cents 1.0 @@ -4808,9 +4842,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid destBytesOverhead (too low) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 123.0 isEnabled = True feeUSDCents = cents 1.0 @@ -4821,9 +4855,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid destBytesOverhead (negative) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 123.0 isEnabled = True feeUSDCents = cents 1.0 @@ -4834,9 +4868,9 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do disableTokenTransferFeeConfigArgs = [] -- Test invalid isEnabled (cannot add a config with isEnabled = False, should use disableTokenTransferFeeConfigArgs instead) submitMustFail owner do - exerciseCmd tokenPoolCid LockReleaseTokenPool.ApplyTokenTransferFeeConfigUpdates with + exerciseCmd tokenPoolCid CCIP.LockReleaseTokenPoolV1.ApplyTokenTransferFeeConfigUpdates with tokenTransferFeeConfigArgs = [ - LockReleaseTokenPool.TokenTransferFeeConfigArgs with + CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs with destChainSelector = 123.0 isEnabled = False -- invalid, cannot add a config with isEnabled = False feeUSDCents = cents 1.0 @@ -4850,7 +4884,7 @@ testLockReleaseTokenPool_ApplyTokenTransferFeeConfigUpdates = script do -- Assertion helpers -assertChainUpdateEqual : LockReleaseTokenPool.RemoteChainConfig -> LockReleaseTokenPool.ChainUpdate -> Script () +assertChainUpdateEqual : CCIP.LockReleaseTokenPoolV1.RemoteChainConfig -> CCIP.LockReleaseTokenPoolV1.ChainUpdate -> Script () assertChainUpdateEqual got expected = do assertMsg ("remotePools mismatch, got: " <> show got.remotePools <> ", expected: " <> show expected.remotePools) (got.remotePools == expected.remotePools) assertMsg ("remoteTokenAddress mismatch, got: " <> show got.remoteTokenAddress <> ", expected: " <> show expected.remoteTokenAddress) (got.remoteTokenAddress == expected.remoteTokenAddress) @@ -4861,7 +4895,7 @@ assertChainUpdateEqual got expected = do assertMsg ("inboundCustomBlockConfirmationsRateLimiter mismatch, got: " <> show got.inboundCustomBlockConfirmationsRateLimiter <> ", expected: " <> show expected.inboundCustomBlockConfirmationsRateLimiter) (got.inboundCustomBlockConfirmationsRateLimiter == expected.inboundCustomBlockConfirmationsRateLimiter) assertMsg ("outboundRateLimiter mismatch, got: " <> show got.outboundRateLimiter <> ", expected: " <> show expected.outboundRateLimiter) (got.outboundRateLimiter == expected.outboundRateLimiter) -assertTokenTransferFeeConfigEqual : LockReleaseTokenPool.TokenTransferFeeConfig -> LockReleaseTokenPool.TokenTransferFeeConfigArgs -> Script () +assertTokenTransferFeeConfigEqual : CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfig -> CCIP.LockReleaseTokenPoolV1.TokenTransferFeeConfigArgs -> Script () assertTokenTransferFeeConfigEqual got expected = do assertMsg ("isEnabled mismatch, got: " <> show got.isEnabled <> ", expected: " <> show expected.isEnabled) (got.isEnabled == expected.isEnabled) assertMsg ("destGasOverhead mismatch, got: " <> show got.destGasOverhead <> ", expected: " <> show expected.destGasOverhead) (got.destGasOverhead == expected.destGasOverhead) @@ -4869,7 +4903,7 @@ assertTokenTransferFeeConfigEqual got expected = do assertMsg ("feeUSDCents mismatch, got: " <> show got.feeUSDCents <> ", expected: " <> show expected.feeUSDCents) (got.feeUSDCents == expected.feeUSDCents) assertMsg ("feeBps mismatch, got: " <> show got.feeBps <> ", expected: " <> show expected.feeBps) (got.feeBps == expected.feeBps) -assertRateLimitConfigArgsEqual : LockReleaseTokenPool.RemoteChainConfig -> LockReleaseTokenPool.RateLimitConfigArgs -> Script () +assertRateLimitConfigArgsEqual : CCIP.LockReleaseTokenPoolV1.RemoteChainConfig -> CCIP.LockReleaseTokenPoolV1.RateLimitConfigArgs -> Script () assertRateLimitConfigArgsEqual got expected = do assertMsg ("inboundRateLimiter mismatch, got: " <> show got.inboundRateLimiter <> ", expected: " <> show expected.inboundRateLimiter) (got.inboundRateLimiter == expected.inboundRateLimiter) assertMsg ("inboundCustomBlockConfirmationsRateLimiter mismatch, got: " <> show got.inboundCustomBlockConfirmationsRateLimiter <> ", expected: " <> show expected.inboundCustomBlockConfirmationsRateLimiter) (got.inboundCustomBlockConfirmationsRateLimiter == expected.inboundCustomBlockConfirmationsRateLimiter) diff --git a/contracts/ccip/test/daml/NumericHexTest.daml b/contracts/ccip/test/daml/NumericHexTest.daml index e19af2829..9f6f72222 100644 --- a/contracts/ccip/test/daml/NumericHexTest.daml +++ b/contracts/ccip/test/daml/NumericHexTest.daml @@ -7,7 +7,7 @@ import DA.Crypto.Text (byteCount) import DA.Optional import DA.Text qualified as Text -import CCIP.NumericHex qualified as NumericHex +import CCIP.CodecV1.NumericHex maxNumeric0Text : Text maxNumeric0Text = "99999999999999999999999999999999999999" @@ -28,72 +28,72 @@ normalizeDecimalTextOrZero raw = assertDecimalHexRoundTrip : Text -> Script () assertDecimalHexRoundTrip decimalText = - NumericHex.hexStringToDecimalString (NumericHex.decimalStringToHex decimalText) + CCIP.CodecV1.NumericHex.hexStringToDecimalString (CCIP.CodecV1.NumericHex.decimalStringToHex decimalText) === Some (normalizeDecimalTextOrZero decimalText) testNumericHex_Numeric0ToDecimalStringAndPadLeft : Script () testNumericHex_Numeric0ToDecimalStringAndPadLeft = script do - NumericHex.numeric0ToDecimalString 0.0 === "0" - NumericHex.numeric0ToDecimalString 42.0 === "42" - NumericHex.numeric0ToDecimalString 18446744073709551615.0 === "18446744073709551615" - NumericHex.numeric0ToDecimalString 99999999999999999999999999999999999999.0 === maxNumeric0Text + CCIP.CodecV1.NumericHex.numeric0ToDecimalString 0.0 === "0" + CCIP.CodecV1.NumericHex.numeric0ToDecimalString 42.0 === "42" + CCIP.CodecV1.NumericHex.numeric0ToDecimalString 18446744073709551615.0 === "18446744073709551615" + CCIP.CodecV1.NumericHex.numeric0ToDecimalString 99999999999999999999999999999999999999.0 === maxNumeric0Text - NumericHex.padLeft 4 "0" "a" === "000a" - NumericHex.padLeft 4 "0" "abcd" === "abcd" - NumericHex.padLeft 2 "0" "abcd" === "abcd" - NumericHex.padLeft 64 "0" maxUint256Hex === maxUint256Hex + CCIP.CodecV1.NumericHex.padLeft 4 "0" "a" === "000a" + CCIP.CodecV1.NumericHex.padLeft 4 "0" "abcd" === "abcd" + CCIP.CodecV1.NumericHex.padLeft 2 "0" "abcd" === "abcd" + CCIP.CodecV1.NumericHex.padLeft 64 "0" maxUint256Hex === maxUint256Hex debug "testNumericHex_Numeric0ToDecimalStringAndPadLeft: PASSED" testNumericHex_CompareDecimalStrings : Script () testNumericHex_CompareDecimalStrings = script do - NumericHex.compareDecimalStrings "0" "0" === False - NumericHex.compareDecimalStrings "000" "0" === False - NumericHex.compareDecimalStrings "1" "0" === True - NumericHex.compareDecimalStrings "2" "10" === False - NumericHex.compareDecimalStrings "10" "2" === True - NumericHex.compareDecimalStrings "0010" "10" === False - NumericHex.compareDecimalStrings "0001" "0000" === True - NumericHex.compareDecimalStrings "12345678901234567890" "12345678901234567889" === True - NumericHex.compareDecimalStrings maxNumeric0Text maxUint256Text === False - NumericHex.compareDecimalStrings maxUint256Text maxNumeric0Text === True + CCIP.CodecV1.NumericHex.compareDecimalStrings "0" "0" === False + CCIP.CodecV1.NumericHex.compareDecimalStrings "000" "0" === False + CCIP.CodecV1.NumericHex.compareDecimalStrings "1" "0" === True + CCIP.CodecV1.NumericHex.compareDecimalStrings "2" "10" === False + CCIP.CodecV1.NumericHex.compareDecimalStrings "10" "2" === True + CCIP.CodecV1.NumericHex.compareDecimalStrings "0010" "10" === False + CCIP.CodecV1.NumericHex.compareDecimalStrings "0001" "0000" === True + CCIP.CodecV1.NumericHex.compareDecimalStrings "12345678901234567890" "12345678901234567889" === True + CCIP.CodecV1.NumericHex.compareDecimalStrings maxNumeric0Text maxUint256Text === False + CCIP.CodecV1.NumericHex.compareDecimalStrings maxUint256Text maxNumeric0Text === True debug "testNumericHex_CompareDecimalStrings: PASSED" testNumericHex_DecimalStringToHex_Vectors : Script () testNumericHex_DecimalStringToHex_Vectors = script do - NumericHex.decimalStringToHex "0" === "0" - NumericHex.decimalStringToHex "000000" === "0" - NumericHex.decimalStringToHex "1" === "1" - NumericHex.decimalStringToHex "15" === "f" - NumericHex.decimalStringToHex "16" === "10" - NumericHex.decimalStringToHex "255" === "ff" - NumericHex.decimalStringToHex "256" === "100" - NumericHex.decimalStringToHex "1000000000000000000" === "de0b6b3a7640000" - NumericHex.decimalStringToHex "12379813738877118345" === "abcdef0123456789" - NumericHex.decimalStringToHex maxNumeric0Text === maxNumeric0Hex - NumericHex.decimalStringToHex maxUint256Text === maxUint256Hex + CCIP.CodecV1.NumericHex.decimalStringToHex "0" === "0" + CCIP.CodecV1.NumericHex.decimalStringToHex "000000" === "0" + CCIP.CodecV1.NumericHex.decimalStringToHex "1" === "1" + CCIP.CodecV1.NumericHex.decimalStringToHex "15" === "f" + CCIP.CodecV1.NumericHex.decimalStringToHex "16" === "10" + CCIP.CodecV1.NumericHex.decimalStringToHex "255" === "ff" + CCIP.CodecV1.NumericHex.decimalStringToHex "256" === "100" + CCIP.CodecV1.NumericHex.decimalStringToHex "1000000000000000000" === "de0b6b3a7640000" + CCIP.CodecV1.NumericHex.decimalStringToHex "12379813738877118345" === "abcdef0123456789" + CCIP.CodecV1.NumericHex.decimalStringToHex maxNumeric0Text === maxNumeric0Hex + CCIP.CodecV1.NumericHex.decimalStringToHex maxUint256Text === maxUint256Hex debug "testNumericHex_DecimalStringToHex_Vectors: PASSED" testNumericHex_HexStringToDecimalString_Vectors : Script () testNumericHex_HexStringToDecimalString_Vectors = script do - NumericHex.hexStringToDecimalString "0" === Some "0" - NumericHex.hexStringToDecimalString "0000" === Some "0" - NumericHex.hexStringToDecimalString "0000ff" === Some "255" - NumericHex.hexStringToDecimalString "1" === Some "1" - NumericHex.hexStringToDecimalString "f" === Some "15" - NumericHex.hexStringToDecimalString "10" === Some "16" - NumericHex.hexStringToDecimalString "ff" === Some "255" - NumericHex.hexStringToDecimalString "100" === Some "256" - NumericHex.hexStringToDecimalString "DE0B6B3A7640000" === Some "1000000000000000000" - NumericHex.hexStringToDecimalString "DEADBEEF" === Some "3735928559" - NumericHex.hexStringToDecimalString "abcdef0123456789" === Some "12379813738877118345" - NumericHex.hexStringToDecimalString "000000000000000000000000000000004b3b4ca85a86c47a098a223fffffffff" === Some maxNumeric0Text - NumericHex.hexStringToDecimalString maxNumeric0Hex === Some maxNumeric0Text - NumericHex.hexStringToDecimalString maxUint256Hex === Some maxUint256Text - NumericHex.hexStringToDecimalString "0x10" === None - NumericHex.hexStringToDecimalString "xyz" === None + CCIP.CodecV1.NumericHex.hexStringToDecimalString "0" === Some "0" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "0000" === Some "0" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "0000ff" === Some "255" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "1" === Some "1" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "f" === Some "15" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "10" === Some "16" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "ff" === Some "255" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "100" === Some "256" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "DE0B6B3A7640000" === Some "1000000000000000000" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "DEADBEEF" === Some "3735928559" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "abcdef0123456789" === Some "12379813738877118345" + CCIP.CodecV1.NumericHex.hexStringToDecimalString "000000000000000000000000000000004b3b4ca85a86c47a098a223fffffffff" === Some maxNumeric0Text + CCIP.CodecV1.NumericHex.hexStringToDecimalString maxNumeric0Hex === Some maxNumeric0Text + CCIP.CodecV1.NumericHex.hexStringToDecimalString maxUint256Hex === Some maxUint256Text + CCIP.CodecV1.NumericHex.hexStringToDecimalString "0x10" === None + CCIP.CodecV1.NumericHex.hexStringToDecimalString "xyz" === None debug "testNumericHex_HexStringToDecimalString_Vectors: PASSED" @@ -111,41 +111,41 @@ testNumericHex_DecimalHex_RoundTrip = script do testNumericHex_EncodeUint64 : Script () testNumericHex_EncodeUint64 = script do - NumericHex.encodeUint64 0.0 === Some "0000000000000000" - NumericHex.encodeUint64 1.0 === Some "0000000000000001" - NumericHex.encodeUint64 255.0 === Some "00000000000000ff" - NumericHex.encodeUint64 18446744073709551615.0 === Some "ffffffffffffffff" - NumericHex.encodeUint64 18446744073709551616.0 === None - NumericHex.encodeUint64 (-1.0) === None + CCIP.CodecV1.NumericHex.encodeUint64 0.0 === Some "0000000000000000" + CCIP.CodecV1.NumericHex.encodeUint64 1.0 === Some "0000000000000001" + CCIP.CodecV1.NumericHex.encodeUint64 255.0 === Some "00000000000000ff" + CCIP.CodecV1.NumericHex.encodeUint64 18446744073709551615.0 === Some "ffffffffffffffff" + CCIP.CodecV1.NumericHex.encodeUint64 18446744073709551616.0 === None + CCIP.CodecV1.NumericHex.encodeUint64 (-1.0) === None assertMsg "uint64 encodings must be 8 bytes" (all (\hex -> byteCount hex == 8) - [ fromSome (NumericHex.encodeUint64 0.0) - , fromSome (NumericHex.encodeUint64 1.0) - , fromSome (NumericHex.encodeUint64 18446744073709551615.0) + [ fromSome (CCIP.CodecV1.NumericHex.encodeUint64 0.0) + , fromSome (CCIP.CodecV1.NumericHex.encodeUint64 1.0) + , fromSome (CCIP.CodecV1.NumericHex.encodeUint64 18446744073709551615.0) ]) debug "testNumericHex_EncodeUint64: PASSED" testNumericHex_EncodeUint256 : Script () testNumericHex_EncodeUint256 = script do - NumericHex.encodeUint256 0.0 + CCIP.CodecV1.NumericHex.encodeUint256 0.0 === Some "0000000000000000000000000000000000000000000000000000000000000000" - NumericHex.encodeUint256 1.0 + CCIP.CodecV1.NumericHex.encodeUint256 1.0 === Some "0000000000000000000000000000000000000000000000000000000000000001" - NumericHex.encodeUint256 1000000.0 + CCIP.CodecV1.NumericHex.encodeUint256 1000000.0 === Some "00000000000000000000000000000000000000000000000000000000000f4240" - NumericHex.encodeUint256 1000000000000000000.0 + CCIP.CodecV1.NumericHex.encodeUint256 1000000000000000000.0 === Some "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - NumericHex.encodeUint256 99999999999999999999999999999999999999.0 + CCIP.CodecV1.NumericHex.encodeUint256 99999999999999999999999999999999999999.0 === Some "000000000000000000000000000000004b3b4ca85a86c47a098a223fffffffff" - NumericHex.encodeUint256 (-1.0) === None + CCIP.CodecV1.NumericHex.encodeUint256 (-1.0) === None assertMsg "uint256 encodings must be 32 bytes" (all (\hex -> byteCount hex == 32) - [ fromSome (NumericHex.encodeUint256 0.0) - , fromSome (NumericHex.encodeUint256 1.0) - , fromSome (NumericHex.encodeUint256 99999999999999999999999999999999999999.0) + [ fromSome (CCIP.CodecV1.NumericHex.encodeUint256 0.0) + , fromSome (CCIP.CodecV1.NumericHex.encodeUint256 1.0) + , fromSome (CCIP.CodecV1.NumericHex.encodeUint256 99999999999999999999999999999999999999.0) ]) debug "testNumericHex_EncodeUint256: PASSED" diff --git a/contracts/ccip/test/daml/OffRampExecute.daml b/contracts/ccip/test/daml/OffRampExecute.daml index baee4e33c..7f31564a4 100644 --- a/contracts/ccip/test/daml/OffRampExecute.daml +++ b/contracts/ccip/test/daml/OffRampExecute.daml @@ -10,42 +10,46 @@ import DA.Optional import DA.Set qualified as Set import qualified DA.TextMap as TextMap -import Splice.Api.Token.HoldingV1 qualified as HoldingV1 -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 - -import qualified CCIP.Context -import CCIP.ExecutingMessageV1 qualified as ExecutingMessageV1 -import CCIP.CommitteeVerifier qualified as CommitteeVerifier -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.GlobalConfig qualified as GlobalConfig -import CCIP.Internal qualified as Internal -import CCIP.Interfaces.CrossChainVerifier qualified as CrossChainVerifier -import CCIP.MessageCodecV1 qualified as MessageCodecV1 -import CCIP.OffRamp qualified as OffRamp -import CCIP.OffRampTypes qualified as OffRamp -import CCIP.PerPartyRouter qualified as PerPartyRouter -import CCIP.PerPartyRouterTypes qualified as PerPartyRouter -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import CCIP.RMNRemote qualified as RMNRemote -import CCIP.TokenAdminRegistry qualified as TokenAdminRegistry -import CCIP.TokenAdminRegistryTypes qualified as TokenAdminRegistryTypes +import Splice.Api.Token.HoldingV1 +import Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.GlobalConfig +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.CodecV1.CCVCodec + +import qualified CCIP.CoreV1.ExecutingMessage +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.GlobalConfig + +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 + +import qualified CCIP.RuntimeV1.PerPartyRouter +import qualified CCIP.RuntimeV1.OffRamp + +import qualified CCIP.CommitteeVerifierV1 finalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n rawFinalityConfig n = if n == 0 - then FinalityCodec.waitForFinalityFlag + then CCIP.CodecV1.FinalityConfig.waitForFinalityFlag else fromSome do - flagsHex <- MessageCodecV1.encodeUint16 0 - blockConfirmationsHex <- MessageCodecV1.encodeUint16 n + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 n pure (flagsHex <> blockConfirmationsHex) unsafeDecodeRequestedFinality finalityConfig = fromSomeNote "unsafeDecodeRequestedFinality: invalid finality config" - (FinalityCodec.decodeRequestedFinality finalityConfig) + (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalityConfig) messageFinality n = unsafeDecodeRequestedFinality (rawFinalityConfig n) @@ -53,47 +57,50 @@ setupTokenAdminRegistryWithPool : Party -> Party -> Text - -> HoldingV1.InstrumentId + -> Splice.Api.Token.HoldingV1.InstrumentId -> Text - -> Script (ContractId TokenAdminRegistry.TokenAdminRegistry, ContractId TokenAdminRegistry.TokenConfig) + -> Script (ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry, ContractId CCIP.CoreV1.TokenAdminRegistry.TokenConfig) setupTokenAdminRegistryWithPool ccipOwner poolOwner tokenAdminRegistryInstanceId instrumentId tokenPoolInstanceId = do tokenAdminRegistry0 <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 proposeResult <- submit ccipOwner do - exerciseCmd tokenAdminRegistry0 TokenAdminRegistry.ProposeAdministrator with + exerciseCmd tokenAdminRegistry0 CCIP.CoreV1.TokenAdminRegistry.ProposeAdministrator with tokenConfigCid = None instrumentId = instrumentId newAdmin = poolOwner + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccipOwner let tokenAdminRegistry = proposeResult.tokenAdminRegistryCid tokenConfigCid0 = proposeResult.tokenConfigCid disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry tokenConfigCid1 <- submit (actAs poolOwner <> disclose disclosedTar) do - exerciseCmd tokenAdminRegistry TokenAdminRegistry.AcceptAdminRole with + exerciseCmd tokenAdminRegistry CCIP.CoreV1.TokenAdminRegistry.AcceptAdminRole with tokenConfigCid = tokenConfigCid0 instrumentId = instrumentId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry tokenConfigCid2 <- submit (actAs poolOwner <> disclose disclosedTar) do - exerciseCmd tokenAdminRegistry TokenAdminRegistry.SetPool with + exerciseCmd tokenAdminRegistry CCIP.CoreV1.TokenAdminRegistry.SetPool with tokenConfigCid = tokenConfigCid1 instrumentId = instrumentId - tokenPool = Some TokenAdminRegistryTypes.PoolRegistration with + tokenPool = Some CCIP.CoreV1.TokenAdminRegistry.PoolRegistration with poolOwner = poolOwner poolInstanceId = tokenPoolInstanceId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = poolOwner pure (tokenAdminRegistry, tokenConfigCid2) -- | Test execute with CCV verification via collecting contract pattern. -- --- This test exercises AddCCVVerification directly on ExecutingMessageV1 rather +-- This test exercises AddCCVVerification directly on ExecutingMessage rather -- than through CommitteeVerifier with actual ECDSA signature verification. -- Daml Script allocates parties with random suffixes, and since the message -- receiver field must contain the party address hash, we cannot pre-compute @@ -114,23 +121,23 @@ testExecuteWithCCVVerification = script do let tokenAdminRegistryInstanceId = "test-tar" -- Compute instance addresses - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner -- Build CCV raw instance address - let ccvVersionTag = CommitteeVerifier.versionTagV2_0_0 + let ccvVersionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 let ccvInstanceId = "test-ccv-committee" - let ccvRawAddress = RawInstanceAddress.make ccvInstanceId receiver + let ccvRawAddress = Chainlink.InstanceAddress.make ccvInstanceId receiver -- Deploy GlobalConfig with lane-mandated CCV requirement globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [ccvRawAddress] @@ -138,7 +145,7 @@ testExecuteWithCCVVerification = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -147,44 +154,44 @@ testExecuteWithCCVVerification = script do -- Deploy TokenAdminRegistry tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 -- Deploy OffRamp offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "test-offramp" ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress -- Deploy PerPartyRouterFactory and create router for receiver factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make "test-offramp" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make "test-offramp" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-receiver" let router = createResult.router -- Build test message with correct receiver (using party address hash) - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -193,13 +200,13 @@ testExecuteWithCCVVerification = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "test-offramp" ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "test-offramp" ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message let messageHash = keccak256 encodedMessage debug ("Message hash: " <> messageHash) @@ -210,14 +217,14 @@ testExecuteWithCCVVerification = script do disclosedTokenAdminRegistry <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote - -- PrepareExecute to create ExecutingMessageV1 + -- PrepareExecute to create ExecutingMessage executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -227,28 +234,29 @@ testExecuteWithCCVVerification = script do receiverFinalityConfig = finalityConfig 2000 caller = receiver - -- Exercise AddCCVVerification directly on ExecutingMessageV1 + -- Exercise AddCCVVerification directly on ExecutingMessage -- (In production, CommitteeVerifier does this after signature verification) executingMessageCid <- submit receiver do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = receiver - debug ("CCV verification added to ExecutingMessageV1") + debug ("CCV verification added to ExecutingMessage") -- Execute via PerPartyRouter executeResult <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Verify SUCCESS - executeResult.state === Internal.SUCCESS + executeResult.state === CCIP.APIV1.ExecutingMessage.SUCCESS debug ("Execute with CCV verification: SUCCESS") debug ("Message ID: " <> show executeResult.messageId) @@ -270,26 +278,26 @@ testExecuteTokenOnlyIgnoresReceiverCCVs = script do let tokenAdminRegistryInstanceId = "test-tar-token-only" let offRampInstanceId = "test-offramp-token-only" let defaultCCVInstanceId = "test-default-ccv-token-only" - let feeToken = HoldingV1.InstrumentId with + let feeToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TEST" - let defaultCCV = RawInstanceAddress.make defaultCCVInstanceId defaultCCVOwner - let receiverCCV = RawInstanceAddress.make "receiver-ccv-token-only" receiverCCVOwner + let defaultCCV = Chainlink.InstanceAddress.make defaultCCVInstanceId defaultCCVOwner + let receiverCCV = Chainlink.InstanceAddress.make "receiver-ccv-token-only" receiverCCVOwner globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [] defaultCCVs = [defaultCCV])] rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -303,38 +311,38 @@ testExecuteTokenOnlyIgnoresReceiverCCVs = script do feeToken "test-pool-token-only" - let offRampAddr = RawInstanceAddress.make offRampInstanceId ccipOwner - let globalConfigAddr = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteAddr = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryAddr = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampAddr = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner + let globalConfigAddr = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteAddr = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryAddr = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigAddr rmnRemote = rmnRemoteAddr tokenAdminRegistry = tokenAdminRegistryAddr router <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = "test-router-token-only" ccipOwner = ccipOwner partyOwner = receiver - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp-token-only" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp-token-only" ccipOwner offRamp = offRampAddr globalConfig = globalConfigAddr tokenAdminRegistry = tokenAdminRegistryAddr - feeQuoter = RawInstanceAddress.make "unused-feequoter-token-only" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter-token-only" ccipOwner rmnRemote = rmnRemoteAddr outboundSequenceNumbers = Map.empty executedMessages = Set.empty archivedExecutionContractIds = [] customObservers = [] - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -343,22 +351,22 @@ testExecuteTokenOnlyIgnoresReceiverCCVs = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress offRampAddr + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress offRampAddr sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some (MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 1000000.0) + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1000000.0) sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000005" sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" - destTokenAddress = MessageCodecV1.encodeInstrumentId feeToken - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + destTokenAddress = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId feeToken + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "") messageData = "" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message executingMessageCid <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = keccak256 encodedMessage @@ -373,22 +381,23 @@ testExecuteTokenOnlyIgnoresReceiverCCVs = script do optionalCCVThreshold = 0 receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [defaultCCV] - inboundPoolVerification = Some (ExecutingMessageV1.InboundPoolVerification with + inboundPoolVerification = Some (CCIP.CoreV1.ExecutingMessage.InboundPoolVerification with poolInstanceId = "test-pool-token-only" poolOwner = poolOwner poolCCVs = []) - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampAddr globalConfig = globalConfigAddr rmnRemote = rmnRemoteAddr tokenAdminRegistry = tokenAdminRegistryAddr - state = ExecutingMessageV1.ExecutingMessageState_Prepared + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_Prepared -- Add CCV verification executingMessageCid <- submit (actAs defaultCCVOwner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = defaultCCVInstanceId versionTag = "" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = defaultCCVOwner disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp @@ -398,14 +407,14 @@ testExecuteTokenOnlyIgnoresReceiverCCVs = script do disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote result <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedTokenConfig <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (TokenAdminRegistry.tokenConfigKey, MetadataV1.AV_ContractId $ coerceContractId tokenConfigCid) - , (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.TokenAdminRegistry.tokenConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenConfigCid) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) ] executingMessageCid = executingMessageCid @@ -417,8 +426,8 @@ testExecuteTokenOnlyIgnoresReceiverCCVs = script do ticket.requiredInboundPoolCCVs === [defaultCCV] debug "testExecuteTokenOnlyIgnoresReceiverCCVs: PASSED" --- Direct TokenAdminRegistry.FinalizeExecute must not be callable by arbitrary users. --- Without this guard, a receiver could bypass OffRamp.ExecuteFromRouter quorum checks. +-- Direct CCIP.CoreV1.TokenAdminRegistry.FinalizeExecute must not be callable by arbitrary users. +-- Without this guard, a receiver could bypass CCIP.RuntimeV1.OffRamp.ExecuteFromRouter quorum checks. testTokenAdminRegistryFinalizeExecuteRequiresOwner : Script () testTokenAdminRegistryFinalizeExecuteRequiresOwner = script do ccipOwner <- allocateParty "ccip-owner-finalize-auth" @@ -434,25 +443,25 @@ testTokenAdminRegistryFinalizeExecuteRequiresOwner = script do let tokenAdminRegistryInstanceId = "test-tar-finalize-auth" let offRampInstanceId = "test-offramp-finalize-auth" let defaultCCVInstanceId = "test-default-ccv-finalize-auth" - let feeToken = HoldingV1.InstrumentId with + let feeToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "TEST" - let defaultCCV = RawInstanceAddress.make defaultCCVInstanceId defaultCCVOwner + let defaultCCV = Chainlink.InstanceAddress.make defaultCCVInstanceId defaultCCVOwner _globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [] defaultCCVs = [defaultCCV])] _rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -466,12 +475,12 @@ testTokenAdminRegistryFinalizeExecuteRequiresOwner = script do feeToken "test-pool-finalize-auth" - let offRampAddr = RawInstanceAddress.make offRampInstanceId ccipOwner - let globalConfigAddr = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteAddr = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryAddr = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampAddr = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner + let globalConfigAddr = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteAddr = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryAddr = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -480,22 +489,22 @@ testTokenAdminRegistryFinalizeExecuteRequiresOwner = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress offRampAddr + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress offRampAddr sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some (MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 1000000.0) + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1000000.0) sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000005" sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" - destTokenAddress = MessageCodecV1.encodeInstrumentId feeToken - tokenReceiver = MessageCodecV1.encodePartyAddress receiver + destTokenAddress = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId feeToken + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver extraData = "") messageData = "" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message executingMessageCid <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd ExecutingMessageV1.ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = keccak256 encodedMessage @@ -510,23 +519,23 @@ testTokenAdminRegistryFinalizeExecuteRequiresOwner = script do optionalCCVThreshold = 0 receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [defaultCCV] - inboundPoolVerification = Some (ExecutingMessageV1.InboundPoolVerification with + inboundPoolVerification = Some (CCIP.CoreV1.ExecutingMessage.InboundPoolVerification with poolInstanceId = "test-pool-finalize-auth" poolOwner = poolOwner poolCCVs = []) - deps = ExecutingMessageV1.ExecutingMessageDeps with + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with offRamp = offRampAddr globalConfig = globalConfigAddr rmnRemote = rmnRemoteAddr tokenAdminRegistry = tokenAdminRegistryAddr - state = ExecutingMessageV1.ExecutingMessageState_Prepared + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_Prepared disclosedTar <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry disclosedTokenConfig <- fromSome <$> queryDisclosure ccipOwner tokenConfigCid disclosedExecutingMessage <- fromSome <$> queryDisclosure ccipOwner executingMessageCid submitMustFail (actAs receiver <> disclose disclosedTar <> disclose disclosedTokenConfig <> disclose disclosedExecutingMessage) do - exerciseCmd tokenAdminRegistry TokenAdminRegistry.FinalizeExecute with + exerciseCmd tokenAdminRegistry CCIP.CoreV1.TokenAdminRegistry.FinalizeExecute with tokenConfigCid = tokenConfigCid executingMessageCid = executingMessageCid ticketReceiver = receiver @@ -552,25 +561,25 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do let tokenAdminRegistryInstanceId = "test-tar" -- Compute instance addresses - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner -- Build CCV raw instance addresses - let ccvVersionTag = CommitteeVerifier.versionTagV2_0_0 + let ccvVersionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 let ccvInstanceId = "test-ccv-committee" - let ccv1RawAddress = RawInstanceAddress.make ccvInstanceId ccv1Owner - let ccv2RawAddress = RawInstanceAddress.make ccvInstanceId ccv2Owner - let ccv3RawAddress = RawInstanceAddress.make ccvInstanceId ccv3Owner + let ccv1RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv1Owner + let ccv2RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv2Owner + let ccv3RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv3Owner -- Deploy GlobalConfig with default CCV requirement globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [] @@ -578,7 +587,7 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -587,44 +596,44 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do -- Deploy TokenAdminRegistry tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 -- Deploy OffRamp offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "test-offramp" ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress -- Deploy PerPartyRouterFactory and create router for receiver factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make "test-offramp" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make "test-offramp" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-receiver" let router = createResult.router -- Build test message with correct receiver (using party address hash) - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -633,13 +642,13 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "test-offramp" ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "test-offramp" ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message -- Disclose contracts to receiver disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp @@ -647,14 +656,14 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do disclosedTokenAdminRegistry <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote - -- PrepareExecute to create ExecutingMessageV1 + -- PrepareExecute to create ExecutingMessage executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -665,47 +674,49 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do caller = receiver -- Add CCV1 verification - -- Exercise AddCCVVerification directly on ExecutingMessageV1 + -- Exercise AddCCVVerification directly on ExecutingMessage -- (In production, CommitteeVerifier does this after signature verification) executingMessageCid <- submit (actAs ccv1Owner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccv1Owner - debug ("CCV1 verification added to ExecutingMessageV1") + debug ("CCV1 verification added to ExecutingMessage") -- Execute via PerPartyRouter - must fail due to missing CCV2 submitMustFail (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Add CCV2 verification - -- Exercise AddCCVVerification directly on ExecutingMessageV1 + -- Exercise AddCCVVerification directly on ExecutingMessage -- (In production, CommitteeVerifier does this after signature verification) executingMessageCid <- submit (actAs ccv2Owner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccv2Owner - debug ("CCV2 verification added to ExecutingMessageV1") + debug ("CCV2 verification added to ExecutingMessage") -- Execute again, now that CCV2 is added it should succeed executeResult <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Verify SUCCESS - executeResult.state === Internal.SUCCESS + executeResult.state === CCIP.APIV1.ExecutingMessage.SUCCESS debug ("Execute with CCV verification: SUCCESS") debug ("Message ID: " <> show executeResult.messageId) let router = executeResult.router @@ -730,25 +741,25 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do let tokenAdminRegistryInstanceId = "test-tar" -- Compute instance addresses - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner -- Build CCV raw instance addresses - let ccvVersionTag = CommitteeVerifier.versionTagV2_0_0 + let ccvVersionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 let ccvInstanceId = "test-ccv-committee" - let ccv1RawAddress = RawInstanceAddress.make ccvInstanceId ccv1Owner - let ccv2RawAddress = RawInstanceAddress.make ccvInstanceId ccv2Owner - let ccv3RawAddress = RawInstanceAddress.make ccvInstanceId ccv3Owner + let ccv1RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv1Owner + let ccv2RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv2Owner + let ccv3RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv3Owner -- Deploy GlobalConfig with default CCV requirement globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [] @@ -756,7 +767,7 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -765,44 +776,44 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do -- Deploy TokenAdminRegistry tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 -- Deploy OffRamp offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "test-offramp" ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress -- Deploy PerPartyRouterFactory and create router for receiver factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make "test-offramp" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make "test-offramp" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-receiver" let router = createResult.router -- Build test message with correct receiver (using party address hash) - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -811,13 +822,13 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "test-offramp" ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "test-offramp" ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message -- Disclose contracts to receiver disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp @@ -825,18 +836,18 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do disclosedTokenAdminRegistry <- fromSome <$> queryDisclosure ccipOwner tokenAdminRegistry disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote - -- PrepareExecute to create ExecutingMessageV1. + -- PrepareExecute to create CCIP.CoreV1.ExecutingMessage. executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None - receiverRequiredCCVs = [ccv1RawAddress, CrossChainVerifier.useDefaultCCVs, ccv3RawAddress] + receiverRequiredCCVs = [ccv1RawAddress, CCIP.CodecV1.CCVCodec.useDefaultCCVs, ccv3RawAddress] receiverOptionalCCVs = [] receiverOptionalThreshold = 0 receiverFinalityConfig = finalityConfig 2000 @@ -844,49 +855,52 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do -- Add CCV1 verification executingMessageCid <- submit (actAs ccv1Owner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccv1Owner - debug ("CCV1 verification added to ExecutingMessageV1") + debug ("CCV1 verification added to ExecutingMessage") -- Add CCV3 verification executingMessageCid <- submit (actAs ccv3Owner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage @CCIP.CoreV1.ExecutingMessage.ExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccv3Owner - debug ("CCV3 verification added to ExecutingMessageV1") + debug ("CCV3 verification added to ExecutingMessage") -- Execute via PerPartyRouter - must fail due to missing CCV2 which is part of the lane default CCVs submitMustFail (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Add CCV2 verification executingMessageCid <- submit (actAs ccv2Owner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccv2Owner - debug ("CCV2 verification added to ExecutingMessageV1") + debug ("CCV2 verification added to ExecutingMessage") -- Execute again, now that CCV2 is added it should succeed executeResult <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Verify SUCCESS - executeResult.state === Internal.SUCCESS + executeResult.state === CCIP.APIV1.ExecutingMessage.SUCCESS debug ("Execute with CCV verification: SUCCESS") debug ("Message ID: " <> show executeResult.messageId) let router = executeResult.router @@ -912,26 +926,26 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do let tokenAdminRegistryInstanceId = "test-tar" -- Compute instance addresses - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner -- Build CCV raw instance addresses - let ccvVersionTag = CommitteeVerifier.versionTagV2_0_0 + let ccvVersionTag = CCIP.CommitteeVerifierV1.versionTagV2_0_0 let ccvInstanceId = "test-ccv-committee" - let ccv1RawAddress = RawInstanceAddress.make ccvInstanceId ccv1Owner - let ccv2RawAddress = RawInstanceAddress.make ccvInstanceId ccv2Owner - let ccv3RawAddress = RawInstanceAddress.make ccvInstanceId ccv3Owner - let ccv4RawAddress = RawInstanceAddress.make ccvInstanceId ccv4Owner + let ccv1RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv1Owner + let ccv2RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv2Owner + let ccv3RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv3Owner + let ccv4RawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccv4Owner -- Deploy GlobalConfig with default CCV requirement globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [] @@ -939,7 +953,7 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -948,44 +962,44 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do -- Deploy TokenAdminRegistry tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 -- Deploy OffRamp offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "test-offramp" ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress -- Deploy PerPartyRouterFactory and create router for receiver factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make "test-offramp" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make "test-offramp" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-receiver" let router = createResult.router -- Build test message with correct receiver (using party address hash) - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -994,13 +1008,13 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "test-offramp" ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "test-offramp" ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message -- Disclose contracts to receiver disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp @@ -1010,12 +1024,12 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do -- PrepareExecute should fail if the optional threshold exceeds the optional CCV count. submitMustFail (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1025,14 +1039,14 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do receiverFinalityConfig = finalityConfig 2000 caller = receiver - -- PrepareExecute to create ExecutingMessageV1 with optional CCVs. + -- PrepareExecute to create ExecutingMessage with optional CCVs. executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1044,47 +1058,50 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do -- Add CCV1 verification executingMessageCid <- submit (actAs ccv1Owner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccv1Owner -- Add CCV2 verification executingMessageCid <- submit (actAs ccv2Owner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage @CCIP.CoreV1.ExecutingMessage.ExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccv2Owner -- Execute via PerPartyRouter - must fail due to optional threshold not being met submitMustFail (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Add CCV3 verification executingMessageCid <- submit (actAs ccv3Owner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = ccvVersionTag + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccv3Owner -- Execute again, now that optional threshold is met it should succeed executeResult <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Verify SUCCESS - executeResult.state === Internal.SUCCESS + executeResult.state === CCIP.APIV1.ExecutingMessage.SUCCESS debug ("Execute with CCV verification: SUCCESS") debug ("Message ID: " <> show executeResult.messageId) let router = executeResult.router @@ -1107,26 +1124,26 @@ testExecuteMessageOnlyRequiresReceiverCCVs = script do let rmnInstanceId = "test-rmn-m3" let tokenAdminRegistryInstanceId = "test-tar-m3" let offRampInstanceId = "test-offramp-m3" - let receiverCCV = RawInstanceAddress.make "receiver-ccv-m3" receiverCCVOwner + let receiverCCV = Chainlink.InstanceAddress.make "receiver-ccv-m3" receiverCCVOwner - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [] defaultCCVs = [])] rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1134,42 +1151,42 @@ testExecuteMessageOnlyRequiresReceiverCCVs = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory-m3" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp-m3" ccipOwner - offRamp = RawInstanceAddress.make offRampInstanceId ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp-m3" ccipOwner + offRamp = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter-m3" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter-m3" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-m3" let router = createResult.router -- Message-only (NOT token-only): has data, no token transfer. - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -1178,13 +1195,13 @@ testExecuteMessageOnlyRequiresReceiverCCVs = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make offRampInstanceId ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make offRampInstanceId ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp disclosedGlobalConfig <- fromSome <$> queryDisclosure ccipOwner globalConfig @@ -1192,12 +1209,12 @@ testExecuteMessageOnlyRequiresReceiverCCVs = script do disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1210,12 +1227,12 @@ testExecuteMessageOnlyRequiresReceiverCCVs = script do -- Execute with receiverRequiredCCVs set but NOT verified - should fail. -- Unlike the token-only case, message-only messages must satisfy receiver CCVs. submitMustFail (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid debug "testExecuteMessageOnlyRequiresReceiverCCVs: PASSED" @@ -1233,24 +1250,24 @@ testPrepareExecuteAllowsSafeFinalityConfig = script do let tokenAdminRegistryInstanceId = "test-tar-safe" let offRampInstanceId = "test-offramp-safe" - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [] defaultCCVs = [])] rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1258,57 +1275,57 @@ testPrepareExecuteAllowsSafeFinalityConfig = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory-safe" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp-safe" ccipOwner - offRamp = RawInstanceAddress.make offRampInstanceId ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp-safe" ccipOwner + offRamp = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter-safe" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter-safe" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-safe" let router = createResult.router - let safeFinality = FinalityCodec.WaitForSafe - let message = MessageCodecV1.MessageV1 with + let safeFinality = CCIP.CodecV1.FinalityConfig.WaitForSafe + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 100000 - finality = fromSomeNote "safe finality must decode" (FinalityCodec.decodeRequestedFinality "00010000") + finality = fromSomeNote "safe finality must decode" (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality "00010000") ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make offRampInstanceId ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make offRampInstanceId ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f2053616665" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp disclosedGlobalConfig <- fromSome <$> queryDisclosure ccipOwner globalConfig @@ -1316,12 +1333,12 @@ testPrepareExecuteAllowsSafeFinalityConfig = script do disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote _ <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1349,22 +1366,22 @@ testExecuteFailsMissingCCV = script do let tokenAdminRegistryInstanceId = "test-tar-missing" -- Compute instance addresses - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner -- Build CCV raw instance address let ccvInstanceId = "test-ccv-committee-missing" - let ccvRawAddress = RawInstanceAddress.make ccvInstanceId ccipOwner + let ccvRawAddress = Chainlink.InstanceAddress.make ccvInstanceId ccipOwner -- Deploy GlobalConfig with lane-mandated CCV requirement globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [ccvRawAddress] @@ -1372,7 +1389,7 @@ testExecuteFailsMissingCCV = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1381,44 +1398,44 @@ testExecuteFailsMissingCCV = script do -- Deploy TokenAdminRegistry tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 -- Deploy OffRamp offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "test-offramp-missing" ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress -- Deploy PerPartyRouterFactory and create router factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory-missing" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make "test-offramp-missing" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make "test-offramp-missing" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-missing" let router = createResult.router -- Build test message with correct receiver (using party address hash) - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -1427,13 +1444,13 @@ testExecuteFailsMissingCCV = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "test-offramp-missing" ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "test-offramp-missing" ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message -- Disclose contracts disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp @@ -1443,12 +1460,12 @@ testExecuteFailsMissingCCV = script do -- PrepareExecute executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1460,19 +1477,19 @@ testExecuteFailsMissingCCV = script do -- Execute WITHOUT adding any CCV verification - should fail submitMustFail (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid debug ("Execute fails with missing CCV: PASSED") pure () -- | Test that message for wrong receiver fails. --- Verifies receiver validation in OffRamp. +-- Verifies receiver validation in CCIP.RuntimeV1.OffRamp. testExecuteWrongReceiver : Script () testExecuteWrongReceiver = script do ccipOwner <- allocateParty "ccip-owner" @@ -1488,18 +1505,18 @@ testExecuteWrongReceiver = script do let tokenAdminRegistryInstanceId = "test-tar-wrongrecv" -- Compute instance addresses - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner -- Deploy GlobalConfig (no CCV requirements for simplicity) globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [] @@ -1507,7 +1524,7 @@ testExecuteWrongReceiver = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1516,44 +1533,44 @@ testExecuteWrongReceiver = script do -- Deploy TokenAdminRegistry tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 -- Deploy OffRamp offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "test-offramp-wrongrecv" ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress -- Deploy PerPartyRouterFactory and create router for receiver factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory-wrongrecv" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make "test-offramp-wrongrecv" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make "test-offramp-wrongrecv" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-wrongrecv" let router = createResult.router -- Build message for OTHER PARTY (not receiver) using party address hash - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -1562,13 +1579,13 @@ testExecuteWrongReceiver = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "test-offramp-wrongrecv" ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "test-offramp-wrongrecv" ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress otherParty -- Wrong receiver! + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress otherParty -- Wrong receiver! destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message -- Disclose contracts disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp @@ -1578,12 +1595,12 @@ testExecuteWrongReceiver = script do -- PrepareExecute should fail because receiver address doesn't match submitMustFail (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver -- Providing receiver, but message.receiver is otherParty tokenReceiverParty = None @@ -1614,25 +1631,25 @@ testExecuteAllowsMultipleOnRamps = script do let tokenAdminRegistryInstanceId = "test-tar-multionramp" let ccvInstanceId = "test-ccv-multionramp" - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let ccvInstanceAddress = RawInstanceAddress.make ccvInstanceId ccvOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let ccvInstanceAddress = Chainlink.InstanceAddress.make ccvInstanceId ccvOwner globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = [primaryOnRamp, rotatedOnRamp] laneMandatedCCVs = [] defaultCCVs = [ccvInstanceAddress])] rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1640,41 +1657,41 @@ testExecuteAllowsMultipleOnRamps = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "test-offramp-multionramp" ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory-multionramp" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make "test-offramp-multionramp" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make "test-offramp-multionramp" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-multionramp" let router = createResult.router - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -1683,13 +1700,13 @@ testExecuteAllowsMultipleOnRamps = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = rotatedOnRamp - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "test-offramp-multionramp" ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "test-offramp-multionramp" ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp disclosedGlobalConfig <- fromSome <$> queryDisclosure ccipOwner globalConfig @@ -1697,12 +1714,12 @@ testExecuteAllowsMultipleOnRamps = script do disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1714,21 +1731,22 @@ testExecuteAllowsMultipleOnRamps = script do -- Add CCV verification executingMessageCid <- submit (actAs ccvOwner <> actAs ccipOwner) do - exerciseCmd executingMessageCid ExecutingMessageV1.AddCCVVerification with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = "" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner executeResult <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.Execute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid - executeResult.state === Internal.SUCCESS + executeResult.state === CCIP.APIV1.ExecutingMessage.SUCCESS debug ("Execute succeeds with alternate configured onramp: PASSED") pure () @@ -1748,24 +1766,24 @@ testExecuteRejectsUnconfiguredOnRamp = script do let rmnInstanceId = "test-rmn-badonramp" let tokenAdminRegistryInstanceId = "test-tar-badonramp" - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner globalConfig <- submit ccipOwner do - createCmd GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = [allowedOnRamp] laneMandatedCCVs = [] defaultCCVs = [])] rmnRemote <- submit rmnOwner do - createCmd RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1773,41 +1791,41 @@ testExecuteRejectsUnconfiguredOnRamp = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 offRamp <- submit ccipOwner do - createCmd OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = "test-offramp-badonramp" ccipOwner = ccipOwner - deps = OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress factory <- submit ccipOwner do - createCmd PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory-badonramp" ccipOwner = ccipOwner - deps = PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make "test-offramp-badonramp" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make "test-offramp-badonramp" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-badonramp" let router = createResult.router - let message = MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -1816,13 +1834,13 @@ testExecuteRejectsUnconfiguredOnRamp = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = disallowedOnRamp - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make "test-offramp-badonramp" ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make "test-offramp-badonramp" ccipOwner) sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp disclosedGlobalConfig <- fromSome <$> queryDisclosure ccipOwner globalConfig @@ -1831,12 +1849,12 @@ testExecuteRejectsUnconfiguredOnRamp = script do -- PrepareExecute now rejects disallowed onramp early (before CCV work) submitMustFail (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router PerPartyRouter.PrepareExecute with - context = MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (OffRamp.offRampKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with + context = Splice.Api.Token.MetadataV1.ChoiceContext with + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None diff --git a/contracts/ccip/test/daml/PerPartyRouter.daml b/contracts/ccip/test/daml/PerPartyRouter.daml index 713ce161c..184443169 100644 --- a/contracts/ccip/test/daml/PerPartyRouter.daml +++ b/contracts/ccip/test/daml/PerPartyRouter.daml @@ -12,33 +12,34 @@ import DA.Set qualified as Set import qualified DA.Text as Text import qualified DA.TextMap as TextMap -import qualified CCIP.Client -import qualified CCIP.Context -import qualified CCIP.ExecutingMessageV1 -import qualified CCIP.FinalityConfig -import qualified CCIP.FeeQuoter -import qualified CCIP.GlobalConfig -import qualified CCIP.Internal -import qualified CCIP.MessageCodecV1 -import qualified CCIP.OnRamp -import qualified CCIP.OnRampTypes as CCIP.OnRamp -import qualified CCIP.OffRamp -import qualified CCIP.OffRampTypes as CCIP.OffRamp -import qualified CCIP.PerPartyRouter -import qualified CCIP.PerPartyRouterTypes as CCIP.PerPartyRouter -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 -import qualified CCIP.TokenAdminRegistry -import qualified CCIP.Interfaces.Executor -import qualified CCIP.Executor -import qualified CCIP.ExecutorTypes as CCIP.Executor -import qualified CommitteeVerifier.DummyCommitteeVerifier - import qualified Splice.Api.Token.HoldingV1 import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.APIV1.FeeQuoter +import qualified CCIP.APIV1.GlobalConfig +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.TokenAdminRegistry +import qualified CCIP.ClientV1 +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.FeeQuoter +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.SendingMessage +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.ExecutorV1 +import qualified CCIP.InterfacesV1.Executor +import qualified CCIP.RuntimeV1.OffRamp +import qualified CCIP.RuntimeV1.OnRamp +import qualified CCIP.RuntimeV1.PerPartyRouter + +import qualified CommitteeVerifier.DummyCommitteeVerifier + import qualified TestToken pendingInstructionDetails @@ -56,20 +57,20 @@ pendingInstructionDetails reader cid = do finalityConfig n = if n == 0 - then CCIP.FinalityConfig.WaitForFinality - else CCIP.FinalityConfig.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n rawFinalityConfig n = if n == 0 - then CCIP.FinalityConfig.waitForFinalityFlag + then CCIP.CodecV1.FinalityConfig.waitForFinalityFlag else fromSome do - flagsHex <- CCIP.MessageCodecV1.encodeUint16 0 - blockConfirmationsHex <- CCIP.MessageCodecV1.encodeUint16 n + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 n pure (flagsHex <> blockConfirmationsHex) unsafeDecodeRequestedFinality finalityConfig = fromSomeNote "unsafeDecodeRequestedFinality: invalid finality config" - (CCIP.FinalityConfig.decodeRequestedFinality finalityConfig) + (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalityConfig) messageFinality n = unsafeDecodeRequestedFinality (rawFinalityConfig n) @@ -94,39 +95,39 @@ mult m = intToNumeric (truncate (m * 100000000.0)) cents : Decimal -> Numeric 0 cents c = intToNumeric (truncate c) -basicExtraArgs : Int -> CCIP.Client.ExtraArgs -basicExtraArgs gasLimit = CCIP.Client.V3 CCIP.Client.GenericExtraArgsV3 with +basicExtraArgs : Int -> CCIP.ClientV1.ExtraArgs +basicExtraArgs gasLimit = CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = gasLimit ccvs = [] - executor = CCIP.Client.Executor_NoExecutor + executor = CCIP.ClientV1.Executor_NoExecutor tokenReceiver = "" tokenArgs = "" extraArgsWithDefaultExecutor : Int - -> ContractId CCIP.Interfaces.Executor.IExecutor + -> ContractId CCIP.InterfacesV1.Executor.IExecutor -> BytesHex - -> CCIP.Client.ExtraArgs + -> CCIP.ClientV1.ExtraArgs extraArgsWithDefaultExecutor gasLimit _executorCid executorArgs = - CCIP.Client.V3 CCIP.Client.GenericExtraArgsV3 with + CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = gasLimit ccvs = [] - executor = CCIP.Client.Executor_UseDefault with + executor = CCIP.ClientV1.Executor_UseDefault with executorArgs = executorArgs tokenReceiver = "" tokenArgs = "" extraArgsWithExecutor : Int - -> RawInstanceAddress.RawInstanceAddress - -> ContractId CCIP.Interfaces.Executor.IExecutor + -> Chainlink.InstanceAddress.RawInstanceAddress + -> ContractId CCIP.InterfacesV1.Executor.IExecutor -> BytesHex - -> CCIP.Client.ExtraArgs + -> CCIP.ClientV1.ExtraArgs extraArgsWithExecutor gasLimit requiredExecutor _executorCid executorArgs = - CCIP.Client.V3 CCIP.Client.GenericExtraArgsV3 with + CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = gasLimit ccvs = [] - executor = CCIP.Client.Executor_WithAddress with + executor = CCIP.ClientV1.Executor_WithAddress with executorAddress = requiredExecutor executorArgs = executorArgs tokenReceiver = "" @@ -142,19 +143,19 @@ testCCIPSendFeeSplitLogic = script do ccipOwner <- allocateParty "ccip-owner-split" let ccvFees = [ - CCIP.SendingMessageV1.CCVFee with + CCIP.CoreV1.SendingMessage.CCVFee with ccvInstanceId = "ccv-a-1" ccvOwner = ccvOwnerA feeUSDCents = 0.0 destGasLimit = 0 destBytesOverhead = 0 - , CCIP.SendingMessageV1.CCVFee with + , CCIP.CoreV1.SendingMessage.CCVFee with ccvInstanceId = "ccv-a-2" ccvOwner = ccvOwnerA feeUSDCents = 0.0 destGasLimit = 0 destBytesOverhead = 0 - , CCIP.SendingMessageV1.CCVFee with + , CCIP.CoreV1.SendingMessage.CCVFee with ccvInstanceId = "ccv-b-1" ccvOwner = ccvOwnerB feeUSDCents = 0.0 @@ -162,11 +163,11 @@ testCCIPSendFeeSplitLogic = script do destBytesOverhead = 0 ] let ccvAmounts : [Decimal] = [10.0, 20.0, 5.0] - let verifierFees = CCIP.PerPartyRouter.buildCCVFeeAllocations ccvFees ccvAmounts - let withPool = CCIP.PerPartyRouter.addFeeForParty verifierFees poolOwner 7.0 - let withExecutor = CCIP.PerPartyRouter.addFeeForParty withPool executorOwner 4.0 - let ownerResidual = 50.0 - CCIP.PerPartyRouter.sumAllocatedFees withExecutor - let recipientFees = CCIP.PerPartyRouter.addFeeForParty withExecutor ccipOwner ownerResidual + let verifierFees = CCIP.RuntimeV1.PerPartyRouter.buildCCVFeeAllocations ccvFees ccvAmounts + let withPool = CCIP.RuntimeV1.PerPartyRouter.addFeeForParty verifierFees poolOwner 7.0 + let withExecutor = CCIP.RuntimeV1.PerPartyRouter.addFeeForParty withPool executorOwner 4.0 + let ownerResidual = 50.0 - CCIP.RuntimeV1.PerPartyRouter.sumAllocatedFees withExecutor + let recipientFees = CCIP.RuntimeV1.PerPartyRouter.addFeeForParty withExecutor ccipOwner ownerResidual case Map.lookup ccvOwnerA recipientFees of Some v -> v === 30.0 @@ -202,7 +203,6 @@ testCCIPSendAllFeePayouts = script do let onRampInstanceId = "test-onramp-all-fees" let rmnInstanceId = "test-rmn-all-fees" let tokenAdminRegistryInstanceId = "test-tar-all-fees" - let ccvRegistryInstanceId = "test-ccvregistry-all-fees" let executorInstanceId = "test-executor-all-fees" let sourceChainSelector : Numeric 0 = 1111111114.0 let destChainSelector : Numeric 0 = 2222222225.0 @@ -211,19 +211,18 @@ testCCIPSendAllFeePayouts = script do admin = ccipOwner id = "FeeToken" - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let ccvRegistryInstanceAddress = RawInstanceAddress.make ccvRegistryInstanceId ccipOwner - let executorInstanceAddress = RawInstanceAddress.make executorInstanceId executorOwner - let ccvInstanceAddress = RawInstanceAddress.make ccvInstanceId ccvOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let executorInstanceAddress = Chainlink.InstanceAddress.make executorInstanceId executorOwner + let ccvInstanceAddress = Chainlink.InstanceAddress.make ccvInstanceId ccvOwner globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = sourceChainSelector - destChainConfigs = Map.fromList [(destChainSelector, CCIP.GlobalConfig.DestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False @@ -237,7 +236,7 @@ testCCIPSendAllFeePayouts = script do sourceChainConfigs = Map.empty rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -245,17 +244,17 @@ testCCIPSendAllFeePayouts = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 1 feeQuoter <- submit ccipOwner do - createCmd CCIP.FeeQuoter.FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = "test-feequoter-all-fees" - owner = ccipOwner + ccipOwner = ccipOwner feeTokens = Set.fromList [testFeeTokenId] - destChainConfigs = Map.fromList [(destChainSelector, CCIP.FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 1000000 @@ -267,11 +266,11 @@ testCCIPSendAllFeePayouts = script do defaultTokenDestGasOverhead = 0)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList [(destChainSelector, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 0.0 timestamp = datetime 2025 Jan 1 0 0 0)] usdPerToken = Map.fromList [(testFeeTokenId, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with -- price = 20.0: 100 USD cents = $1 / $20 per token = 0.05 tokens per recipient. price = 20.0 timestamp = datetime 2025 Jan 1 0 0 0)] @@ -279,48 +278,47 @@ testCCIPSendAllFeePayouts = script do priceUpdaters = [] onRamp <- submit ccipOwner do - createCmd CCIP.OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = onRampInstanceId ccipOwner = ccipOwner maxUSDCentsPerMsg = 1000000000.0 - deps = CCIP.OnRamp.OnRampDeps with + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "test-feequoter-all-fees" ccipOwner - ccvRegistry = ccvRegistryInstanceAddress + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-all-fees" ccipOwner executor <- submit executorOwner do - createCmd CCIP.Executor.Executor with + createCmd CCIP.ExecutorV1.Executor with instanceId = executorInstanceId owner = executorOwner maxCCVsPerMsg = 10 - dynamicConfig = CCIP.Executor.DynamicConfig with + dynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None allowedFinalityConfig = finalityConfig 0 ccvAllowlistEnabled = False allowedCCVs = [] - remoteChainConfigs = Map.fromList [(destChainSelector, CCIP.Executor.RemoteChainConfig with + remoteChainConfigs = Map.fromList [(destChainSelector, CCIP.ExecutorV1.RemoteChainConfig with feeUSDCents = cents 100.0 enabled = True)] factory <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = "test-factory-all-fees" ccipOwner = ccipOwner - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make onRampInstanceId ccipOwner - offRamp = RawInstanceAddress.make "unused-offramp-all-fees" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make onRampInstanceId ccipOwner + offRamp = Chainlink.InstanceAddress.make "unused-offramp-all-fees" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "test-feequoter-all-fees" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter-all-fees" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs user <> disclose disclosedFactory) do - exerciseCmd factory CCIP.PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = user instanceId = "test-router-user-all-fees" let router = createResult.router @@ -336,8 +334,8 @@ testCCIPSendAllFeePayouts = script do admin = ccipOwner feeTokenConfig <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenConfig with - instanceId = CCIP.TokenAdminRegistry.tokenConfigInstanceId testFeeTokenId + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenConfig with + instanceId = CCIP.CoreV1.TokenAdminRegistry.tokenConfigInstanceId testFeeTokenId registryInstanceId = tokenAdminRegistryInstanceId registryOwner = ccipOwner index = 0 @@ -364,67 +362,69 @@ testCCIPSendAllFeePayouts = script do <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = receiver payload = "48656c6c6f20576f726c64" tokenTransfer = None feeToken = testFeeTokenId extraArgs = extraArgsWithDefaultExecutor 100000 - (toInterfaceContractId @CCIP.Interfaces.Executor.IExecutor executor) + (toInterfaceContractId @CCIP.InterfacesV1.Executor.IExecutor executor) "" -- ccvOwner is not yet a stakeholder; use disclosure from ccipOwner (signatory). disclosedSm <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid sendingMessageCid <- submit (actAs ccvOwner <> disclose disclosedSm) do - exerciseCmd sendingMessageCid CCIP.SendingMessageV1.AddCCVFee with + coerceContractId <$> exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddCCVFee with ccvInstanceId = ccvInstanceId feeUSDCents = cents 100.0 destGasLimit = 0 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner -- AddCCVFee made ccvOwner a signatory; refresh disclosure for the updated SM. - disclosedSm <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid - -- caller must be a stakeholder of SendingMessageV1 (ccipOwner is signatory). + disclosedSm <- fromSome <$> queryDisclosure ccipOwner (coerceContractId sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) + -- caller must be a stakeholder of SendingMessage (ccipOwner is signatory). -- executorOwner stays in actAs so the nested AddExecutorFee (controller = executorOwner) succeeds. sendingMessageCid <- submit (actAs ccipOwner <> actAs executorOwner <> disclose disclosedSm) do - exerciseCmd (toInterfaceContractId @CCIP.Interfaces.Executor.IExecutor executor) - CCIP.Interfaces.Executor.Executor_CalculateFee with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.InterfacesV1.Executor.IExecutor executor) + CCIP.InterfacesV1.Executor.Executor_CalculateFee with expectedExecutor = executorInstanceAddress sendingMessageCid = sendingMessageCid executorArgs = "" - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccipOwner -- FinalizeFee also calls BuildMessage (no token transfer), leaving SM in FeeFinalized state. sendingMessageCid <- submit (actAs user <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedFeeQuoter) do - exerciseCmd router CCIP.PerPartyRouter.FinalizeFee with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.FinalizeFee with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid -- AddVerifierData requires FeeFinalized state; ccvOwner is already a signatory (no disclosure needed). sendingMessageCid <- submit (actAs ccvOwner) do - exerciseCmd sendingMessageCid CCIP.SendingMessageV1.AddVerifierData with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddVerifierData with ccvInstanceId = ccvInstanceId versionTag = "00000001" verifierBlob = "" messageSentObservers = [] + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner badTransferFactory <- submit ccipOwner do @@ -447,13 +447,13 @@ testCCIPSendAllFeePayouts = script do <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote <> disclose disclosedBadTransferFactory <> disclose disclosedFeeTokenConfig) do - exerciseCmd router CCIP.PerPartyRouter.CCIPSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.CCIPSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid feeTokenHoldingCids = [toInterfaceContractId userHolding] @@ -465,13 +465,13 @@ testCCIPSendAllFeePayouts = script do <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote <> disclose disclosedTransferFactory <> disclose disclosedFeeTokenConfig) do - exerciseCmd router CCIP.PerPartyRouter.CCIPSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.CCIPSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid feeTokenHoldingCids = [toInterfaceContractId userHolding] @@ -525,7 +525,6 @@ testCCIPSend = script do let rmnInstanceId = "test-rmn" let factoryInstanceId = "test-factory" let tokenAdminRegistryInstanceId = "test-tar" - let ccvRegistryInstanceId = "test-ccvregistry" let sourceChainSelector : Numeric 0 = 1111111111.0 let destChainSelector : Numeric 0 = 2222222222.0 @@ -534,24 +533,23 @@ testCCIPSend = script do id = "FeeToken" -- Compute instance addresses - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let ccvRegistryInstanceAddress = RawInstanceAddress.make ccvRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner -- Deploy GlobalConfig with network fee fields globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = sourceChainSelector - destChainConfigs = Map.fromList [(destChainSelector, CCIP.GlobalConfig.DestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 12345 offRampAddress = "0000000000000000000000000000000000000003" - defaultExecutor = Some (RawInstanceAddress.make "test-executor" ccipOwner) -- this default executor will be used if Executor_UseDefault is specified + defaultExecutor = Some (Chainlink.InstanceAddress.make "test-executor" ccipOwner) -- this default executor will be used if Executor_UseDefault is specified laneMandatedCCVs = [] defaultCCVs = [] messageNetworkFeeUSDCents = cents 0.0 @@ -560,7 +558,7 @@ testCCIPSend = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -569,18 +567,18 @@ testCCIPSend = script do -- Deploy TokenAdminRegistry tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 1 -- Deploy FeeQuoter with fee token price feeQuoter <- submit ccipOwner do - createCmd CCIP.FeeQuoter.FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = "test-feequoter" - owner = ccipOwner + ccipOwner = ccipOwner feeTokens = Set.fromList [testFeeTokenId] - destChainConfigs = Map.fromList [(destChainSelector, CCIP.FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 1000000 @@ -592,11 +590,11 @@ testCCIPSend = script do defaultTokenDestGasOverhead = 0)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList [(destChainSelector, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 0.0 timestamp = datetime 2025 Jan 1 0 0 0)] usdPerToken = Map.fromList [(testFeeTokenId, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 100000000.0 timestamp = datetime 2025 Jan 1 0 0 0)] linkTokenInstrumentId = testFeeTokenId @@ -604,44 +602,43 @@ testCCIPSend = script do -- Deploy OnRamp onRamp <- submit ccipOwner do - createCmd CCIP.OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = onRampInstanceId ccipOwner = ccipOwner maxUSDCentsPerMsg = 1000000000.0 - deps = CCIP.OnRamp.OnRampDeps with + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "test-feequoter" ccipOwner - ccvRegistry = ccvRegistryInstanceAddress + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter" ccipOwner -- Deploy production Executor executor <- submit ccipOwner do - createCmd CCIP.Executor.Executor with + createCmd CCIP.ExecutorV1.Executor with instanceId = "test-executor" owner = ccipOwner maxCCVsPerMsg = 10 - dynamicConfig = CCIP.Executor.DynamicConfig with + dynamicConfig = CCIP.ExecutorV1.DynamicConfig with feeAggregator = None allowedFinalityConfig = finalityConfig 0 ccvAllowlistEnabled = False allowedCCVs = [] - remoteChainConfigs = Map.fromList [(destChainSelector, CCIP.Executor.RemoteChainConfig with + remoteChainConfigs = Map.fromList [(destChainSelector, CCIP.ExecutorV1.RemoteChainConfig with feeUSDCents = cents 0.0 enabled = True)] - let executorInstanceAddress = RawInstanceAddress.make "test-executor" ccipOwner + let executorInstanceAddress = Chainlink.InstanceAddress.make "test-executor" ccipOwner -- Deploy PerPartyRouter factory factory <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = factoryInstanceId ccipOwner = ccipOwner - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make onRampInstanceId ccipOwner - offRamp = RawInstanceAddress.make "unused-offramp" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make onRampInstanceId ccipOwner + offRamp = Chainlink.InstanceAddress.make "unused-offramp" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "test-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty @@ -649,7 +646,7 @@ testCCIPSend = script do -- User creates their router createResult <- submit (actAs user <> disclose disclosedFactory) do - exerciseCmd factory CCIP.PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = user instanceId = "test-router-user" let router = createResult.router @@ -669,8 +666,8 @@ testCCIPSend = script do admin = ccipOwner feeTokenConfig <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenConfig with - instanceId = CCIP.TokenAdminRegistry.tokenConfigInstanceId testFeeTokenId + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenConfig with + instanceId = CCIP.CoreV1.TokenAdminRegistry.tokenConfigInstanceId testFeeTokenId registryInstanceId = tokenAdminRegistryInstanceId registryOwner = ccipOwner index = 0 @@ -684,44 +681,44 @@ testCCIPSend = script do disclosedFeeTokenConfig <- fromSome <$> queryDisclosure ccipOwner feeTokenConfig - -- PrepareSend: create SendingMessageV1 (message deferred to executor) + -- PrepareSend: create SendingMessage (message deferred to executor) sendingMessageCid <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + coerceContractId <$> exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter), - (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = receiver payload = "48656c6c6f20576f726c64" tokenTransfer = None feeToken = testFeeTokenId extraArgs = extraArgsWithDefaultExecutor 100000 - (toInterfaceContractId @CCIP.Interfaces.Executor.IExecutor executor) + (toInterfaceContractId @CCIP.InterfacesV1.Executor.IExecutor executor) "" -- Executor fee calculation (must happen before FinalizeFee) - disclosedSm <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid + disclosedSm <- fromSome <$> queryDisclosure ccipOwner (coerceContractId sendingMessageCid : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) sendingMessageCid <- submit (actAs ccipOwner <> disclose disclosedSm) do - exerciseCmd (toInterfaceContractId @CCIP.Interfaces.Executor.IExecutor executor) - CCIP.Interfaces.Executor.Executor_CalculateFee with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.InterfacesV1.Executor.IExecutor executor) + CCIP.InterfacesV1.Executor.Executor_CalculateFee with expectedExecutor = executorInstanceAddress sendingMessageCid = sendingMessageCid executorArgs = "" - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccipOwner sendingMessageCid <- submit (actAs user <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedFeeQuoter) do - exerciseCmd router CCIP.PerPartyRouter.FinalizeFee with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.FinalizeFee with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid @@ -729,12 +726,12 @@ testCCIPSend = script do -- CCIPSend: validate, collect fees, emit event sendResult <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote <> disclose disclosedTransferFactory <> disclose disclosedFeeTokenConfig) do - exerciseCmd router CCIP.PerPartyRouter.CCIPSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.CCIPSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] sendingMessageCid = sendingMessageCid feeTokenHoldingCids = [] feeTokenConfigCid = feeTokenConfig @@ -749,59 +746,61 @@ testCCIPSend = script do Some msgSent <- user `queryContractId` sendResult.ccipMessageSent msgSent.event.sequenceNumber === 1.0 msgSent.event.destChainSelector === destChainSelector - let decoded = fromSome (CCIP.MessageCodecV1.decodeMessageV1 msgSent.event.encodedMessage) + msgSent.event.feeToken === testFeeTokenId + msgSent.event.tokenAmountBeforeTokenPoolFees === 0.0 + let decoded = fromSome (CCIP.CodecV1.MessageCodecV1.decodeMessageV1 msgSent.event.encodedMessage) decoded.executionGasLimit === 112345 debug ("message sent: " <> show sendResult.messageId) -- Send another message, sequence number should be 2 sendingMessageCid2 <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd newRouter CCIP.PerPartyRouter.PrepareSend with + coerceContractId <$> exerciseCmd newRouter CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter), - (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = receiver payload = "48656c6c6f20576f726c6432" tokenTransfer = None feeToken = testFeeTokenId extraArgs = extraArgsWithDefaultExecutor 100000 - (toInterfaceContractId @CCIP.Interfaces.Executor.IExecutor executor) + (toInterfaceContractId @CCIP.InterfacesV1.Executor.IExecutor executor) "" -- Executor fee for second message (must happen before FinalizeFee) - disclosedSm2 <- fromSome <$> queryDisclosure ccipOwner sendingMessageCid2 + disclosedSm2 <- fromSome <$> queryDisclosure ccipOwner (coerceContractId sendingMessageCid2 : ContractId CCIP.CoreV1.SendingMessage.SendingMessage) sendingMessageCid2 <- submit (actAs ccipOwner <> disclose disclosedSm2) do - exerciseCmd (toInterfaceContractId @CCIP.Interfaces.Executor.IExecutor executor) - CCIP.Interfaces.Executor.Executor_CalculateFee with + coerceContractId <$> exerciseCmd (toInterfaceContractId @CCIP.InterfacesV1.Executor.IExecutor executor) + CCIP.InterfacesV1.Executor.Executor_CalculateFee with expectedExecutor = executorInstanceAddress sendingMessageCid = sendingMessageCid2 executorArgs = "" - extraContext = Splice.Api.Token.MetadataV1.emptyChoiceContext + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccipOwner sendingMessageCid2 <- submit (actAs user <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedFeeQuoter) do - exerciseCmd newRouter CCIP.PerPartyRouter.FinalizeFee with + exerciseCmd newRouter CCIP.RuntimeV1.PerPartyRouter.FinalizeFee with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid2 sendResult2 <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote <> disclose disclosedTransferFactory <> disclose disclosedFeeTokenConfig) do - exerciseCmd newRouter CCIP.PerPartyRouter.CCIPSend with + exerciseCmd newRouter CCIP.RuntimeV1.PerPartyRouter.CCIPSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] sendingMessageCid = sendingMessageCid2 feeTokenHoldingCids = [] feeTokenConfigCid = feeTokenConfig @@ -839,19 +838,19 @@ testCCIPExecute = script do let destChainSelector : Numeric 0 = 2222222222.0 -- Compute instance addresses - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let ccvInstanceAddress = RawInstanceAddress.make ccvInstanceId ccvOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let ccvInstanceAddress = Chainlink.InstanceAddress.make ccvInstanceId ccvOwner -- Deploy GlobalConfig globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000001"] laneMandatedCCVs = [] @@ -859,7 +858,7 @@ testCCIPExecute = script do -- Deploy RMNRemote rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -868,32 +867,32 @@ testCCIPExecute = script do -- Deploy TokenAdminRegistry tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 -- Deploy OffRamp offRamp <- submit ccipOwner do - createCmd CCIP.OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = CCIP.OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress -- Deploy PerPartyRouter factory factory <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = factoryInstanceId ccipOwner = ccipOwner - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp" ccipOwner - offRamp = RawInstanceAddress.make offRampInstanceId ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp" ccipOwner + offRamp = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty @@ -901,13 +900,13 @@ testCCIPExecute = script do -- Receiver creates their router createResult <- submit (actAs receiver <> disclose disclosedFactory) do - exerciseCmd factory CCIP.PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = receiver instanceId = "test-router-receiver" let router = createResult.router -- Build a test message (wire format uses finality) - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 @@ -916,14 +915,14 @@ testCCIPExecute = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make offRampInstanceId ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make offRampInstanceId ccipOwner) sender = "0000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = CCIP.MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message -- Disclose contracts to receiver disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp @@ -933,12 +932,12 @@ testCCIPExecute = script do -- PrepareExecute executingMessageCid <- submit (actAs receiver <> actAs ccipOwner <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareExecute with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (CCIP.OffRamp.offRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -949,23 +948,24 @@ testCCIPExecute = script do caller = receiver -- Add CCV verification - executingMessageCid <- submit (actAs ccvOwner <> actAs ccipOwner) do - exerciseCmd executingMessageCid CCIP.ExecutingMessageV1.AddCCVVerification with + executingMessageCid <- coerceContractId <$> submit (actAs ccvOwner <> actAs ccipOwner) do + exerciseCmd (coerceContractId @_ @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = "" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner -- Execute executeResult <- submit (actAs receiver <> actAs ccipOwner <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.Execute with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), - (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), - (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), - (CCIP.OffRamp.offRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] + values = TextMap.fromList [(CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid - executeResult.state === CCIP.Internal.SUCCESS + executeResult.state === CCIP.APIV1.ExecutingMessage.SUCCESS debug ("message executed: " <> show executeResult.messageId) @@ -990,7 +990,6 @@ testPrepareSendExtraArgs = script do let rmnInstanceId = "test-rmn" let factoryInstanceId = "test-factory" let tokenAdminRegistryInstanceId = "test-tar" - let ccvRegistryInstanceId = "test-ccvregistry" let sourceChainSelector : Numeric 0 = 1111111111.0 let destChainSelector : Numeric 0 = 2222222222.0 let destChainSelector2 : Numeric 0 = 3333333333.0 @@ -998,37 +997,36 @@ testPrepareSendExtraArgs = script do let feeTokenId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner id = "FeeToken" - let defaultCCV = RawInstanceAddress.make "default-ccv" ccipOwner + let defaultCCV = Chainlink.InstanceAddress.make "default-ccv" ccipOwner - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let ccvRegistryInstanceAddress = RawInstanceAddress.make ccvRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = sourceChainSelector destChainConfigs = Map.fromList [ - (destChainSelector, CCIP.GlobalConfig.DestChainConfig with + (destChainSelector, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = True baseExecutionGasCost = 0 offRampAddress = "0000000000000000000000000000000000000003" - defaultExecutor = Some (RawInstanceAddress.RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") laneMandatedCCVs = [] defaultCCVs = [defaultCCV] messageNetworkFeeUSDCents = cents 0.0 tokenNetworkFeeUSDCents = cents 0.0), - (destChainSelector2, CCIP.GlobalConfig.DestChainConfig with + (destChainSelector2, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "0000000000000000000000000000000000000003" - defaultExecutor = Some (RawInstanceAddress.RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") laneMandatedCCVs = [] defaultCCVs = [defaultCCV] messageNetworkFeeUSDCents = cents 0.0 @@ -1036,7 +1034,7 @@ testPrepareSendExtraArgs = script do sourceChainConfigs = Map.empty rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1044,17 +1042,17 @@ testPrepareSendExtraArgs = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 feeQuoter <- submit ccipOwner do - createCmd CCIP.FeeQuoter.FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = "test-feequoter" - owner = ccipOwner + ccipOwner = ccipOwner feeTokens = Set.fromList [feeTokenId] - destChainConfigs = Map.fromList [(destChainSelector, CCIP.FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 1000000 @@ -1066,43 +1064,42 @@ testPrepareSendExtraArgs = script do defaultTokenDestGasOverhead = 0)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList [(destChainSelector, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 0.0 timestamp = datetime 2025 Jan 1 0 0 0)] usdPerToken = Map.fromList [(feeTokenId, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 100000000.0 timestamp = datetime 2025 Jan 1 0 0 0)] linkTokenInstrumentId = feeTokenId priceUpdaters = [] onRamp <- submit ccipOwner do - createCmd CCIP.OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = onRampInstanceId ccipOwner = ccipOwner maxUSDCentsPerMsg = 1000000000.0 - deps = CCIP.OnRamp.OnRampDeps with + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "test-feequoter" ccipOwner - ccvRegistry = ccvRegistryInstanceAddress + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter" ccipOwner factory <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = factoryInstanceId ccipOwner = ccipOwner - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make onRampInstanceId ccipOwner - offRamp = RawInstanceAddress.make "unused-offramp" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make onRampInstanceId ccipOwner + offRamp = Chainlink.InstanceAddress.make "unused-offramp" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "test-feequoter" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "test-feequoter" ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs user <> disclose disclosedFactory) do - exerciseCmd factory CCIP.PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = user instanceId = "test-router-user" let router = createResult.router @@ -1127,18 +1124,18 @@ testPrepareSendExtraArgs = script do let receiver = "b8a3d7a9c797b5bd47f8c5efd96dadecf15ddd3c" let context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] smCid <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = receiver payload = "01" tokenTransfer = None @@ -1151,41 +1148,41 @@ testPrepareSendExtraArgs = script do sm.requiredCCVs === [defaultCCV] smWithCustomCCVCid <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = receiver payload = "02" tokenTransfer = None feeToken = feeTokenId - extraArgs = CCIP.Client.V3 CCIP.Client.GenericExtraArgsV3 with + extraArgs = CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = 123 ccvs = - [CCIP.Client.CCVExtraArg with - ccvAddress = RawInstanceAddress.make "custom-ccv" user + [CCIP.ClientV1.CCVExtraArg with + ccvAddress = Chainlink.InstanceAddress.make "custom-ccv" user ccvArgs = ""] - executor = CCIP.Client.Executor_NoExecutor + executor = CCIP.ClientV1.Executor_NoExecutor tokenReceiver = "" tokenArgs = "" Some smWithCustomCCV <- user `queryContractId` smWithCustomCCVCid - smWithCustomCCV.requiredCCVs === [RawInstanceAddress.make "custom-ccv" user] + smWithCustomCCV.requiredCCVs === [Chainlink.InstanceAddress.make "custom-ccv" user] -- Quote-path required-CCV computation must merge sender/lane with pool CCVs -- using outbound default/sentinel semantics. - let tokenOnlyMessage = CCIP.Client.Canton2AnyMessage with + let tokenOnlyMessage = CCIP.ClientV1.Canton2AnyMessage with receiver = receiver payload = "" - tokenTransfer = Some (CCIP.Client.TokenTransfer with + tokenTransfer = Some (CCIP.ClientV1.TokenTransfer with token = feeTokenId amount = 1.0) feeToken = feeTokenId extraArgs = basicExtraArgs 0 - let poolCCV = RawInstanceAddress.make "pool-ccv" user + let poolCCV = Chainlink.InstanceAddress.make "pool-ccv" user requiredCCVsWithEmptyPool <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig) do - exerciseCmd router CCIP.PerPartyRouter.GetRequiredCCVsForSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.GetRequiredCCVsForSend with context = context destChainSelector = destChainSelector message = tokenOnlyMessage @@ -1193,15 +1190,15 @@ testPrepareSendExtraArgs = script do requiredCCVsWithEmptyPool === [defaultCCV] requiredCCVsWithSentinel <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig) do - exerciseCmd router CCIP.PerPartyRouter.GetRequiredCCVsForSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.GetRequiredCCVsForSend with context = context destChainSelector = destChainSelector message = tokenOnlyMessage - poolReportedCCVs = [CCIP.Internal.useDefaultCCVs, poolCCV] + poolReportedCCVs = [CCIP.CodecV1.CCVCodec.useDefaultCCVs, poolCCV] requiredCCVsWithSentinel === [defaultCCV, poolCCV] requiredCCVsWithExplicitPool <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig) do - exerciseCmd router CCIP.PerPartyRouter.GetRequiredCCVsForSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.GetRequiredCCVsForSend with context = context destChainSelector = destChainSelector message = tokenOnlyMessage @@ -1209,26 +1206,26 @@ testPrepareSendExtraArgs = script do requiredCCVsWithExplicitPool === [poolCCV] submitMustFail (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context destinationChainSelector = destChainSelector2 - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = receiver payload = "03" tokenTransfer = None feeToken = feeTokenId - extraArgs = CCIP.Client.V3 CCIP.Client.GenericExtraArgsV3 with + extraArgs = CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = 0 ccvs = [] - executor = CCIP.Client.Executor_NoExecutor + executor = CCIP.ClientV1.Executor_NoExecutor tokenReceiver = "72bfa34fa86ff609ee85ae7fbffee1a49c231b89" tokenArgs = "" submitMustFail (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = "12345678" payload = "" tokenTransfer = None @@ -1252,7 +1249,6 @@ testPrepareSendRejectsOversizedPayload = script do let rmnInstanceId = "test-rmn-payload" let factoryInstanceId = "test-factory-payload" let tokenAdminRegistryInstanceId = "test-tar-payload" - let ccvRegistryInstanceId = "test-ccvregistry-payload" let feeQuoterInstanceId = "test-feequoter-payload" let sourceChainSelector : Numeric 0 = 1111111111.0 let destChainSelector : Numeric 0 = 2222222222.0 @@ -1261,23 +1257,22 @@ testPrepareSendRejectsOversizedPayload = script do admin = ccipOwner id = "FeeToken" - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let ccvRegistryInstanceAddress = RawInstanceAddress.make ccvRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = sourceChainSelector - destChainConfigs = Map.fromList [(destChainSelector, CCIP.GlobalConfig.DestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "0000000000000000000000000000000000000003" - defaultExecutor = Some (RawInstanceAddress.RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") laneMandatedCCVs = [] defaultCCVs = [] messageNetworkFeeUSDCents = cents 0.0 @@ -1285,7 +1280,7 @@ testPrepareSendRejectsOversizedPayload = script do sourceChainConfigs = Map.empty rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1293,17 +1288,17 @@ testPrepareSendRejectsOversizedPayload = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 feeQuoter <- submit ccipOwner do - createCmd CCIP.FeeQuoter.FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = feeQuoterInstanceId - owner = ccipOwner + ccipOwner = ccipOwner feeTokens = Set.fromList [testFeeTokenId] - destChainConfigs = Map.fromList [(destChainSelector, CCIP.FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 4 maxPerMsgGasLimit = 1000000 @@ -1315,44 +1310,43 @@ testPrepareSendRejectsOversizedPayload = script do defaultTokenDestGasOverhead = 0)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList [(destChainSelector, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 0.0 timestamp = datetime 2025 Jan 1 0 0 0)] usdPerToken = Map.fromList [(testFeeTokenId, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 100000000.0 timestamp = datetime 2025 Jan 1 0 0 0)] linkTokenInstrumentId = testFeeTokenId priceUpdaters = [] onRamp <- submit ccipOwner do - createCmd CCIP.OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = onRampInstanceId ccipOwner = ccipOwner maxUSDCentsPerMsg = 1000000000.0 - deps = CCIP.OnRamp.OnRampDeps with + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner - ccvRegistry = ccvRegistryInstanceAddress + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner factory <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = factoryInstanceId ccipOwner = ccipOwner - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make onRampInstanceId ccipOwner - offRamp = RawInstanceAddress.make "unused-offramp-payload" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make onRampInstanceId ccipOwner + offRamp = Chainlink.InstanceAddress.make "unused-offramp-payload" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createRouterResult <- submit (actAs user <> disclose disclosedFactory) do - exerciseCmd factory CCIP.PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = user instanceId = "router-payload" let router = createRouterResult.router @@ -1364,17 +1358,17 @@ testPrepareSendRejectsOversizedPayload = script do disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote submitMustFail (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = "0000000000000000000000000000000000000001" payload = "0011223344" tokenTransfer = None @@ -1394,16 +1388,16 @@ testGetExecutionStateUsesActiveAndArchivedMessages = script do let newerMessage = mkHexMessageId 100003 let missingMessage = mkHexMessageId 100004 - let deps = CCIP.PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "onramp-exec-state" ccipOwner - offRamp = RawInstanceAddress.make "offramp-exec-state" ccipOwner - globalConfig = RawInstanceAddress.make "gc-exec-state" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "tar-exec-state" ccipOwner - feeQuoter = RawInstanceAddress.make "fq-exec-state" ccipOwner - rmnRemote = RawInstanceAddress.make "rmn-exec-state" ccipOwner + let deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "onramp-exec-state" ccipOwner + offRamp = Chainlink.InstanceAddress.make "offramp-exec-state" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "gc-exec-state" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-exec-state" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "fq-exec-state" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-exec-state" ccipOwner olderArchive <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.ArchivedExecutedMessages with + createCmd CCIP.RuntimeV1.PerPartyRouter.ArchivedExecutedMessages with ccipOwner partyOwner perPartyRouterInstanceId = "router-exec-state" @@ -1411,7 +1405,7 @@ testGetExecutionStateUsesActiveAndArchivedMessages = script do executedMessages = Set.fromList [olderMessage] newerArchive <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.ArchivedExecutedMessages with + createCmd CCIP.RuntimeV1.PerPartyRouter.ArchivedExecutedMessages with ccipOwner partyOwner perPartyRouterInstanceId = "router-exec-state" @@ -1419,7 +1413,7 @@ testGetExecutionStateUsesActiveAndArchivedMessages = script do executedMessages = Set.fromList [newerMessage] router <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = "router-exec-state" ccipOwner partyOwner @@ -1440,28 +1434,32 @@ testGetExecutionStateUsesActiveAndArchivedMessages = script do <> disclose disclosedRouter activeState <- submit arbitraryCallerSubmission do - exerciseCmd router CCIP.PerPartyRouter.GetExecutionState with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.GetExecutionState with messageHash = activeMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = arbitraryCaller - activeState === CCIP.Internal.SUCCESS + activeState === CCIP.APIV1.ExecutingMessage.SUCCESS newerArchiveState <- submit arbitraryCallerSubmission do - exerciseCmd router CCIP.PerPartyRouter.GetExecutionState with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.GetExecutionState with messageHash = newerMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = arbitraryCaller - newerArchiveState === CCIP.Internal.SUCCESS + newerArchiveState === CCIP.APIV1.ExecutingMessage.SUCCESS olderArchiveState <- submit arbitraryCallerSubmission do - exerciseCmd router CCIP.PerPartyRouter.GetExecutionState with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.GetExecutionState with messageHash = olderMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = arbitraryCaller - olderArchiveState === CCIP.Internal.SUCCESS + olderArchiveState === CCIP.APIV1.ExecutingMessage.SUCCESS missingState <- submit arbitraryCallerSubmission do - exerciseCmd router CCIP.PerPartyRouter.GetExecutionState with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.GetExecutionState with messageHash = missingMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = arbitraryCaller - missingState === CCIP.Internal.UNTOUCHED + missingState === CCIP.APIV1.ExecutingMessage.UNTOUCHED debug "testGetExecutionStateUsesActiveAndArchivedMessages: PASSED" @@ -1481,29 +1479,29 @@ testExecuteRollsOverExecutedMessages = script do let destChainSelector : Numeric 0 = 4444444444.0 let routerInstanceId = "test-router-rollover" let olderArchivedMessage = mkHexMessageId 200001 - let seededMessages = seedExecutedMessages CCIP.PerPartyRouter.maxExecutedMessagesSize + let seededMessages = seedExecutedMessages CCIP.RuntimeV1.PerPartyRouter.maxExecutedMessagesSize let seededMessagesSet = Set.fromList seededMessages let sampleSeededMessage = mkHexMessageId 0 - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let ccvInstanceAddress = RawInstanceAddress.make ccvInstanceId ccvOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let ccvInstanceAddress = Chainlink.InstanceAddress.make ccvInstanceId ccvOwner globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.GlobalConfig.SourceChainConfig with + sourceChainConfigs = Map.fromList [(sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000001"] laneMandatedCCVs = [] defaultCCVs = [ccvInstanceAddress])] rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1511,22 +1509,22 @@ testExecuteRollsOverExecutedMessages = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 offRamp <- submit ccipOwner do - createCmd CCIP.OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = CCIP.OffRamp.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress olderArchive <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.ArchivedExecutedMessages with + createCmd CCIP.RuntimeV1.PerPartyRouter.ArchivedExecutedMessages with ccipOwner partyOwner = receiver perPartyRouterInstanceId = routerInstanceId @@ -1534,23 +1532,23 @@ testExecuteRollsOverExecutedMessages = script do executedMessages = Set.fromList [olderArchivedMessage] router <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = routerInstanceId ccipOwner partyOwner = receiver - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp-rollover" ccipOwner - offRamp = RawInstanceAddress.make offRampInstanceId ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp-rollover" ccipOwner + offRamp = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make "unused-feequoter-rollover" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter-rollover" ccipOwner rmnRemote = rmnRemoteInstanceAddress outboundSequenceNumbers = Map.empty executedMessages = seededMessagesSet archivedExecutionContractIds = [olderArchive] customObservers = [] - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 7.0 @@ -1559,14 +1557,14 @@ testExecuteRollsOverExecutedMessages = script do finality = messageFinality 2000 ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress (RawInstanceAddress.make offRampInstanceId ccipOwner) + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress (Chainlink.InstanceAddress.make offRampInstanceId ccipOwner) sender = "0000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "526f6c6c6f7665722054657374" - let encodedMessage = CCIP.MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRamp disclosedGlobalConfig <- fromSome <$> queryDisclosure ccipOwner globalConfig @@ -1574,13 +1572,13 @@ testExecuteRollsOverExecutedMessages = script do disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote executingMessageCid <- submit (actAs receiver <> actAs ccipOwner <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareExecute with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OffRamp.offRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) ] encodedMessage = encodedMessage receiverParty = receiver @@ -1591,24 +1589,25 @@ testExecuteRollsOverExecutedMessages = script do receiverFinalityConfig = finalityConfig 2000 caller = receiver - executingMessageCid <- submit (actAs ccvOwner <> actAs ccipOwner) do - exerciseCmd executingMessageCid CCIP.ExecutingMessageV1.AddCCVVerification with + executingMessageCid <- coerceContractId <$> submit (actAs ccvOwner <> actAs ccipOwner) do + exerciseCmd (coerceContractId @_ @CCIP.APIV1.ExecutingMessage.IExecutingMessage executingMessageCid) CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = ccvInstanceId versionTag = "" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner executeResult <- submit (actAs receiver <> actAs ccipOwner <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.Execute with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.Execute with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OffRamp.offRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) ] executingMessageCid = executingMessageCid - executeResult.state === CCIP.Internal.SUCCESS + executeResult.state === CCIP.APIV1.ExecutingMessage.SUCCESS Some updatedRouter <- queryContractId receiver executeResult.router Set.size updatedRouter.executedMessages === 1 @@ -1630,37 +1629,40 @@ testExecuteRollsOverExecutedMessages = script do assertMsg "older archive should still contain its original message" $ Set.member olderArchivedMessage firstArchive.executedMessages - Set.size secondArchive.executedMessages === CCIP.PerPartyRouter.maxExecutedMessagesSize + Set.size secondArchive.executedMessages === CCIP.RuntimeV1.PerPartyRouter.maxExecutedMessagesSize assertMsg "new archive should contain the pre-rollover active set" $ Set.member sampleSeededMessage secondArchive.executedMessages _ -> assertMsg "expected exactly two archived execution contract ids after rollover" False activeState <- submit receiver do - exerciseCmd executeResult.router CCIP.PerPartyRouter.GetExecutionState with + exerciseCmd executeResult.router CCIP.RuntimeV1.PerPartyRouter.GetExecutionState with messageHash = executeResult.messageId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = receiver - activeState === CCIP.Internal.SUCCESS + activeState === CCIP.APIV1.ExecutingMessage.SUCCESS seededState <- submit receiver do - exerciseCmd executeResult.router CCIP.PerPartyRouter.GetExecutionState with + exerciseCmd executeResult.router CCIP.RuntimeV1.PerPartyRouter.GetExecutionState with messageHash = sampleSeededMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = receiver - seededState === CCIP.Internal.SUCCESS + seededState === CCIP.APIV1.ExecutingMessage.SUCCESS olderArchiveState <- submit receiver do - exerciseCmd executeResult.router CCIP.PerPartyRouter.GetExecutionState with + exerciseCmd executeResult.router CCIP.RuntimeV1.PerPartyRouter.GetExecutionState with messageHash = olderArchivedMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = receiver - olderArchiveState === CCIP.Internal.SUCCESS + olderArchiveState === CCIP.APIV1.ExecutingMessage.SUCCESS submitMustFail (actAs receiver <> actAs ccipOwner <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd executeResult.router CCIP.PerPartyRouter.PrepareExecute with + exerciseCmd executeResult.router CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OffRamp.offRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) ] encodedMessage = encodedMessage receiverParty = receiver @@ -1688,7 +1690,6 @@ testPrepareSendRejectsDuplicateSenderRequiredCCVs = script do let rmnInstanceId = "test-rmn-dup-ccvs" let factoryInstanceId = "test-factory-dup-ccvs" let tokenAdminRegistryInstanceId = "test-tar-dup-ccvs" - let ccvRegistryInstanceId = "test-ccvregistry-dup-ccvs" let feeQuoterInstanceId = "test-feequoter-dup-ccvs" let sourceChainSelector : Numeric 0 = 1111111111.0 let destChainSelector : Numeric 0 = 2222222222.0 @@ -1697,23 +1698,22 @@ testPrepareSendRejectsDuplicateSenderRequiredCCVs = script do admin = ccipOwner id = "FeeToken" - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let ccvRegistryInstanceAddress = RawInstanceAddress.make ccvRegistryInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = sourceChainSelector - destChainConfigs = Map.fromList [(destChainSelector, CCIP.GlobalConfig.DestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "0000000000000000000000000000000000000003" - defaultExecutor = Some (RawInstanceAddress.RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") laneMandatedCCVs = [] defaultCCVs = [] messageNetworkFeeUSDCents = cents 0.0 @@ -1721,7 +1721,7 @@ testPrepareSendRejectsDuplicateSenderRequiredCCVs = script do sourceChainConfigs = Map.empty rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1729,54 +1729,53 @@ testPrepareSendRejectsDuplicateSenderRequiredCCVs = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 feeQuoter <- submit ccipOwner do - createCmd CCIP.FeeQuoter.FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = feeQuoterInstanceId - owner = ccipOwner + ccipOwner = ccipOwner feeTokens = Set.fromList [testFeeTokenId] destChainConfigs = Map.empty tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.empty usdPerToken = Map.fromList [(testFeeTokenId, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 100000000.0 timestamp = datetime 2025 Jan 1 0 0 0)] linkTokenInstrumentId = testFeeTokenId priceUpdaters = [] onRamp <- submit ccipOwner do - createCmd CCIP.OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = onRampInstanceId ccipOwner = ccipOwner maxUSDCentsPerMsg = 1000000000.0 - deps = CCIP.OnRamp.OnRampDeps with + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner - ccvRegistry = ccvRegistryInstanceAddress + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner factory <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouterFactory with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterFactory with instanceId = factoryInstanceId ccipOwner = ccipOwner - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make onRampInstanceId ccipOwner - offRamp = RawInstanceAddress.make "unused-offramp-dup-ccvs" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make onRampInstanceId ccipOwner + offRamp = Chainlink.InstanceAddress.make "unused-offramp-dup-ccvs" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress - feeQuoter = RawInstanceAddress.make feeQuoterInstanceId ccipOwner + feeQuoter = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner rmnRemote = rmnRemoteInstanceAddress registeredRouters = Map.empty disclosedFactory <- fromSome <$> queryDisclosure ccipOwner factory createResult <- submit (actAs user <> disclose disclosedFactory) do - exerciseCmd factory CCIP.PerPartyRouter.CreateRouter with + exerciseCmd factory CCIP.RuntimeV1.PerPartyRouter.CreateRouter with partyOwner = user instanceId = "test-router-dup-ccvs" let router = createResult.router @@ -1798,32 +1797,32 @@ testPrepareSendRejectsDuplicateSenderRequiredCCVs = script do disclosedDuplicateVerifier <- fromSome <$> queryDisclosure ccipOwner duplicateVerifier submitMustFail (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = "0000000000000000000000000000000000000001" payload = "abcd" feeToken = testFeeTokenId tokenTransfer = None - extraArgs = CCIP.Client.V3 CCIP.Client.GenericExtraArgsV3 with + extraArgs = CCIP.ClientV1.V3 CCIP.ClientV1.GenericExtraArgsV3 with gasLimit = 0 ccvs = - [ CCIP.Client.CCVExtraArg with - ccvAddress = RawInstanceAddress.make "sender-ccv" ccipOwner + [ CCIP.ClientV1.CCVExtraArg with + ccvAddress = Chainlink.InstanceAddress.make "sender-ccv" ccipOwner ccvArgs = "" - , CCIP.Client.CCVExtraArg with - ccvAddress = RawInstanceAddress.make "sender-ccv" ccipOwner + , CCIP.ClientV1.CCVExtraArg with + ccvAddress = Chainlink.InstanceAddress.make "sender-ccv" ccipOwner ccvArgs = "" ] - executor = CCIP.Client.Executor_NoExecutor + executor = CCIP.ClientV1.Executor_NoExecutor tokenReceiver = "" tokenArgs = "" @@ -1843,7 +1842,6 @@ testPrepareSendRejectsSequenceNumberOverflow = script do let onRampInstanceId = "test-onramp-seq" let rmnInstanceId = "test-rmn-seq" let tokenAdminRegistryInstanceId = "test-tar-seq" - let ccvRegistryInstanceId = "test-ccvregistry-seq" let feeQuoterInstanceId = "test-feequoter-seq" let sourceChainSelector : Numeric 0 = 1111111111.0 let destChainSelector : Numeric 0 = 2222222222.0 @@ -1853,24 +1851,24 @@ testPrepareSendRejectsSequenceNumberOverflow = script do admin = ccipOwner id = "FeeToken" - let globalConfigInstanceAddress = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteInstanceAddress = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryInstanceAddress = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let feeQuoterInstanceAddress = RawInstanceAddress.make feeQuoterInstanceId ccipOwner - let onRampInstanceAddress = RawInstanceAddress.make onRampInstanceId ccipOwner + let globalConfigInstanceAddress = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteInstanceAddress = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryInstanceAddress = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let feeQuoterInstanceAddress = Chainlink.InstanceAddress.make feeQuoterInstanceId ccipOwner + let onRampInstanceAddress = Chainlink.InstanceAddress.make onRampInstanceId ccipOwner globalConfig <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = sourceChainSelector - destChainConfigs = Map.fromList [(destChainSelector, CCIP.GlobalConfig.DestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.GlobalConfig.DestChainConfig with isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "0000000000000000000000000000000000000003" - defaultExecutor = Some (RawInstanceAddress.RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") laneMandatedCCVs = [] defaultCCVs = [] messageNetworkFeeUSDCents = cents 0.0 @@ -1878,7 +1876,7 @@ testPrepareSendRejectsSequenceNumberOverflow = script do sourceChainConfigs = Map.empty rmnRemote <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -1886,17 +1884,17 @@ testPrepareSendRejectsSequenceNumberOverflow = script do cursedSubjects = [] tokenAdminRegistry <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 feeQuoter <- submit ccipOwner do - createCmd CCIP.FeeQuoter.FeeQuoter with + createCmd CCIP.CoreV1.FeeQuoter.FeeQuoter with instanceId = feeQuoterInstanceId - owner = ccipOwner + ccipOwner = ccipOwner feeTokens = Set.fromList [testFeeTokenId] - destChainConfigs = Map.fromList [(destChainSelector, CCIP.FeeQuoter.FeeQuoterDestChainConfig with + destChainConfigs = Map.fromList [(destChainSelector, CCIP.CoreV1.FeeQuoter.FeeQuoterDestChainConfig with isEnabled = True maxDataBytes = 100000 maxPerMsgGasLimit = 1000000 @@ -1908,36 +1906,35 @@ testPrepareSendRejectsSequenceNumberOverflow = script do defaultTokenDestGasOverhead = 0)] tokenTransferFeeConfigs = Map.empty usdPerUnitGasByDestChainSelector = Map.fromList [(destChainSelector, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 0.0 timestamp = datetime 2025 Jan 1 0 0 0)] usdPerToken = Map.fromList [(testFeeTokenId, - CCIP.FeeQuoter.TimestampedPrice with + CCIP.CoreV1.FeeQuoter.TimestampedPrice with price = 100000000.0 timestamp = datetime 2025 Jan 1 0 0 0)] linkTokenInstrumentId = testFeeTokenId priceUpdaters = [] onRamp <- submit ccipOwner do - createCmd CCIP.OnRamp.OnRamp with + createCmd CCIP.RuntimeV1.OnRamp.OnRamp with instanceId = onRampInstanceId ccipOwner = ccipOwner maxUSDCentsPerMsg = 1000000000.0 - deps = CCIP.OnRamp.OnRampDeps with + deps = CCIP.RuntimeV1.OnRamp.OnRampDeps with globalConfig = globalConfigInstanceAddress rmnRemote = rmnRemoteInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress feeQuoter = feeQuoterInstanceAddress - ccvRegistry = RawInstanceAddress.make ccvRegistryInstanceId ccipOwner router <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = "router-seq" ccipOwner = ccipOwner partyOwner = user - deps = CCIP.PerPartyRouter.PerPartyRouterDeps with + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with onRamp = onRampInstanceAddress - offRamp = RawInstanceAddress.make "unused-offramp-seq" ccipOwner + offRamp = Chainlink.InstanceAddress.make "unused-offramp-seq" ccipOwner globalConfig = globalConfigInstanceAddress tokenAdminRegistry = tokenAdminRegistryInstanceAddress feeQuoter = feeQuoterInstanceAddress @@ -1954,17 +1951,17 @@ testPrepareSendRejectsSequenceNumberOverflow = script do disclosedRmnRemote <- fromSome <$> queryDisclosure rmnOwner rmnRemote submitMustFail (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do - exerciseCmd router CCIP.PerPartyRouter.PrepareSend with + exerciseCmd router CCIP.RuntimeV1.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) - , (CCIP.FeeQuoter.feeQuoterKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) - , (CCIP.GlobalConfig.globalConfigKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) - , (CCIP.OnRamp.onRampKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.APIV1.FeeQuoter.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.RuntimeV1.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = "0000000000000000000000000000000000000001" payload = "abcd" tokenTransfer = None diff --git a/contracts/ccip/test/daml/RateLimiterTest.daml b/contracts/ccip/test/daml/RateLimiterTest.daml index 8eb0fdeb8..b36414c99 100644 --- a/contracts/ccip/test/daml/RateLimiterTest.daml +++ b/contracts/ccip/test/daml/RateLimiterTest.daml @@ -6,20 +6,20 @@ import DA.Assert import DA.Optional (fromSome) import DA.Time (seconds) -import CCIP.RateLimiter qualified as RateLimiter +import qualified CCIP.RateLimiterV1 testRateLimiterConsumeAndRefill = script do poolOwner <- allocateParty "pool-owner" now <- getTime limiter <- submit poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = "rl-refill" poolInstanceId = "pool-1" poolOwner = poolOwner remoteChainSelector = 123.0 - direction = RateLimiter.RateLimitDirection_Outbound - mode = RateLimiter.RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 100.0 rate = 5.0 @@ -27,7 +27,7 @@ testRateLimiterConsumeAndRefill = script do lastUpdated = now consumed <- submit poolOwner do - exerciseCmd limiter RateLimiter.ConsumeCapacity with + exerciseCmd limiter CCIP.RateLimiterV1.ConsumeCapacity with requested = 90.0 consumed.availableBeforeConsume === 100.0 @@ -35,7 +35,7 @@ testRateLimiterConsumeAndRefill = script do limiterState <- fromSome <$> queryContractId poolOwner consumed.rateLimiterCid now2 <- getTime - RateLimiter.availableTokensAt now2 limiterState === 60.0 + CCIP.RateLimiterV1.availableTokensAt now2 limiterState === 60.0 debug "testRateLimiterConsumeAndRefill: PASSED" @@ -44,13 +44,13 @@ testRateLimiterRejectsOverCapacity = script do now <- getTime limiter <- submit poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = "rl-over-cap" poolInstanceId = "pool-1" poolOwner = poolOwner remoteChainSelector = 123.0 - direction = RateLimiter.RateLimitDirection_Outbound - mode = RateLimiter.RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 100.0 rate = 5.0 @@ -58,7 +58,7 @@ testRateLimiterRejectsOverCapacity = script do lastUpdated = now submitMustFail poolOwner do - exerciseCmd limiter RateLimiter.ConsumeCapacity with + exerciseCmd limiter CCIP.RateLimiterV1.ConsumeCapacity with requested = 101.0 debug "testRateLimiterRejectsOverCapacity: PASSED" @@ -68,13 +68,13 @@ testRateLimiterSetConfigResetsBucket = script do now <- getTime limiter <- submit poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = "rl-set-config" poolInstanceId = "pool-1" poolOwner = poolOwner remoteChainSelector = 123.0 - direction = RateLimiter.RateLimitDirection_Inbound - mode = RateLimiter.RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Inbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 100.0 rate = 5.0 @@ -82,7 +82,7 @@ testRateLimiterSetConfigResetsBucket = script do lastUpdated = now limiter <- submit poolOwner do - exerciseCmd limiter RateLimiter.SetConfig with + exerciseCmd limiter CCIP.RateLimiterV1.SetConfig with newIsEnabled = True newCapacity = 200.0 newRate = 10.0 @@ -99,13 +99,13 @@ testRateLimiterRejectsNegativeRequest = script do now <- getTime limiter <- submit poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = "rl-negative" poolInstanceId = "pool-1" poolOwner = poolOwner remoteChainSelector = 123.0 - direction = RateLimiter.RateLimitDirection_Outbound - mode = RateLimiter.RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 100.0 rate = 5.0 @@ -113,7 +113,7 @@ testRateLimiterRejectsNegativeRequest = script do lastUpdated = now submitMustFail poolOwner do - exerciseCmd limiter RateLimiter.ConsumeCapacity with + exerciseCmd limiter CCIP.RateLimiterV1.ConsumeCapacity with requested = -20.0 debug "testRateLimiterRejectsNegativeRequest: PASSED" @@ -125,13 +125,13 @@ testRateLimiterRejectsNegativeConfig = script do -- Negative capacity must be rejected at creation submitMustFail poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = "rl-neg-cap" poolInstanceId = "pool-1" poolOwner = poolOwner remoteChainSelector = 123.0 - direction = RateLimiter.RateLimitDirection_Outbound - mode = RateLimiter.RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = -1.0 rate = 0.0 @@ -140,13 +140,13 @@ testRateLimiterRejectsNegativeConfig = script do -- Negative rate must be rejected at creation submitMustFail poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = "rl-neg-rate" poolInstanceId = "pool-1" poolOwner = poolOwner remoteChainSelector = 123.0 - direction = RateLimiter.RateLimitDirection_Outbound - mode = RateLimiter.RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 100.0 rate = -5.0 @@ -154,13 +154,13 @@ testRateLimiterRejectsNegativeConfig = script do lastUpdated = now limiter <- submit poolOwner do - createCmd RateLimiter.RateLimiter with + createCmd CCIP.RateLimiterV1.RateLimiter with instanceId = "rl-neg-setconfig" poolInstanceId = "pool-1" poolOwner = poolOwner remoteChainSelector = 123.0 - direction = RateLimiter.RateLimitDirection_Outbound - mode = RateLimiter.RateLimitMode_DefaultFinality + direction = CCIP.RateLimiterV1.RateLimitDirection_Outbound + mode = CCIP.RateLimiterV1.RateLimitMode_DefaultFinality isEnabled = True capacity = 100.0 rate = 5.0 @@ -169,14 +169,14 @@ testRateLimiterRejectsNegativeConfig = script do -- Negative capacity must be rejected by SetConfig submitMustFail poolOwner do - exerciseCmd limiter RateLimiter.SetConfig with + exerciseCmd limiter CCIP.RateLimiterV1.SetConfig with newIsEnabled = True newCapacity = -1.0 newRate = 0.0 -- Negative rate must be rejected by SetConfig submitMustFail poolOwner do - exerciseCmd limiter RateLimiter.SetConfig with + exerciseCmd limiter CCIP.RateLimiterV1.SetConfig with newIsEnabled = True newCapacity = 100.0 newRate = -5.0 diff --git a/contracts/ccip/test/daml/ReceiveRequiredCCVs.daml b/contracts/ccip/test/daml/ReceiveRequiredCCVs.daml index 0a8b304b0..718404444 100644 --- a/contracts/ccip/test/daml/ReceiveRequiredCCVs.daml +++ b/contracts/ccip/test/daml/ReceiveRequiredCCVs.daml @@ -9,21 +9,23 @@ import DA.Optional (fromSome) import DA.Set qualified as Set import qualified DA.TextMap as TextMap +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.GlobalConfig +import qualified CCIP.APIV1.RMNRemote +import qualified CCIP.APIV1.TokenAdminRegistry + import qualified CCIP.CCIPReceiver -import qualified CCIP.Context -import qualified CCIP.FinalityConfig -import qualified CCIP.GlobalConfig -import qualified CCIP.Internal -import qualified CCIP.MessageCodecV1 -import qualified CCIP.OffRamp -import qualified CCIP.OffRampTypes -import qualified CCIP.PerPartyRouter -import qualified CCIP.PerPartyRouterTypes -import qualified CCIP.RMNRemote -import qualified CCIP.TokenAdminRegistry -import Chainlink.InstanceAddress qualified as RawInstanceAddress - -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.GlobalConfig +import qualified CCIP.CoreV1.RMNRemote +import qualified CCIP.CoreV1.TokenAdminRegistry +import qualified CCIP.RuntimeV1.OffRamp +import qualified CCIP.RuntimeV1.PerPartyRouter testReceiver_Create_RejectsInvalidBlockDepthConfig : Script () testReceiver_Create_RejectsInvalidBlockDepthConfig = script do @@ -38,28 +40,28 @@ testReceiver_Create_RejectsInvalidBlockDepthConfig = script do receiverFinalityConfig = finality submitMustFail owner do - createCmd (mkReceiver (CCIP.FinalityConfig.BlockDepth 0)) + createCmd (mkReceiver (CCIP.CodecV1.FinalityConfig.BlockDepth 0)) submitMustFail owner do - createCmd (mkReceiver (CCIP.FinalityConfig.BlockDepth (-1))) + createCmd (mkReceiver (CCIP.CodecV1.FinalityConfig.BlockDepth (-1))) _ <- submit owner do - createCmd (mkReceiver (CCIP.FinalityConfig.BlockDepth 1)) + createCmd (mkReceiver (CCIP.CodecV1.FinalityConfig.BlockDepth 1)) pure () mkContext - : ContractId CCIP.RMNRemote.RMNRemote - -> ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry - -> ContractId CCIP.GlobalConfig.GlobalConfig - -> ContractId CCIP.OffRamp.OffRamp - -> MetadataV1.ChoiceContext + : ContractId CCIP.CoreV1.RMNRemote.RMNRemote + -> ContractId CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry + -> ContractId CCIP.CoreV1.GlobalConfig.GlobalConfig + -> ContractId CCIP.RuntimeV1.OffRamp.OffRamp + -> Splice.Api.Token.MetadataV1.ChoiceContext mkContext rmnRemoteCid tokenAdminRegistryCid globalConfigCid offRampCid = - MetadataV1.ChoiceContext with + Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.Context.rmnRemoteKey, MetadataV1.AV_ContractId (coerceContractId rmnRemoteCid)) - , (CCIP.TokenAdminRegistry.tokenAdminRegistryKey, MetadataV1.AV_ContractId (coerceContractId tokenAdminRegistryCid)) - , (CCIP.GlobalConfig.globalConfigKey, MetadataV1.AV_ContractId (coerceContractId globalConfigCid)) - , (CCIP.OffRamp.offRampKey, MetadataV1.AV_ContractId (coerceContractId offRampCid)) + [ (CCIP.APIV1.RMNRemote.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId (coerceContractId rmnRemoteCid)) + , (CCIP.APIV1.TokenAdminRegistry.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId (coerceContractId tokenAdminRegistryCid)) + , (CCIP.APIV1.GlobalConfig.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId (coerceContractId globalConfigCid)) + , (CCIP.RuntimeV1.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId (coerceContractId offRampCid)) ] testReceiverGetRequiredCCVsMatchesPrepareExecute : Script () @@ -78,17 +80,17 @@ testReceiverGetRequiredCCVsMatchesPrepareExecute = script do let offRampInstanceId = "test-offramp-rrc" let routerInstanceId = "test-router-rrc" let receiverInstanceId = "test-ccipreceiver-rrc" - let laneCcv = RawInstanceAddress.make "lane-ccv-rrc" laneCcvOwner - let receiverCcv = RawInstanceAddress.make "receiver-ccv-rrc" receiverCcvOwner + let laneCcv = Chainlink.InstanceAddress.make "lane-ccv-rrc" laneCcvOwner + let receiverCcv = Chainlink.InstanceAddress.make "receiver-ccv-rrc" receiverCcvOwner globalConfigCid <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty sourceChainConfigs = Map.fromList - [ (sourceChainSelector, CCIP.GlobalConfig.SourceChainConfig with + [ (sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [laneCcv] @@ -97,7 +99,7 @@ testReceiverGetRequiredCCVsMatchesPrepareExecute = script do ] rmnRemoteCid <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -105,36 +107,36 @@ testReceiverGetRequiredCCVsMatchesPrepareExecute = script do cursedSubjects = [] tokenAdminRegistryCid <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 - let globalConfigAddr = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteAddr = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryAddr = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let offRampAddr = RawInstanceAddress.make offRampInstanceId ccipOwner + let globalConfigAddr = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteAddr = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryAddr = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampAddr = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner offRampCid <- submit ccipOwner do - createCmd CCIP.OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = CCIP.OffRampTypes.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigAddr rmnRemote = rmnRemoteAddr tokenAdminRegistry = tokenAdminRegistryAddr routerCid <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = routerInstanceId ccipOwner = ccipOwner partyOwner = receiver - deps = CCIP.PerPartyRouterTypes.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp-rrc" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp-rrc" ccipOwner offRamp = offRampAddr globalConfig = globalConfigAddr tokenAdminRegistry = tokenAdminRegistryAddr - feeQuoter = RawInstanceAddress.make "unused-feequoter-rrc" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter-rrc" ccipOwner rmnRemote = rmnRemoteAddr outboundSequenceNumbers = Map.empty executedMessages = Set.empty @@ -148,24 +150,24 @@ testReceiverGetRequiredCCVsMatchesPrepareExecute = script do requiredCCVs = [receiverCcv] optionalCCVs = [] optionalThreshold = 0 - receiverFinalityConfig = CCIP.FinalityConfig.WaitForFinality + receiverFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 100000 - finality = CCIP.FinalityConfig.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress offRampAddr + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress offRampAddr sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = CCIP.MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message let context = mkContext rmnRemoteCid tokenAdminRegistryCid globalConfigCid offRampCid disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRampCid @@ -176,12 +178,12 @@ testReceiverGetRequiredCCVsMatchesPrepareExecute = script do helperRequired <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig) do exerciseCmd receiverCid CCIP.CCIPReceiver.GetRequiredCCVs with context = context - routerCid = routerCid + routerCid = coerceContractId routerCid encodedMessage = encodedMessage tokenPoolCid = None executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd routerCid CCIP.PerPartyRouter.PrepareExecute with + exerciseCmd routerCid CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with context = context encodedMessage = encodedMessage receiverParty = receiver @@ -189,7 +191,7 @@ testReceiverGetRequiredCCVsMatchesPrepareExecute = script do receiverRequiredCCVs = [receiverCcv] receiverOptionalCCVs = [] receiverOptionalThreshold = 0 - receiverFinalityConfig = CCIP.FinalityConfig.WaitForFinality + receiverFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality caller = receiver executingMessage <- fromSome <$> queryContractId ccipOwner executingMessageCid @@ -212,18 +214,18 @@ testReceiverGetRequiredCCVsDoesNotInjectPoolDefaultsForMessageOnly = script do let offRampInstanceId = "test-offramp-rrc-defaults" let routerInstanceId = "test-router-rrc-defaults" let receiverInstanceId = "test-ccipreceiver-rrc-defaults" - let receiverCcv = RawInstanceAddress.make "receiver-ccv-rrc-defaults" receiverCcvOwner - let defaultCcv = RawInstanceAddress.make "default-ccv-rrc-defaults" defaultCcvOwner - let laneCcv = RawInstanceAddress.make "lane-ccv-rrc-defaults" laneCcvOwner + let receiverCcv = Chainlink.InstanceAddress.make "receiver-ccv-rrc-defaults" receiverCcvOwner + let defaultCcv = Chainlink.InstanceAddress.make "default-ccv-rrc-defaults" defaultCcvOwner + let laneCcv = Chainlink.InstanceAddress.make "lane-ccv-rrc-defaults" laneCcvOwner globalConfigCid <- submit ccipOwner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = globalConfigInstanceId ccipOwner = ccipOwner chainSelector = destChainSelector destChainConfigs = Map.empty sourceChainConfigs = Map.fromList - [ (sourceChainSelector, CCIP.GlobalConfig.SourceChainConfig with + [ (sourceChainSelector, CCIP.CoreV1.GlobalConfig.SourceChainConfig with isEnabled = True onRampAddresses = ["0000000000000000000000000000000000000000000000000000000000000001"] laneMandatedCCVs = [laneCcv] @@ -232,7 +234,7 @@ testReceiverGetRequiredCCVsDoesNotInjectPoolDefaultsForMessageOnly = script do ] rmnRemoteCid <- submit rmnOwner do - createCmd CCIP.RMNRemote.RMNRemote with + createCmd CCIP.CoreV1.RMNRemote.RMNRemote with instanceId = rmnInstanceId rmnOwner = rmnOwner ccipOwner = ccipOwner @@ -240,36 +242,36 @@ testReceiverGetRequiredCCVsDoesNotInjectPoolDefaultsForMessageOnly = script do cursedSubjects = [] tokenAdminRegistryCid <- submit ccipOwner do - createCmd CCIP.TokenAdminRegistry.TokenAdminRegistry with + createCmd CCIP.CoreV1.TokenAdminRegistry.TokenAdminRegistry with instanceId = tokenAdminRegistryInstanceId - owner = ccipOwner + ccipOwner = ccipOwner entryCount = 0 - let globalConfigAddr = RawInstanceAddress.make globalConfigInstanceId ccipOwner - let rmnRemoteAddr = RawInstanceAddress.make rmnInstanceId rmnOwner - let tokenAdminRegistryAddr = RawInstanceAddress.make tokenAdminRegistryInstanceId ccipOwner - let offRampAddr = RawInstanceAddress.make offRampInstanceId ccipOwner + let globalConfigAddr = Chainlink.InstanceAddress.make globalConfigInstanceId ccipOwner + let rmnRemoteAddr = Chainlink.InstanceAddress.make rmnInstanceId rmnOwner + let tokenAdminRegistryAddr = Chainlink.InstanceAddress.make tokenAdminRegistryInstanceId ccipOwner + let offRampAddr = Chainlink.InstanceAddress.make offRampInstanceId ccipOwner offRampCid <- submit ccipOwner do - createCmd CCIP.OffRamp.OffRamp with + createCmd CCIP.RuntimeV1.OffRamp.OffRamp with instanceId = offRampInstanceId ccipOwner = ccipOwner - deps = CCIP.OffRampTypes.OffRampDeps with + deps = CCIP.RuntimeV1.OffRamp.OffRampDeps with globalConfig = globalConfigAddr rmnRemote = rmnRemoteAddr tokenAdminRegistry = tokenAdminRegistryAddr routerCid <- submit ccipOwner do - createCmd CCIP.PerPartyRouter.PerPartyRouter with + createCmd CCIP.RuntimeV1.PerPartyRouter.PerPartyRouter with instanceId = routerInstanceId ccipOwner = ccipOwner partyOwner = receiver - deps = CCIP.PerPartyRouterTypes.PerPartyRouterDeps with - onRamp = RawInstanceAddress.make "unused-onramp-rrc-defaults" ccipOwner + deps = CCIP.RuntimeV1.PerPartyRouter.PerPartyRouterDeps with + onRamp = Chainlink.InstanceAddress.make "unused-onramp-rrc-defaults" ccipOwner offRamp = offRampAddr globalConfig = globalConfigAddr tokenAdminRegistry = tokenAdminRegistryAddr - feeQuoter = RawInstanceAddress.make "unused-feequoter-rrc-defaults" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "unused-feequoter-rrc-defaults" ccipOwner rmnRemote = rmnRemoteAddr outboundSequenceNumbers = Map.empty executedMessages = Set.empty @@ -283,24 +285,24 @@ testReceiverGetRequiredCCVsDoesNotInjectPoolDefaultsForMessageOnly = script do requiredCCVs = [receiverCcv] optionalCCVs = [] optionalThreshold = 0 - receiverFinalityConfig = CCIP.FinalityConfig.WaitForFinality + receiverFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = sourceChainSelector destChainSelector = destChainSelector sequenceNumber = 1.0 executionGasLimit = 0 ccipReceiveGasLimit = 100000 - finality = CCIP.FinalityConfig.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" - offRampAddress = RawInstanceAddress.toInstanceAddress offRampAddr + offRampAddress = Chainlink.InstanceAddress.toInstanceAddress offRampAddr sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - let encodedMessage = CCIP.MessageCodecV1.encodeMessageV1 message + let encodedMessage = CCIP.CodecV1.MessageCodecV1.encodeMessageV1 message let context = mkContext rmnRemoteCid tokenAdminRegistryCid globalConfigCid offRampCid disclosedOffRamp <- fromSome <$> queryDisclosure ccipOwner offRampCid @@ -311,12 +313,12 @@ testReceiverGetRequiredCCVsDoesNotInjectPoolDefaultsForMessageOnly = script do helperRequired <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig) do exerciseCmd receiverCid CCIP.CCIPReceiver.GetRequiredCCVs with context = context - routerCid = routerCid + routerCid = coerceContractId routerCid encodedMessage = encodedMessage tokenPoolCid = None executingMessageCid <- submit (actAs receiver <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do - exerciseCmd routerCid CCIP.PerPartyRouter.PrepareExecute with + exerciseCmd routerCid CCIP.RuntimeV1.PerPartyRouter.PrepareExecute with context = context encodedMessage = encodedMessage receiverParty = receiver @@ -324,7 +326,7 @@ testReceiverGetRequiredCCVsDoesNotInjectPoolDefaultsForMessageOnly = script do receiverRequiredCCVs = [receiverCcv] receiverOptionalCCVs = [] receiverOptionalThreshold = 0 - receiverFinalityConfig = CCIP.FinalityConfig.WaitForFinality + receiverFinalityConfig = CCIP.CodecV1.FinalityConfig.WaitForFinality caller = receiver executingMessage <- fromSome <$> queryContractId ccipOwner executingMessageCid @@ -335,35 +337,35 @@ testMergeInboundPoolCCVsUsesDefaultsForEmpty : Script () testMergeInboundPoolCCVsUsesDefaultsForEmpty = script do ownerA <- allocateParty "merge-default-owner-a" ownerB <- allocateParty "merge-default-owner-b" - let default1 = RawInstanceAddress.make "default-1" ownerA - let default2 = RawInstanceAddress.make "default-2" ownerB - let required0 = [RawInstanceAddress.make "required-0" ownerA] - let optional0 = [default1, RawInstanceAddress.make "optional-1" ownerB] + let default1 = Chainlink.InstanceAddress.make "default-1" ownerA + let default2 = Chainlink.InstanceAddress.make "default-2" ownerB + let required0 = [Chainlink.InstanceAddress.make "required-0" ownerA] + let optional0 = [default1, Chainlink.InstanceAddress.make "optional-1" ownerB] let (required1, optional1, threshold1) = - CCIP.Internal.mergeInboundPoolCCVs + CCIP.CodecV1.CCVCodec.mergeInboundPoolCCVs [default1, default2] required0 optional0 1 [] sort required1 === sort (required0 ++ [default1, default2]) - sort optional1 === sort [RawInstanceAddress.make "optional-1" ownerB] + sort optional1 === sort [Chainlink.InstanceAddress.make "optional-1" ownerB] threshold1 === 0 testMergeInboundPoolCCVsExpandsSentinel : Script () testMergeInboundPoolCCVsExpandsSentinel = script do ownerA <- allocateParty "merge-sentinel-owner-a" ownerB <- allocateParty "merge-sentinel-owner-b" - let default1 = RawInstanceAddress.make "default-s-1" ownerA - let explicitPool = RawInstanceAddress.make "pool-explicit" ownerB - let required0 = [RawInstanceAddress.make "required-s-0" ownerA] + let default1 = Chainlink.InstanceAddress.make "default-s-1" ownerA + let explicitPool = Chainlink.InstanceAddress.make "pool-explicit" ownerB + let required0 = [Chainlink.InstanceAddress.make "required-s-0" ownerA] let (required1, optional1, threshold1) = - CCIP.Internal.mergeInboundPoolCCVs + CCIP.CodecV1.CCVCodec.mergeInboundPoolCCVs [default1] required0 [] 0 - [CCIP.Internal.useDefaultCCVs, explicitPool] + [CCIP.CodecV1.CCVCodec.useDefaultCCVs, explicitPool] sort required1 === sort (required0 ++ [default1, explicitPool]) optional1 === [] threshold1 === 0 diff --git a/contracts/ccip/test/daml/SendingMessageV1Test.daml b/contracts/ccip/test/daml/SendingMessageTest.daml similarity index 62% rename from contracts/ccip/test/daml/SendingMessageV1Test.daml rename to contracts/ccip/test/daml/SendingMessageTest.daml index 087a12e84..d2a59f2e6 100644 --- a/contracts/ccip/test/daml/SendingMessageV1Test.daml +++ b/contracts/ccip/test/daml/SendingMessageTest.daml @@ -1,13 +1,16 @@ -module SendingMessageV1Test where +module SendingMessageTest where import Daml.Script import DA.Assert ((===)) import DA.Either (isLeft) -import qualified CCIP.SendingMessageV1 -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import Splice.Api.Token.HoldingV1 qualified as HoldingV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CoreV1.SendingMessage -- | Two CCVs with the same instance id but different owners can both record verifier data. testDistinctCcvOwnersWithSameInstanceId : Script () @@ -17,20 +20,20 @@ testDistinctCcvOwnersWithSameInstanceId = script do ccvOwnerB <- allocateParty "ccv-owner-b-vdi" let destChainSelector : Numeric 0 = 456.0 - let ccvA = RawInstanceAddress.make "shared-ccv-id" ccvOwnerA - let ccvB = RawInstanceAddress.make "shared-ccv-id" ccvOwnerB - let feeToken = HoldingV1.InstrumentId with admin = ccipOwner; id = "feeToken" - - let deps = CCIP.SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-vdi" ccipOwner - onRamp = RawInstanceAddress.make "onramp-vdi" ccipOwner - globalConfig = RawInstanceAddress.make "globalconfig-vdi" ccipOwner - rmnRemote = RawInstanceAddress.make "rmn-vdi" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "tar-vdi" ccipOwner - feeQuoter = RawInstanceAddress.make "feequoter-vdi" ccipOwner + let ccvA = Chainlink.InstanceAddress.make "shared-ccv-id" ccvOwnerA + let ccvB = Chainlink.InstanceAddress.make "shared-ccv-id" ccvOwnerB + let feeToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner; id = "feeToken" + + let deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-vdi" ccipOwner + onRamp = Chainlink.InstanceAddress.make "onramp-vdi" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-vdi" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-vdi" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-vdi" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "feequoter-vdi" ccipOwner sendingMessageCid <- submit ccipOwner do - createCmd CCIP.SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with deps = deps ccipOwner = ccipOwner sender = ccipOwner @@ -41,7 +44,7 @@ testDistinctCcvOwnersWithSameInstanceId = script do requiredCCVs = [ccvA, ccvB] requiredExecutor = None executorAddress = "0000000000000000000000000000000000000000000000000000000000000000" - executionMode = Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = "" receiver = "80adbb5ae1b4e8301bc3dd02aa0b7a0d6daeb2c7" @@ -56,6 +59,7 @@ testDistinctCcvOwnersWithSameInstanceId = script do feeToken = feeToken networkFeeUSDCents = 0.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -74,26 +78,28 @@ testDistinctCcvOwnersWithSameInstanceId = script do message = None encodedMessage = "" messageId = "" - state = CCIP.SendingMessageV1.SendingMessageState_FeeFinalized + state = CCIP.CoreV1.SendingMessage.SendingMessageState_FeeFinalized sendingMessageCid <- submit ccipOwner do - exerciseCmd sendingMessageCid CCIP.SendingMessageV1.BuildMessage with - caller = ccipOwner + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.BuildMessage with + context = Splice.Api.Token.MetadataV1.emptyChoiceContext sendingMessageCid <- submit (actAs ccvOwnerA) do - exerciseCmd sendingMessageCid CCIP.SendingMessageV1.AddVerifierData with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddVerifierData with ccvInstanceId = "shared-ccv-id" versionTag = "00000001" verifierBlob = "aaaa" messageSentObservers = [] + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwnerA sendingMessageCid <- submit (actAs ccvOwnerB) do - exerciseCmd sendingMessageCid CCIP.SendingMessageV1.AddVerifierData with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddVerifierData with ccvInstanceId = "shared-ccv-id" versionTag = "00000002" verifierBlob = "bbbb" messageSentObservers = [] + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwnerB Some sm <- queryContractId ccipOwner sendingMessageCid @@ -108,20 +114,20 @@ testSameOwnerDistinctInstanceIds = script do ccvOwner <- allocateParty "ccv-owner-sodi" let destChainSelector : Numeric 0 = 456.0 - let ccvA = RawInstanceAddress.make "ccv-id-1" ccvOwner - let ccvB = RawInstanceAddress.make "ccv-id-2" ccvOwner - let feeToken = HoldingV1.InstrumentId with admin = ccipOwner; id = "feeToken" - - let deps = CCIP.SendingMessageV1.SendingMessageDeps with - router = RawInstanceAddress.make "router-sodi" ccipOwner - onRamp = RawInstanceAddress.make "onramp-sodi" ccipOwner - globalConfig = RawInstanceAddress.make "globalconfig-sodi" ccipOwner - rmnRemote = RawInstanceAddress.make "rmn-sodi" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "tar-sodi" ccipOwner - feeQuoter = RawInstanceAddress.make "feequoter-sodi" ccipOwner + let ccvA = Chainlink.InstanceAddress.make "ccv-id-1" ccvOwner + let ccvB = Chainlink.InstanceAddress.make "ccv-id-2" ccvOwner + let feeToken = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner; id = "feeToken" + + let deps = CCIP.CoreV1.SendingMessage.SendingMessageDeps with + router = Chainlink.InstanceAddress.make "router-sodi" ccipOwner + onRamp = Chainlink.InstanceAddress.make "onramp-sodi" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "globalconfig-sodi" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "rmn-sodi" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "tar-sodi" ccipOwner + feeQuoter = Chainlink.InstanceAddress.make "feequoter-sodi" ccipOwner sendingMessageCid <- submit ccipOwner do - createCmd CCIP.SendingMessageV1.SendingMessageV1 with + createCmd CCIP.CoreV1.SendingMessage.SendingMessage with deps = deps ccipOwner = ccipOwner sender = ccipOwner @@ -132,7 +138,7 @@ testSameOwnerDistinctInstanceIds = script do requiredCCVs = [ccvA, ccvB] requiredExecutor = None executorAddress = "0000000000000000000000000000000000000000000000000000000000000000" - executionMode = Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor + executionMode = Some CCIP.CoreV1.SendingMessage.ExecutionMode_NoExecutor sourceChainSelector = 123.0 senderAddress = "" receiver = "842bfeb3bcb6ec81ceaec55cf9a0e9db5eb77be0" @@ -147,6 +153,7 @@ testSameOwnerDistinctInstanceIds = script do feeToken = feeToken networkFeeUSDCents = 0.0 expectedTokenInstrumentId = None + tokenAmountBeforeTokenPoolFees = 0.0 outboundPoolCCVs = None executorArgs = "" executorFee = None @@ -165,22 +172,24 @@ testSameOwnerDistinctInstanceIds = script do message = None encodedMessage = "" messageId = "" - state = CCIP.SendingMessageV1.SendingMessageState_Prepared + state = CCIP.CoreV1.SendingMessage.SendingMessageState_Prepared sendingMessageCid <- submit (actAs ccvOwner) do - exerciseCmd sendingMessageCid CCIP.SendingMessageV1.AddCCVFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddCCVFee with ccvInstanceId = "ccv-id-1" feeUSDCents = 0.0 destGasLimit = 0 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner sendingMessageCid <- submit (actAs ccvOwner) do - exerciseCmd sendingMessageCid CCIP.SendingMessageV1.AddCCVFee with + exerciseCmd sendingMessageCid CCIP.CoreV1.SendingMessage.AddCCVFee with ccvInstanceId = "ccv-id-2" feeUSDCents = 0.0 destGasLimit = 0 destBytesOverhead = 0 + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner Some sm <- queryContractId ccipOwner sendingMessageCid @@ -193,49 +202,49 @@ testValidateDestChainAddress = do -- In: 20 bytes, unpadded -- Out: 20 bytes, unpadded let addr = "c31ea3de7f6eff3f70c3bfda0c4c4aabbea2c1b3" - CCIP.SendingMessageV1.validateDestChainAddress addr 20 === addr + CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 20 === addr -- In: 21 bytes, unpadded -- Out: 21 bytes, unpadded let addr = "1898a4923b1bfc6dbdf6debb1fbe6adabcf227caef" - CCIP.SendingMessageV1.validateDestChainAddress addr 21 === addr + CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 21 === addr -- In: 30 bytes, unpadded -- Out: 30 bytes, unpadded let addr = "12ee197fd1e17f73ed3f6bed10a676aff0d852fe271fbad6fc85c267fcf1" - CCIP.SendingMessageV1.validateDestChainAddress addr 30 === addr + CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 30 === addr -- In: 32 bytes, unpadded -- Out: 32 bytes, unpadded let addr = "12ee197fd1e17f73ed3f6bed10a676aff0d852fe271fbad6fc85c267fcf1e2c3" - CCIP.SendingMessageV1.validateDestChainAddress addr 32 === addr + CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 32 === addr -- In: 20 bytes, padded to 32 bytes -- Out: 20 bytes, unpadded let addr = "000000000000000000000000135de120c28b8bfacbeb1cfdce3cc743b5f98dfb" - CCIP.SendingMessageV1.validateDestChainAddress addr 20 === "135de120c28b8bfacbeb1cfdce3cc743b5f98dfb" + CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 20 === "135de120c28b8bfacbeb1cfdce3cc743b5f98dfb" -- In: 21 bytes, padded to 32 bytes -- Out: 21 bytes, unpadded let addr = "00000000000000000000001898a4923b1bfc6dbdf6debb1fbe6adabcf227caef" - CCIP.SendingMessageV1.validateDestChainAddress addr 21 === "1898a4923b1bfc6dbdf6debb1fbe6adabcf227caef" + CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 21 === "1898a4923b1bfc6dbdf6debb1fbe6adabcf227caef" -- In: 20 bytes, padded to 30 bytes -- Out: 20 bytes, padded to 30 bytes (no trimming, only trims if input is 32 bytes) let addr = "00000000000000000000aa6a78ecec748d11d2b179ac19c0d8fdc4c8e5dc" - CCIP.SendingMessageV1.validateDestChainAddress addr 30 === addr + CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 30 === addr -- Invalid - invalid hex let addr = "00000000000000000000001898a4923b1bfc6dbdf6debb1fbe6adabcf227caeg" - result <- tryToEither (\() -> pure (CCIP.SendingMessageV1.validateDestChainAddress addr 20)) + result <- tryToEither (\() -> pure (CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 20)) isLeft result === True -- Invalid - 32-byte address with 20-byte addressBytesLength let addr = "4ffd0dccc767ffbcdcdd2450cf3a766f02ada5a3b23eada4fec7bbb94dbd7acf" - result <- tryToEither (\() -> pure (CCIP.SendingMessageV1.validateDestChainAddress addr 20)) + result <- tryToEither (\() -> pure (CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 20)) isLeft result === True -- Invalid - 30-byte address with 20-byte addressBytesLength let addr = "00000000000000000000aa6a78ecec748d11d2b179ac19c0d8fdc4c8e5dc" - result <- tryToEither (\() -> pure (CCIP.SendingMessageV1.validateDestChainAddress addr 20)) + result <- tryToEither (\() -> pure (CCIP.CoreV1.SendingMessage.validateDestChainAddress addr 20)) isLeft result === True diff --git a/contracts/ccip/test/daml/TestToken.daml b/contracts/ccip/test/daml/TestToken.daml index 81d3dd3e3..0556a42d2 100644 --- a/contracts/ccip/test/daml/TestToken.daml +++ b/contracts/ccip/test/daml/TestToken.daml @@ -7,10 +7,10 @@ import DA.Action (foldlA) import DA.Optional (fromOptional) import DA.TextMap qualified as TextMap -import Splice.Api.Token.BurnMintV1 qualified as BurnMintV1 -import Splice.Api.Token.HoldingV1 qualified as HoldingV1 -import Splice.Api.Token.MetadataV1 qualified as MetadataV1 -import Splice.Api.Token.TransferInstructionV1 qualified as TransferV1 +import qualified Splice.Api.Token.BurnMintV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 +import qualified Splice.Api.Token.TransferInstructionV1 -- | Token holding template (like Amulet but simplified). -- No expiry, no fees - just a simple UTXO holding. @@ -18,18 +18,18 @@ template TestHolding with owner : Party admin : Party -- Registry admin (like DSO in Canton Coin) - instrumentId : HoldingV1.InstrumentId + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId amount : Decimal where signatory owner, admin - interface instance HoldingV1.Holding for TestHolding where - view = HoldingV1.HoldingView with + interface instance Splice.Api.Token.HoldingV1.Holding for TestHolding where + view = Splice.Api.Token.HoldingV1.HoldingView with owner instrumentId amount lock = None - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata -- | Holding fixture for malicious backend tests. The viewed owner does not need -- to be a signatory, which lets tests model a bad token backend returning @@ -38,19 +38,19 @@ template BadHolding with admin : Party owner : Party - instrumentId : HoldingV1.InstrumentId + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId amount : Decimal where signatory admin observer owner - interface instance HoldingV1.Holding for BadHolding where - view = HoldingV1.HoldingView with + interface instance Splice.Api.Token.HoldingV1.Holding for BadHolding where + view = Splice.Api.Token.HoldingV1.HoldingView with owner instrumentId amount lock = None - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata -- | Transfer Preapproval (like Canton Coin's TransferPreapproval). -- Receiver + admin create this to allow ANY sender to send tokens directly. @@ -63,12 +63,12 @@ template TestTransferPreapproval -- Direct send to receiver (like TransferPreapproval_Send). -- Controller is SENDER - any party can send if receiver has preapproved. - nonconsuming choice Send : TransferV1.TransferInstructionResult + nonconsuming choice Send : Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with sender : Party amount : Decimal - instrumentId : HoldingV1.InstrumentId - inputHoldingCids : [ContractId HoldingV1.Holding] + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId + inputHoldingCids : [ContractId Splice.Api.Token.HoldingV1.Holding] controller sender do -- Sum and validate inputs @@ -84,29 +84,29 @@ template TestTransferPreapproval let change = inputTotal - amount senderChangeCids <- createChangeIfNeeded admin sender instrumentId change - pure TransferV1.TransferInstructionResult with + pure Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with senderChangeCids - output = TransferV1.TransferInstructionResult_Completed with + output = Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Completed with receiverHoldingCids = [toInterfaceContractId receiverCid] - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata -- | Pending Transfer Instruction (like AmuletTransferInstruction). -- Created when receiver doesn't have preapproval. template TestTransferInstruction with admin : Party - transfer : TransferV1.Transfer + transfer : Splice.Api.Token.TransferInstructionV1.Transfer lockedHoldingCid : ContractId TestHolding -- Sender's funds locked pending acceptance where signatory admin, transfer.sender observer transfer.receiver - interface instance TransferV1.TransferInstruction for TestTransferInstruction where - view = TransferV1.TransferInstructionView with + interface instance Splice.Api.Token.TransferInstructionV1.TransferInstruction for TestTransferInstruction where + view = Splice.Api.Token.TransferInstructionV1.TransferInstructionView with originalInstructionCid = None transfer - status = TransferV1.TransferPendingReceiverAcceptance - meta = MetadataV1.emptyMetadata + status = Splice.Api.Token.TransferInstructionV1.TransferPendingReceiverAcceptance + meta = Splice.Api.Token.MetadataV1.emptyMetadata -- Receiver accepts: unlock and transfer transferInstruction_acceptImpl _self _arg = do @@ -120,11 +120,11 @@ template TestTransferInstruction instrumentId = transfer.instrumentId amount = transfer.amount - pure TransferV1.TransferInstructionResult with + pure Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with senderChangeCids = [] -- Change was already returned when instruction created - output = TransferV1.TransferInstructionResult_Completed with + output = Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Completed with receiverHoldingCids = [toInterfaceContractId receiverCid] - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata -- Receiver rejects: return funds to sender transferInstruction_rejectImpl _self _arg = do @@ -138,10 +138,10 @@ template TestTransferInstruction instrumentId = transfer.instrumentId amount = lockedHolding.amount - pure TransferV1.TransferInstructionResult with + pure Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with senderChangeCids = [toInterfaceContractId senderCid] - output = TransferV1.TransferInstructionResult_Failed - meta = MetadataV1.emptyMetadata + output = Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Failed + meta = Splice.Api.Token.MetadataV1.emptyMetadata -- Sender withdraws: return funds transferInstruction_withdrawImpl _self _arg = do @@ -154,25 +154,25 @@ template TestTransferInstruction instrumentId = transfer.instrumentId amount = lockedHolding.amount - pure TransferV1.TransferInstructionResult with + pure Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with senderChangeCids = [toInterfaceContractId senderCid] - output = TransferV1.TransferInstructionResult_Failed - meta = MetadataV1.emptyMetadata + output = Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Failed + meta = Splice.Api.Token.MetadataV1.emptyMetadata transferInstruction_updateImpl _self _arg = abort "TestTransferInstruction: update not supported" -- Looks up the preapproval CID from extraArgs.context keyed by show(receiver). -- Callers pass preapprovals via feeTokenExtraArgs.context (CCIPSend) or via the --- transfer-factory-extra-args-context-values entry in the pool extraContext (LockOrBurn). +-- transfer-factory-extra-args-context-values entry in the pool's context (LockOrBurn). template TestTransferFactory with admin : Party where signatory admin - interface instance TransferV1.TransferFactory for TestTransferFactory where - view = TransferV1.TransferFactoryView with admin, meta = MetadataV1.emptyMetadata + interface instance Splice.Api.Token.TransferInstructionV1.TransferFactory for TestTransferFactory where + view = Splice.Api.Token.TransferInstructionV1.TransferFactoryView with admin, meta = Splice.Api.Token.MetadataV1.emptyMetadata transferFactory_transferImpl _self arg = do let transfer = arg.transfer @@ -181,7 +181,7 @@ template TestTransferFactory -- Check if this is a self-transfer or has preapproval let isSelfTransfer = transfer.sender == transfer.receiver let preapprovalOpt = case TextMap.lookup (show transfer.receiver) arg.extraArgs.context.values of - Some (MetadataV1.AV_ContractId cid) -> Some (coerceContractId cid : ContractId TestTransferPreapproval) + Some (Splice.Api.Token.MetadataV1.AV_ContractId cid) -> Some (coerceContractId cid : ContractId TestTransferPreapproval) _ -> None case (isSelfTransfer, preapprovalOpt) of @@ -200,22 +200,22 @@ template TestTransferFactory (False, None) -> createPendingTransfer admin transfer transferFactory_publicFetchImpl _self _arg = - pure (view (toInterface @TransferV1.TransferFactory this)) + pure (view (toInterface @Splice.Api.Token.TransferInstructionV1.TransferFactory this)) template BadTransferInstruction with admin : Party - transfer : TransferV1.Transfer + transfer : Splice.Api.Token.TransferInstructionV1.Transfer where signatory admin observer transfer.sender, transfer.receiver - interface instance TransferV1.TransferInstruction for BadTransferInstruction where - view = TransferV1.TransferInstructionView with + interface instance Splice.Api.Token.TransferInstructionV1.TransferInstruction for BadTransferInstruction where + view = Splice.Api.Token.TransferInstructionV1.TransferInstructionView with originalInstructionCid = None transfer - status = TransferV1.TransferPendingReceiverAcceptance - meta = MetadataV1.emptyMetadata + status = Splice.Api.Token.TransferInstructionV1.TransferPendingReceiverAcceptance + meta = Splice.Api.Token.MetadataV1.emptyMetadata transferInstruction_acceptImpl _self _arg = abort "BadTransferInstruction: accept not supported" @@ -233,14 +233,14 @@ template BadTransferFactory with admin : Party completedOwner : Optional Party - completedInstrumentId : Optional HoldingV1.InstrumentId + completedInstrumentId : Optional Splice.Api.Token.HoldingV1.InstrumentId completedAmount : Optional Decimal - pendingTransfer : Optional TransferV1.Transfer + pendingTransfer : Optional Splice.Api.Token.TransferInstructionV1.Transfer where signatory admin - interface instance TransferV1.TransferFactory for BadTransferFactory where - view = TransferV1.TransferFactoryView with admin, meta = MetadataV1.emptyMetadata + interface instance Splice.Api.Token.TransferInstructionV1.TransferFactory for BadTransferFactory where + view = Splice.Api.Token.TransferInstructionV1.TransferFactoryView with admin, meta = Splice.Api.Token.MetadataV1.emptyMetadata transferFactory_transferImpl _self arg = do assertMsg "BadTransferFactory: expectedAdmin mismatch" (arg.expectedAdmin == admin) @@ -250,30 +250,30 @@ template BadTransferFactory instrCid <- create BadTransferInstruction with admin transfer = pending - pure TransferV1.TransferInstructionResult with + pure Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with senderChangeCids = [] - output = TransferV1.TransferInstructionResult_Pending with + output = Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Pending with transferInstructionCid = toInterfaceContractId instrCid - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata None -> do receiverCid <- create BadHolding with admin owner = fromOptional transfer.receiver completedOwner instrumentId = fromOptional transfer.instrumentId completedInstrumentId amount = fromOptional transfer.amount completedAmount - pure TransferV1.TransferInstructionResult with + pure Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with senderChangeCids = [] - output = TransferV1.TransferInstructionResult_Completed with + output = Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Completed with receiverHoldingCids = [toInterfaceContractId receiverCid] - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata transferFactory_publicFetchImpl _self _arg = - pure (view (toInterface @TransferV1.TransferFactory this)) + pure (view (toInterface @Splice.Api.Token.TransferInstructionV1.TransferFactory this)) data BadBurnMintOutput = BadBurnMintOutput with owner : Party - instrumentId : HoldingV1.InstrumentId + instrumentId : Splice.Api.Token.HoldingV1.InstrumentId amount : Decimal deriving (Eq, Show) @@ -284,8 +284,8 @@ template BadBurnMintFactory where signatory admin - interface instance BurnMintV1.BurnMintFactory for BadBurnMintFactory where - view = BurnMintV1.BurnMintFactoryView with admin, meta = MetadataV1.emptyMetadata + interface instance Splice.Api.Token.BurnMintV1.BurnMintFactory for BadBurnMintFactory where + view = Splice.Api.Token.BurnMintV1.BurnMintFactoryView with admin, meta = Splice.Api.Token.MetadataV1.emptyMetadata burnMintFactory_burnMintImpl _self arg = do assertMsg "BadBurnMintFactory: expectedAdmin mismatch" (arg.expectedAdmin == admin) @@ -299,14 +299,14 @@ template BadBurnMintFactory pure (acc ++ [toInterfaceContractId cid])) [] outputs - pure BurnMintV1.BurnMintFactory_BurnMintResult with + pure Splice.Api.Token.BurnMintV1.BurnMintFactory_BurnMintResult with outputCids burnMintFactory_publicFetchImpl _self _arg = - pure (view (toInterface @BurnMintV1.BurnMintFactory this)) + pure (view (toInterface @Splice.Api.Token.BurnMintV1.BurnMintFactory this)) -- Helper: Sum inputs, validate ownership/instrument, and archive them. -sumAndArchiveInputs : Party -> Party -> HoldingV1.InstrumentId -> [ContractId HoldingV1.Holding] -> Update Decimal +sumAndArchiveInputs : Party -> Party -> Splice.Api.Token.HoldingV1.InstrumentId -> [ContractId Splice.Api.Token.HoldingV1.Holding] -> Update Decimal sumAndArchiveInputs admin sender instrumentId cids = foldlA (\acc cid -> do @@ -320,7 +320,7 @@ sumAndArchiveInputs admin sender instrumentId cids = cids -- Helper: Create change holding if amount > 0. -createChangeIfNeeded : Party -> Party -> HoldingV1.InstrumentId -> Decimal -> Update [ContractId HoldingV1.Holding] +createChangeIfNeeded : Party -> Party -> Splice.Api.Token.HoldingV1.InstrumentId -> Decimal -> Update [ContractId Splice.Api.Token.HoldingV1.Holding] createChangeIfNeeded admin owner instrumentId change = if change > 0.0 then do @@ -329,7 +329,7 @@ createChangeIfNeeded admin owner instrumentId change = else pure [] -- Helper: Execute direct self-transfer. -executeDirect : Party -> TransferV1.Transfer -> Update TransferV1.TransferInstructionResult +executeDirect : Party -> Splice.Api.Token.TransferInstructionV1.Transfer -> Update Splice.Api.Token.TransferInstructionV1.TransferInstructionResult executeDirect admin transfer = do inputTotal <- sumAndArchiveInputs admin transfer.sender transfer.instrumentId transfer.inputHoldingCids assertMsg "insufficient input" (inputTotal >= transfer.amount) @@ -339,14 +339,14 @@ executeDirect admin transfer = do senderChangeCids <- createChangeIfNeeded admin transfer.sender transfer.instrumentId (inputTotal - transfer.amount) - pure TransferV1.TransferInstructionResult with + pure Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with senderChangeCids - output = TransferV1.TransferInstructionResult_Completed with + output = Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Completed with receiverHoldingCids = [toInterfaceContractId receiverCid] - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata -- Helper: Create pending transfer instruction when no preapproval. -createPendingTransfer : Party -> TransferV1.Transfer -> Update TransferV1.TransferInstructionResult +createPendingTransfer : Party -> Splice.Api.Token.TransferInstructionV1.Transfer -> Update Splice.Api.Token.TransferInstructionV1.TransferInstructionResult createPendingTransfer admin transfer = do inputTotal <- sumAndArchiveInputs admin transfer.sender transfer.instrumentId transfer.inputHoldingCids assertMsg "insufficient input" (inputTotal >= transfer.amount) @@ -364,8 +364,8 @@ createPendingTransfer admin transfer = do -- Create pending instruction instrCid <- create TestTransferInstruction with admin, transfer, lockedHoldingCid = lockedCid - pure TransferV1.TransferInstructionResult with + pure Splice.Api.Token.TransferInstructionV1.TransferInstructionResult with senderChangeCids - output = TransferV1.TransferInstructionResult_Pending with + output = Splice.Api.Token.TransferInstructionV1.TransferInstructionResult_Pending with transferInstructionCid = toInterfaceContractId instrCid - meta = MetadataV1.emptyMetadata + meta = Splice.Api.Token.MetadataV1.emptyMetadata diff --git a/contracts/ccip/test/daml/Uint256Test.daml b/contracts/ccip/test/daml/Uint256Test.daml index 4de75ff54..892d0a6f5 100644 --- a/contracts/ccip/test/daml/Uint256Test.daml +++ b/contracts/ccip/test/daml/Uint256Test.daml @@ -6,7 +6,7 @@ import DA.Assert import DA.Crypto.Text (byteCount) import DA.Optional -import CCIP.Uint256 qualified as Uint256 +import CCIP.CodecV1.Uint256 maxUint256Hex : Text maxUint256Hex = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" @@ -23,35 +23,35 @@ oneAboveMaxNumeric0Hex = "000000000000000000000000000000004b3b4ca85a86c47a098a22 -- Unit tests for exact uint256 decimal text <-> 32-byte wire conversion. testUint256_DecimalTextToBytes_Vectors : Script () testUint256_DecimalTextToBytes_Vectors = script do - Uint256.decimalTextToUint256Bytes "0" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "0" === Some "0000000000000000000000000000000000000000000000000000000000000000" - Uint256.decimalTextToUint256Bytes "000000" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "000000" === Some "0000000000000000000000000000000000000000000000000000000000000000" - Uint256.decimalTextToUint256Bytes "1" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "1" === Some "0000000000000000000000000000000000000000000000000000000000000001" - Uint256.decimalTextToUint256Bytes "15" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "15" === Some "000000000000000000000000000000000000000000000000000000000000000f" - Uint256.decimalTextToUint256Bytes "16" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "16" === Some "0000000000000000000000000000000000000000000000000000000000000010" - Uint256.decimalTextToUint256Bytes "255" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "255" === Some "00000000000000000000000000000000000000000000000000000000000000ff" - Uint256.decimalTextToUint256Bytes "256" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "256" === Some "0000000000000000000000000000000000000000000000000000000000000100" - Uint256.decimalTextToUint256Bytes "1000000000000000000" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "1000000000000000000" === Some "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - Uint256.decimalTextToUint256Bytes Uint256.maxNumeric0DecimalText + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes CCIP.CodecV1.Uint256.maxNumeric0DecimalText === Some maxNumeric0Hex - Uint256.decimalTextToUint256Bytes oneAboveMaxNumeric0Text + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes oneAboveMaxNumeric0Text === Some oneAboveMaxNumeric0Hex - Uint256.decimalTextToUint256Bytes Uint256.maxUint256DecimalText + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes CCIP.CodecV1.Uint256.maxUint256DecimalText === Some maxUint256Hex assertMsg "all encoded uint256 vectors must be 32 bytes" (all (\hex -> byteCount hex == 32) - [ fromSome (Uint256.decimalTextToUint256Bytes "0") - , fromSome (Uint256.decimalTextToUint256Bytes "1") - , fromSome (Uint256.decimalTextToUint256Bytes "1000000000000000000") - , fromSome (Uint256.decimalTextToUint256Bytes Uint256.maxUint256DecimalText) + [ fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "0") + , fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "1") + , fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "1000000000000000000") + , fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes CCIP.CodecV1.Uint256.maxUint256DecimalText) ]) debug "testUint256_DecimalTextToBytes_Vectors: PASSED" @@ -59,100 +59,100 @@ testUint256_DecimalTextToBytes_Vectors = script do -- Unit tests for 32-byte wire uint256 -> exact decimal text conversion. testUint256_BytesToDecimalText_Vectors : Script () testUint256_BytesToDecimalText_Vectors = script do - Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000000000000000000" + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000000000000000000" === Some "0" - Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000000000000000001" + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000000000000000001" === Some "1" - Uint256.uint256BytesToDecimalText "000000000000000000000000000000000000000000000000000000000000000f" + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "000000000000000000000000000000000000000000000000000000000000000f" === Some "15" - Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000000000000000010" + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000000000000000010" === Some "16" - Uint256.uint256BytesToDecimalText "00000000000000000000000000000000000000000000000000000000000000ff" + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "00000000000000000000000000000000000000000000000000000000000000ff" === Some "255" - Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000000000000000100" + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000000000000000100" === Some "256" - Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "0000000000000000000000000000000000000000000000000de0b6b3a7640000" === Some "1000000000000000000" - Uint256.uint256BytesToDecimalText maxNumeric0Hex - === Some Uint256.maxNumeric0DecimalText - Uint256.uint256BytesToDecimalText oneAboveMaxNumeric0Hex + CCIP.CodecV1.Uint256.uint256BytesToDecimalText maxNumeric0Hex + === Some CCIP.CodecV1.Uint256.maxNumeric0DecimalText + CCIP.CodecV1.Uint256.uint256BytesToDecimalText oneAboveMaxNumeric0Hex === Some oneAboveMaxNumeric0Text - Uint256.uint256BytesToDecimalText maxUint256Hex - === Some Uint256.maxUint256DecimalText - Uint256.uint256BytesToDecimalText "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" - === Some Uint256.maxUint256DecimalText + CCIP.CodecV1.Uint256.uint256BytesToDecimalText maxUint256Hex + === Some CCIP.CodecV1.Uint256.maxUint256DecimalText + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" + === Some CCIP.CodecV1.Uint256.maxUint256DecimalText - Uint256.isUint256Bytes maxUint256Hex === True - Uint256.isUint256Bytes "00" === False - Uint256.isUint256Bytes (maxUint256Hex <> "00") === False - Uint256.uint256BytesToDecimalText "00" === None - Uint256.uint256BytesToDecimalText (maxUint256Hex <> "00") === None + CCIP.CodecV1.Uint256.isUint256Bytes maxUint256Hex === True + CCIP.CodecV1.Uint256.isUint256Bytes "00" === False + CCIP.CodecV1.Uint256.isUint256Bytes (maxUint256Hex <> "00") === False + CCIP.CodecV1.Uint256.uint256BytesToDecimalText "00" === None + CCIP.CodecV1.Uint256.uint256BytesToDecimalText (maxUint256Hex <> "00") === None debug "testUint256_BytesToDecimalText_Vectors: PASSED" -- Input validation should reject non-integer decimal text and uint256 overflow. testUint256_DecimalTextValidation : Script () testUint256_DecimalTextValidation = script do - Uint256.decimalTextToUint256Bytes "" === None - Uint256.decimalTextToUint256Bytes " " === None - Uint256.decimalTextToUint256Bytes "-1" === None - Uint256.decimalTextToUint256Bytes "+1" === None - Uint256.decimalTextToUint256Bytes "1.0" === None - Uint256.decimalTextToUint256Bytes "1_000" === None - Uint256.decimalTextToUint256Bytes "abc" === None - - Uint256.decimalTextToUint256Bytes Uint256.maxUint256DecimalText + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes " " === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "-1" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "+1" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "1.0" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "1_000" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "abc" === None + + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes CCIP.CodecV1.Uint256.maxUint256DecimalText === Some maxUint256Hex - Uint256.decimalTextToUint256Bytes (Uint256.maxUint256DecimalText <> "0") + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes (CCIP.CodecV1.Uint256.maxUint256DecimalText <> "0") === None - Uint256.decimalTextToUint256Bytes "115792089237316195423570985008687907853269984665640564039457584007913129639936" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "115792089237316195423570985008687907853269984665640564039457584007913129639936" === None - Uint256.decimalTextFitsNumeric0 "0" === True - Uint256.decimalTextFitsNumeric0 "000" === True - Uint256.decimalTextFitsNumeric0 Uint256.maxNumeric0DecimalText === True - Uint256.decimalTextFitsNumeric0 oneAboveMaxNumeric0Text === False - Uint256.decimalTextFitsNumeric0 Uint256.maxUint256DecimalText === False - Uint256.decimalTextFitsNumeric0 "-1" === False - Uint256.decimalTextFitsNumeric0 "1.0" === False + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 "0" === True + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 "000" === True + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 CCIP.CodecV1.Uint256.maxNumeric0DecimalText === True + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 oneAboveMaxNumeric0Text === False + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 CCIP.CodecV1.Uint256.maxUint256DecimalText === False + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 "-1" === False + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 "1.0" === False debug "testUint256_DecimalTextValidation: PASSED" -- Numeric 0 helper covers the Canton-originating outbound path. testUint256_Numeric0ToBytes : Script () testUint256_Numeric0ToBytes = script do - Uint256.numeric0ToUint256Bytes 0.0 + CCIP.CodecV1.Uint256.numeric0ToUint256Bytes 0.0 === Some "0000000000000000000000000000000000000000000000000000000000000000" - Uint256.numeric0ToUint256Bytes 1.0 + CCIP.CodecV1.Uint256.numeric0ToUint256Bytes 1.0 === Some "0000000000000000000000000000000000000000000000000000000000000001" - Uint256.numeric0ToUint256Bytes 1000000000000000000.0 + CCIP.CodecV1.Uint256.numeric0ToUint256Bytes 1000000000000000000.0 === Some "0000000000000000000000000000000000000000000000000de0b6b3a7640000" - Uint256.numeric0ToUint256Bytes 99999999999999999999999999999999999999.0 + CCIP.CodecV1.Uint256.numeric0ToUint256Bytes 99999999999999999999999999999999999999.0 === Some maxNumeric0Hex - Uint256.numeric0ToUint256Bytes (-1.0) === None + CCIP.CodecV1.Uint256.numeric0ToUint256Bytes (-1.0) === None debug "testUint256_Numeric0ToBytes: PASSED" -- Equal-decimal conversion preserves amount exactly and rejects values outside Numeric 0. testUint256_LocalConversion_EqualDecimals : Script () testUint256_LocalConversion_EqualDecimals = script do - let zero = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "zero" "0" 18 18) + let zero = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "zero" "0" 18 18) zero.localAmount === 0.0 zero.truncatedRemainder === "0" zero.wasTruncated === False - let normal = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "normal" "123456789" 6 6) + let normal = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "normal" "123456789" 6 6) normal.localAmount === 123456789.0 normal.truncatedRemainder === "0" normal.wasTruncated === False - let maxNumeric = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "max" Uint256.maxNumeric0DecimalText 18 18) + let maxNumeric = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "max" CCIP.CodecV1.Uint256.maxNumeric0DecimalText 18 18) maxNumeric.localAmount === 99999999999999999999999999999999999999.0 maxNumeric.wasTruncated === False - Uint256.calculateLocalAmountFromDecimalTextChecked "one-above" oneAboveMaxNumeric0Text 18 18 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "one-above" oneAboveMaxNumeric0Text 18 18 === None - Uint256.calculateLocalAmountFromDecimalTextChecked "above-uint256" (Uint256.maxUint256DecimalText <> "0") 80 0 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "above-uint256" (CCIP.CodecV1.Uint256.maxUint256DecimalText <> "0") 80 0 === None debug "testUint256_LocalConversion_EqualDecimals: PASSED" @@ -160,49 +160,49 @@ testUint256_LocalConversion_EqualDecimals = script do -- Downscaling floors toward zero before parsing to Numeric 0, matching integer token units. testUint256_LocalConversion_Downscale : Script () testUint256_LocalConversion_Downscale = script do - let exact = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "exact" "1000000000000000000" 18 6) + let exact = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "exact" "1000000000000000000" 18 6) exact.localAmount === 1000000.0 exact.truncatedRemainder === "0" exact.wasTruncated === False - let fractional = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "fractional" "123456789123456789" 18 6) + let fractional = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "fractional" "123456789123456789" 18 6) fractional.localAmount === 123456.0 fractional.truncatedRemainder === "789123456789" fractional.wasTruncated === True - let belowUnit = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "below-unit" "999999999999" 18 6) + let belowUnit = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "below-unit" "999999999999" 18 6) belowUnit.localAmount === 0.0 belowUnit.truncatedRemainder === "999999999999" belowUnit.wasTruncated === True - let maxDecimalGapBelowUnit = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "max-gap-below-unit" "1" 255 0) + let maxDecimalGapBelowUnit = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "max-gap-below-unit" "1" 255 0) maxDecimalGapBelowUnit.localAmount === 0.0 maxDecimalGapBelowUnit.truncatedRemainder === "1" maxDecimalGapBelowUnit.wasTruncated === True - let exactUnit = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "exact-unit" "1000000000000" 18 6) + let exactUnit = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "exact-unit" "1000000000000" 18 6) exactUnit.localAmount === 1.0 exactUnit.truncatedRemainder === "0" exactUnit.wasTruncated === False - let leadingZeros = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "leading-zeros" "0001234500" 4 2) + let leadingZeros = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "leading-zeros" "0001234500" 4 2) leadingZeros.localAmount === 12345.0 leadingZeros.truncatedRemainder === "0" leadingZeros.wasTruncated === False - let largeSourceFitsAfterDownscale = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "large-source" oneAboveMaxNumeric0Text 20 18) + let largeSourceFitsAfterDownscale = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "large-source" oneAboveMaxNumeric0Text 20 18) largeSourceFitsAfterDownscale.localAmount === 1000000000000000000000000000000000000.0 largeSourceFitsAfterDownscale.truncatedRemainder === "0" largeSourceFitsAfterDownscale.wasTruncated === False - let maxUint256ToOne = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "max-uint256" Uint256.maxUint256DecimalText 77 0) + let maxUint256ToOne = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "max-uint256" CCIP.CodecV1.Uint256.maxUint256DecimalText 77 0) maxUint256ToOne.localAmount === 1.0 maxUint256ToOne.truncatedRemainder === "15792089237316195423570985008687907853269984665640564039457584007913129639935" maxUint256ToOne.wasTruncated === True - let maxUint256ToZero = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "max-uint256-zero" Uint256.maxUint256DecimalText 78 0) + let maxUint256ToZero = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "max-uint256-zero" CCIP.CodecV1.Uint256.maxUint256DecimalText 78 0) maxUint256ToZero.localAmount === 0.0 - maxUint256ToZero.truncatedRemainder === Uint256.maxUint256DecimalText + maxUint256ToZero.truncatedRemainder === CCIP.CodecV1.Uint256.maxUint256DecimalText maxUint256ToZero.wasTruncated === True debug "testUint256_LocalConversion_Downscale: PASSED" @@ -210,29 +210,29 @@ testUint256_LocalConversion_Downscale = script do -- Upscaling appends zeros and rejects results that overflow Canton's Numeric 0 range. testUint256_LocalConversion_Upscale : Script () testUint256_LocalConversion_Upscale = script do - let sixToEighteen = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "six-to-eighteen" "123456" 6 18) + let sixToEighteen = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "six-to-eighteen" "123456" 6 18) sixToEighteen.localAmount === 123456000000000000.0 sixToEighteen.truncatedRemainder === "0" sixToEighteen.wasTruncated === False - let zeroToEighteen = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "zero-to-eighteen" "1" 0 18) + let zeroToEighteen = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "zero-to-eighteen" "1" 0 18) zeroToEighteen.localAmount === 1000000000000000000.0 - let zeroMaxGap = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "zero-max-gap" "0" 0 255) + let zeroMaxGap = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "zero-max-gap" "0" 0 255) zeroMaxGap.localAmount === 0.0 zeroMaxGap.truncatedRemainder === "0" zeroMaxGap.wasTruncated === False - let boundary = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "boundary" "99999999999999999999999999" 6 18) + let boundary = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "boundary" "99999999999999999999999999" 6 18) boundary.localAmount === 99999999999999999999999999000000000000.0 - Uint256.calculateLocalAmountFromDecimalTextChecked "overflow" "100000000000000000000000000" 6 18 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "overflow" "100000000000000000000000000" 6 18 === None - Uint256.calculateLocalAmountFromDecimalTextChecked "invalid-negative-decimals" "1" (-1) 18 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "invalid-negative-decimals" "1" (-1) 18 === None - Uint256.calculateLocalAmountFromDecimalTextChecked "invalid-local-decimals" "1" 18 256 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "invalid-local-decimals" "1" 18 256 === None - Uint256.calculateLocalAmountFromDecimalTextChecked "invalid-remote-decimals" "1" 256 18 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "invalid-remote-decimals" "1" 256 18 === None debug "testUint256_LocalConversion_Upscale: PASSED" @@ -240,17 +240,17 @@ testUint256_LocalConversion_Upscale = script do -- The byte-based conversion path is the one used by inbound token pools. testUint256_LocalConversion_FromBytes : Script () testUint256_LocalConversion_FromBytes = script do - let amount = fromSome (Uint256.decimalTextToUint256Bytes "123456789123456789") - let converted = fromSome (Uint256.calculateLocalAmountFromUint256Checked "from-bytes" amount 18 6) + let amount = fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "123456789123456789") + let converted = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromUint256Checked "from-bytes" amount 18 6) converted.localAmount === 123456.0 converted.truncatedRemainder === "789123456789" converted.wasTruncated === True - let large = fromSome (Uint256.decimalTextToUint256Bytes oneAboveMaxNumeric0Text) - let downscaled = fromSome (Uint256.calculateLocalAmountFromUint256Checked "large-downscale" large 20 18) + let large = fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes oneAboveMaxNumeric0Text) + let downscaled = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromUint256Checked "large-downscale" large 20 18) downscaled.localAmount === 1000000000000000000000000000000000000.0 - Uint256.calculateLocalAmountFromUint256Checked "bad-length" "00" 18 6 + CCIP.CodecV1.Uint256.calculateLocalAmountFromUint256Checked "bad-length" "00" 18 6 === None debug "testUint256_LocalConversion_FromBytes: PASSED" diff --git a/contracts/ccip/test/daml/common/ExecutingMessageV1.daml b/contracts/ccip/test/daml/common/ExecutingMessage.daml similarity index 56% rename from contracts/ccip/test/daml/common/ExecutingMessageV1.daml rename to contracts/ccip/test/daml/common/ExecutingMessage.daml index 820f43c6b..10c5e8808 100644 --- a/contracts/ccip/test/daml/common/ExecutingMessageV1.daml +++ b/contracts/ccip/test/daml/common/ExecutingMessage.daml @@ -1,32 +1,36 @@ -module ExecutingMessageV1 where +module ExecutingMessage where import Daml.Script import DA.Optional (fromSome, fromSomeNote) import DA.Assert -import CCIP.ExecutingMessageV1 -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.Internal qualified as Internal -import qualified CCIP.MessageCodecV1 -import Chainlink.InstanceAddress qualified as RawInstanceAddress -import Splice.Api.Token.HoldingV1 qualified as HoldingV1 +import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.APIV1.ExecutingMessage +import qualified CCIP.CodecV1.CCVCodec +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CoreV1.ExecutingMessage finalityConfig n = if n == 0 - then FinalityCodec.WaitForFinality - else FinalityCodec.BlockDepth n + then CCIP.CodecV1.FinalityConfig.WaitForFinality + else CCIP.CodecV1.FinalityConfig.BlockDepth n rawFinalityConfig n = if n == 0 - then FinalityCodec.waitForFinalityFlag + then CCIP.CodecV1.FinalityConfig.waitForFinalityFlag else fromSome do - flagsHex <- CCIP.MessageCodecV1.encodeUint16 0 - blockConfirmationsHex <- CCIP.MessageCodecV1.encodeUint16 n + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 n pure (flagsHex <> blockConfirmationsHex) unsafeDecodeRequestedFinality finalityConfig = fromSomeNote "unsafeDecodeRequestedFinality: invalid finality config" - (FinalityCodec.decodeRequestedFinality finalityConfig) + (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalityConfig) messageFinality n = unsafeDecodeRequestedFinality (rawFinalityConfig n) @@ -40,7 +44,7 @@ testAddCCVVerification = do receiver <- allocateParty "Receiver" executor <- allocateParty "Executor" - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 123.0 destChainSelector = 456.0 sequenceNumber = 1.0 @@ -51,14 +55,14 @@ testAddCCVVerification = do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" tokenTransfer = None messageData = "48656c6c6f20576f726c64" - -- Create ExecutingMessageV1 - executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1 with + -- Create ExecutingMessage + executingMessageCid <- coerceContractId @_ @CCIP.APIV1.ExecutingMessage.IExecutingMessage <$> submit ccipOwner do + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "0x1234" @@ -68,67 +72,72 @@ testAddCCVVerification = do observingParties = [] ccvVerifications = [] ccvOwners = [] - requiredCCVs = [ RawInstanceAddress.make "0xCCV1" ccvOwner1 - , RawInstanceAddress.make "0xCCV2" ccvOwner1 - , RawInstanceAddress.make "0xCCV2" ccvOwner2 + requiredCCVs = [ Chainlink.InstanceAddress.make "0xCCV1" ccvOwner1 + , Chainlink.InstanceAddress.make "0xCCV2" ccvOwner1 + , Chainlink.InstanceAddress.make "0xCCV2" ccvOwner2 ] optionalCCVs = [] optionalCCVThreshold = 0 receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageDeps with - offRamp = RawInstanceAddress.make "test-offramp" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalConfig" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmnRemote" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tokenAdminRegistry" ccipOwner - state = ExecutingMessageState_Prepared + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with + offRamp = Chainlink.InstanceAddress.make "test-offramp" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalConfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmnRemote" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tokenAdminRegistry" ccipOwner + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_Prepared -- Add first CCV verification executingMessageCid <- submit [ccipOwner, ccvOwner1] do - exerciseCmd executingMessageCid AddCCVVerification with + exerciseCmd executingMessageCid CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = "0xCCV1" versionTag = "0x01" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner1 -- Try to add a verification with the same party, but different instance ID, must succeed -- This is to prevent CCV poisoning where a malicious CCV owner could prevent other CCVs from adding their verification executingMessageCid <- submit [ccipOwner, ccvOwner1] do - exerciseCmd executingMessageCid AddCCVVerification with + exerciseCmd executingMessageCid CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = "0xCCV2" versionTag = "0x02" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner1 -- same party as first verification, different instance ID -- Add second CCV verification, must succeed -- The previous step already added a verification for this instance ID, but with a different party, so this should not be considered a duplicate executingMessageCid <- submit [ccipOwner, ccvOwner2] do - exerciseCmd executingMessageCid AddCCVVerification with + exerciseCmd executingMessageCid CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = "0xCCV2" versionTag = "0x02" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner2 -- Try to add the same verification again, must fail submitMustFail [ccipOwner, ccvOwner2] do - exerciseCmd executingMessageCid AddCCVVerification with + exerciseCmd executingMessageCid CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = "0xCCV2" versionTag = "0x02" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner2 -- Try to add a verification with an unauthorized caller party, must fail submitMustFail [ccipOwner, ccvOwner2] do - exerciseCmd executingMessageCid AddCCVVerification with + exerciseCmd executingMessageCid CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = "0xCCV3" versionTag = "0x03" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner3 -- not part of the authorizing parties for this submit -- Fetch final state and assert both CCV verifications are recorded - finalMessage <- fromSome <$> queryContractId ccipOwner executingMessageCid + Some finalMessage <- queryContractId ccipOwner (coerceContractId @_ @CCIP.CoreV1.ExecutingMessage.ExecutingMessage executingMessageCid) length finalMessage.ccvVerifications === 3 finalMessage.ccvOwners === [ccvOwner1, ccvOwner2] finalMessage.ccvVerifications === - [ CCVVerification with ccvInstanceId = "0xCCV1", ccvOwner = ccvOwner1, versionTag = "0x01" - , CCVVerification with ccvInstanceId = "0xCCV2", ccvOwner = ccvOwner1, versionTag = "0x02" - , CCVVerification with ccvInstanceId = "0xCCV2", ccvOwner = ccvOwner2, versionTag = "0x02"] + [ CCIP.CoreV1.ExecutingMessage.CCVVerification with ccvInstanceId = "0xCCV1", ccvOwner = ccvOwner1, versionTag = "0x01" + , CCIP.CoreV1.ExecutingMessage.CCVVerification with ccvInstanceId = "0xCCV2", ccvOwner = ccvOwner1, versionTag = "0x02" + , CCIP.CoreV1.ExecutingMessage.CCVVerification with ccvInstanceId = "0xCCV2", ccvOwner = ccvOwner2, versionTag = "0x02"] testAddCCVVerificationRequiresPoolFirstForTokenTransfer : Script () testAddCCVVerificationRequiresPoolFirstForTokenTransfer = do @@ -138,7 +147,7 @@ testAddCCVVerificationRequiresPoolFirstForTokenTransfer = do executor <- allocateParty "Executor Token" poolOwner <- allocateParty "Pool Owner Token" - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 123.0 destChainSelector = 456.0 sequenceNumber = 1.0 @@ -149,19 +158,19 @@ testAddCCVVerificationRequiresPoolFirstForTokenTransfer = do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000004" sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000005" destTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" - tokenReceiver = CCIP.MessageCodecV1.encodePartyAddress receiver - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 1.0) + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1.0) extraData = "") messageData = "" - executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1 with + executingMessageCid <- coerceContractId @_ @CCIP.APIV1.ExecutingMessage.IExecutingMessage <$> submit ccipOwner do + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "0x5678" @@ -171,38 +180,40 @@ testAddCCVVerificationRequiresPoolFirstForTokenTransfer = do observingParties = [] ccvVerifications = [] ccvOwners = [] - requiredCCVs = [RawInstanceAddress.make "0xCCV1" ccvOwner] + requiredCCVs = [Chainlink.InstanceAddress.make "0xCCV1" ccvOwner] optionalCCVs = [] optionalCCVThreshold = 0 receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageDeps with - offRamp = RawInstanceAddress.make "test-offramp" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalConfig" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmnRemote" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tokenAdminRegistry" ccipOwner - state = ExecutingMessageState_RequirePoolCCVs + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with + offRamp = Chainlink.InstanceAddress.make "test-offramp" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalConfig" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmnRemote" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tokenAdminRegistry" ccipOwner + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_RequirePoolCCVs submitMustFail [ccipOwner, ccvOwner] do - exerciseCmd executingMessageCid AddCCVVerification with + exerciseCmd executingMessageCid CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = "0xCCV1" versionTag = "0x01" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner - executingMessageCid <- submit (actAs ccipOwner <> actAs poolOwner) do - exerciseCmd executingMessageCid SetInboundPoolCCVs with + executingMessageCid <- coerceContractId @_ @CCIP.APIV1.ExecutingMessage.IExecutingMessage <$> submit (actAs ccipOwner <> actAs poolOwner) do + exerciseCmd (coerceContractId @_ @CCIP.CoreV1.ExecutingMessage.ExecutingMessage executingMessageCid) CCIP.CoreV1.ExecutingMessage.SetInboundPoolCCVs with poolInstanceId = "test-pool" poolOwner = poolOwner poolCCVs = [] executingMessageCid <- submit (actAs ccipOwner <> actAs ccvOwner) do - exerciseCmd executingMessageCid AddCCVVerification with + exerciseCmd executingMessageCid CCIP.APIV1.ExecutingMessage.ExecutingMessage_AddCCVVerification with ccvInstanceId = "0xCCV1" versionTag = "0x01" + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = ccvOwner - finalMessage <- fromSome <$> queryContractId ccipOwner executingMessageCid + Some finalMessage <- queryContractId ccipOwner (coerceContractId @_ @CCIP.CoreV1.ExecutingMessage.ExecutingMessage executingMessageCid) length finalMessage.ccvVerifications === 1 testFinalizeExecuteSnapshotsResolvedInboundPoolCCVs : Script () @@ -214,13 +225,13 @@ testFinalizeExecuteSnapshotsResolvedInboundPoolCCVs = do receiver <- allocateParty "Receiver Finalize Snapshot" executor <- allocateParty "Executor Finalize Snapshot" - let defaultCCV = RawInstanceAddress.make "default-ccv" defaultCCVOwner - let explicitCCV = RawInstanceAddress.make "explicit-ccv" explicitCCVOwner + let defaultCCV = Chainlink.InstanceAddress.make "default-ccv" defaultCCVOwner + let explicitCCV = Chainlink.InstanceAddress.make "explicit-ccv" explicitCCVOwner let sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000004" let sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000005" let destTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 123.0 destChainSelector = 456.0 sequenceNumber = 1.0 @@ -231,19 +242,19 @@ testFinalizeExecuteSnapshotsResolvedInboundPoolCCVs = do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with sourcePoolAddress = sourcePoolAddress sourceTokenAddress = sourceTokenAddress destTokenAddress = destTokenAddress - tokenReceiver = CCIP.MessageCodecV1.encodePartyAddress receiver - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 10.0) + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 10.0) extraData = "") messageData = "" executingMessageCid <- submit (actAs ccipOwner <> actAs poolOwner) do - createCmd ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "0x9abc" @@ -258,35 +269,35 @@ testFinalizeExecuteSnapshotsResolvedInboundPoolCCVs = do optionalCCVThreshold = 0 receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [defaultCCV] - inboundPoolVerification = Some (InboundPoolVerification with + inboundPoolVerification = Some (CCIP.CoreV1.ExecutingMessage.InboundPoolVerification with poolInstanceId = "snapshot-pool" poolOwner = poolOwner - poolCCVs = [Internal.useDefaultCCVs, explicitCCV]) - deps = ExecutingMessageDeps with - offRamp = RawInstanceAddress.make "test-offramp-snapshot" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalConfig-snapshot" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmnRemote-snapshot" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tokenAdminRegistry-snapshot" ccipOwner - state = ExecutingMessageState_Prepared + poolCCVs = [CCIP.CodecV1.CCVCodec.useDefaultCCVs, explicitCCV]) + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with + offRamp = Chainlink.InstanceAddress.make "test-offramp-snapshot" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalConfig-snapshot" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmnRemote-snapshot" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tokenAdminRegistry-snapshot" ccipOwner + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_Prepared submitMustFail [ccipOwner] do - exerciseCmd executingMessageCid FinalizeExecute with + exerciseCmd executingMessageCid CCIP.CoreV1.ExecutingMessage.FinalizeExecute with tokenAdminRegistryInstanceId = "test-tokenAdminRegistry-snapshot" - maybePoolAddress = Some (RawInstanceAddress.make "wrong-snapshot-pool" poolOwner) + maybePoolAddress = Some (Chainlink.InstanceAddress.make "wrong-snapshot-pool" poolOwner) maybeTicketReceiver = Some receiver maybeTokenReceiver = Some receiver - maybeInstrumentId = Some (HoldingV1.InstrumentId with admin = ccipOwner, id = "TEST") - maybeAmount = Some (fromSome (CCIP.MessageCodecV1.encodeUint256 10.0)) + maybeInstrumentId = Some (Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner, id = "TEST") + maybeAmount = Some (fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 10.0)) returnData = "" finalizeResult <- submit ccipOwner do - exerciseCmd executingMessageCid FinalizeExecute with + exerciseCmd executingMessageCid CCIP.CoreV1.ExecutingMessage.FinalizeExecute with tokenAdminRegistryInstanceId = "test-tokenAdminRegistry-snapshot" - maybePoolAddress = Some (RawInstanceAddress.make "snapshot-pool" poolOwner) + maybePoolAddress = Some (Chainlink.InstanceAddress.make "snapshot-pool" poolOwner) maybeTicketReceiver = Some receiver maybeTokenReceiver = Some receiver - maybeInstrumentId = Some (HoldingV1.InstrumentId with admin = ccipOwner, id = "TEST") - maybeAmount = Some (fromSome (CCIP.MessageCodecV1.encodeUint256 10.0)) + maybeInstrumentId = Some (Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner, id = "TEST") + maybeAmount = Some (fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 10.0)) returnData = "" ticketCid <- case finalizeResult.tokenReceiveTicket of @@ -294,7 +305,7 @@ testFinalizeExecuteSnapshotsResolvedInboundPoolCCVs = do None -> abort "expected token receive ticket" ticket <- fromSome <$> queryContractId ccipOwner ticketCid ticket.requiredInboundPoolCCVs === [defaultCCV, explicitCCV] - ticket.poolAddress === RawInstanceAddress.make "snapshot-pool" poolOwner + ticket.poolAddress === Chainlink.InstanceAddress.make "snapshot-pool" poolOwner testFinalizeExecuteFailsWithoutInboundPoolCCVsForTokenTicket : Script () testFinalizeExecuteFailsWithoutInboundPoolCCVsForTokenTicket = do @@ -306,9 +317,9 @@ testFinalizeExecuteFailsWithoutInboundPoolCCVsForTokenTicket = do let sourcePoolAddress = "0000000000000000000000000000000000000000000000000000000000000004" let sourceTokenAddress = "0000000000000000000000000000000000000000000000000000000000000005" let destTokenAddress = "0000000000000000000000000000000000000000000000000000000000000006" - let instrumentId = HoldingV1.InstrumentId with admin = ccipOwner, id = "TEST" + let instrumentId = Splice.Api.Token.HoldingV1.InstrumentId with admin = ccipOwner, id = "TEST" - let message = CCIP.MessageCodecV1.MessageV1 with + let message = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 123.0 destChainSelector = 456.0 sequenceNumber = 1.0 @@ -319,19 +330,19 @@ testFinalizeExecuteFailsWithoutInboundPoolCCVsForTokenTicket = do onRampAddress = "0000000000000000000000000000000000000000000000000000000000000001" offRampAddress = "0000000000000000000000000000000000000000000000000000000000000002" sender = "0000000000000000000000000000000000000000000000000000000000000003" - receiver = CCIP.MessageCodecV1.encodePartyAddress receiver + receiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver destBlob = "" - tokenTransfer = Some (CCIP.MessageCodecV1.TokenTransferV1 with + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with sourcePoolAddress = sourcePoolAddress sourceTokenAddress = sourceTokenAddress destTokenAddress = destTokenAddress - tokenReceiver = CCIP.MessageCodecV1.encodePartyAddress receiver - amount = fromSome (CCIP.MessageCodecV1.encodeUint256 10.0) + tokenReceiver = CCIP.CodecV1.MessageCodecV1.encodePartyAddress receiver + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 10.0) extraData = "") messageData = "" executingMessageCid <- submit ccipOwner do - createCmd ExecutingMessageV1 with + createCmd CCIP.CoreV1.ExecutingMessage.ExecutingMessage with ccipOwner = ccipOwner message = message messageId = "0xdef0" @@ -347,19 +358,19 @@ testFinalizeExecuteFailsWithoutInboundPoolCCVsForTokenTicket = do receiverFinalityConfig = finalityConfig 2000 sourceDefaultCCVs = [] inboundPoolVerification = None - deps = ExecutingMessageDeps with - offRamp = RawInstanceAddress.make "test-offramp-missing-inbound" ccipOwner - globalConfig = RawInstanceAddress.make "test-globalConfig-missing-inbound" ccipOwner - rmnRemote = RawInstanceAddress.make "test-rmnRemote-missing-inbound" ccipOwner - tokenAdminRegistry = RawInstanceAddress.make "test-tokenAdminRegistry-missing-inbound" ccipOwner - state = ExecutingMessageState_Prepared + deps = CCIP.CoreV1.ExecutingMessage.ExecutingMessageDeps with + offRamp = Chainlink.InstanceAddress.make "test-offramp-missing-inbound" ccipOwner + globalConfig = Chainlink.InstanceAddress.make "test-globalConfig-missing-inbound" ccipOwner + rmnRemote = Chainlink.InstanceAddress.make "test-rmnRemote-missing-inbound" ccipOwner + tokenAdminRegistry = Chainlink.InstanceAddress.make "test-tokenAdminRegistry-missing-inbound" ccipOwner + state = CCIP.CoreV1.ExecutingMessage.ExecutingMessageState_Prepared submitMustFail [ccipOwner] do - exerciseCmd executingMessageCid FinalizeExecute with + exerciseCmd executingMessageCid CCIP.CoreV1.ExecutingMessage.FinalizeExecute with tokenAdminRegistryInstanceId = "test-tokenAdminRegistry-missing-inbound" - maybePoolAddress = Some (RawInstanceAddress.make "missing-inbound-pool" poolOwner) + maybePoolAddress = Some (Chainlink.InstanceAddress.make "missing-inbound-pool" poolOwner) maybeTicketReceiver = Some receiver maybeTokenReceiver = Some receiver maybeInstrumentId = Some instrumentId - maybeAmount = Some (fromSome (CCIP.MessageCodecV1.encodeUint256 10.0)) + maybeAmount = Some (fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 10.0)) returnData = "" diff --git a/contracts/ccip/test/daml/common/FinalityCodecTest.daml b/contracts/ccip/test/daml/common/FinalityCodecTest.daml index 3193f0f97..e8448dfab 100644 --- a/contracts/ccip/test/daml/common/FinalityCodecTest.daml +++ b/contracts/ccip/test/daml/common/FinalityCodecTest.daml @@ -6,36 +6,36 @@ import DA.Assert import DA.Optional import DA.Crypto.Text (byteCount) -import CCIP.FinalityConfig qualified as FinalityCodec -import CCIP.MessageCodecV1 qualified as MessageCodecV1 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 mkFinalityConfig : Int -> Int -> Text mkFinalityConfig flags blockConfirmations = fromSome do - flagsHex <- MessageCodecV1.encodeUint16 flags - blockConfirmationsHex <- MessageCodecV1.encodeUint16 blockConfirmations + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 flags + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 blockConfirmations pure (flagsHex <> blockConfirmationsHex) -decodedFinality : Text -> FinalityCodec.DecodedFinality +decodedFinality : Text -> CCIP.CodecV1.FinalityConfig.DecodedFinality decodedFinality finalityConfig = fromSomeNote "unsafeDecodeRequestedFinality: invalid finality config" - (FinalityCodec.decodeRequestedFinality finalityConfig) + (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalityConfig) decodeFlags : Text -> Optional Int decodeFlags finalityConfig = do if byteCount finalityConfig /= 4 then None else do - flagsHex <- MessageCodecV1.extractBytes finalityConfig 0 2 - MessageCodecV1.decodeUint16 flagsHex + flagsHex <- CCIP.CodecV1.MessageCodecV1.extractBytes finalityConfig 0 2 + CCIP.CodecV1.MessageCodecV1.decodeUint16 flagsHex decodeBlockConfirmations : Text -> Optional Int decodeBlockConfirmations finalityConfig = do if byteCount finalityConfig /= 4 then None else do - blockConfirmationsHex <- MessageCodecV1.extractBytes finalityConfig 2 2 - MessageCodecV1.decodeUint16 blockConfirmationsHex + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.extractBytes finalityConfig 2 2 + CCIP.CodecV1.MessageCodecV1.decodeUint16 blockConfirmationsHex validateRequestedFinality : Text -> Bool validateRequestedFinality finalityConfig = - isSome (FinalityCodec.decodeRequestedFinality finalityConfig) + isSome (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalityConfig) testDecodeKnownEncodings : Script () testDecodeKnownEncodings = do @@ -71,11 +71,11 @@ testValidateRequestedFinalityModes = do assertMsg "multiple flag bits should be rejected" (not (validateRequestedFinality multipleFlags)) - FinalityCodec.decodeRequestedFinality finalizedOnly === Some (decodedFinality finalizedOnly) - FinalityCodec.decodeRequestedFinality safe === Some (decodedFinality safe) - FinalityCodec.decodeRequestedFinality depth2000 === Some (decodedFinality depth2000) - FinalityCodec.decodeRequestedFinality mixedSafeAndDepth === None - FinalityCodec.decodeRequestedFinality multipleFlags === None + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality finalizedOnly === Some (decodedFinality finalizedOnly) + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality safe === Some (decodedFinality safe) + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality depth2000 === Some (decodedFinality depth2000) + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality mixedSafeAndDepth === None + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality multipleFlags === None testRequestedFinalityAllowed : Script () testRequestedFinalityAllowed = do @@ -86,13 +86,13 @@ testRequestedFinalityAllowed = do let requested = (.requested) . decodedFinality assertMsg "finalized-only requests are always allowed" - (FinalityCodec.requestedFinalityAllowed (requested finalizedOnly) (requested safe)) + (CCIP.CodecV1.FinalityConfig.requestedFinalityAllowed (requested finalizedOnly) (requested safe)) assertMsg "safe requested should be allowed when safe is allowed" - (FinalityCodec.requestedFinalityAllowed (requested safe) (requested safe)) + (CCIP.CodecV1.FinalityConfig.requestedFinalityAllowed (requested safe) (requested safe)) assertMsg "deeper block depth should satisfy a lower allowed depth" - (FinalityCodec.requestedFinalityAllowed (requested depth2000) (requested depth12)) + (CCIP.CodecV1.FinalityConfig.requestedFinalityAllowed (requested depth2000) (requested depth12)) assertMsg "safe requested should not satisfy a block-depth-only config" - (not (FinalityCodec.requestedFinalityAllowed (requested safe) (requested depth12))) + (not (CCIP.CodecV1.FinalityConfig.requestedFinalityAllowed (requested safe) (requested depth12))) testValidateRequestedFinalityAlignsWithDecoder : Script () testValidateRequestedFinalityAlignsWithDecoder = do @@ -106,21 +106,21 @@ testValidateRequestedFinalityAlignsWithDecoder = do safePlusDepth = "0001000c" -- flags=1 + depth=12: mixed -- Patterns the decoder accepts must validate. - FinalityCodec.validateRequestedFinality finalizedOnly === True - FinalityCodec.validateRequestedFinality safe === True - FinalityCodec.validateRequestedFinality depth5 === True + CCIP.CodecV1.FinalityConfig.validateRequestedFinality finalizedOnly === True + CCIP.CodecV1.FinalityConfig.validateRequestedFinality safe === True + CCIP.CodecV1.FinalityConfig.validateRequestedFinality depth5 === True -- Patterns the decoder rejects must NOT validate. - FinalityCodec.validateRequestedFinality flagBit1 === False - FinalityCodec.validateRequestedFinality flagBit2 === False - FinalityCodec.validateRequestedFinality flagBit3 === False - FinalityCodec.validateRequestedFinality safePlusDepth === False + CCIP.CodecV1.FinalityConfig.validateRequestedFinality flagBit1 === False + CCIP.CodecV1.FinalityConfig.validateRequestedFinality flagBit2 === False + CCIP.CodecV1.FinalityConfig.validateRequestedFinality flagBit3 === False + CCIP.CodecV1.FinalityConfig.validateRequestedFinality safePlusDepth === False -- And the decoder must agree. - FinalityCodec.decodeRequestedFinality flagBit1 === None - FinalityCodec.decodeRequestedFinality flagBit2 === None - FinalityCodec.decodeRequestedFinality flagBit3 === None - FinalityCodec.decodeRequestedFinality safePlusDepth === None + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality flagBit1 === None + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality flagBit2 === None + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality flagBit3 === None + CCIP.CodecV1.FinalityConfig.decodeRequestedFinality safePlusDepth === None testCustomFinalityRateLimiterRequired : Script () testCustomFinalityRateLimiterRequired = do @@ -130,8 +130,8 @@ testCustomFinalityRateLimiterRequired = do let requested = (.requested) . decodedFinality assertMsg "finalized-only should use the default limiter path" - (not (FinalityCodec.customFinalityRateLimiterRequired (requested finalizedOnly))) + (not (CCIP.CodecV1.FinalityConfig.customFinalityRateLimiterRequired (requested finalizedOnly))) assertMsg "safe should require the custom finality limiter path" - (FinalityCodec.customFinalityRateLimiterRequired (requested safe)) + (CCIP.CodecV1.FinalityConfig.customFinalityRateLimiterRequired (requested safe)) assertMsg "block-depth should require the custom finality limiter path" - (FinalityCodec.customFinalityRateLimiterRequired (requested depth2000)) + (CCIP.CodecV1.FinalityConfig.customFinalityRateLimiterRequired (requested depth2000)) diff --git a/contracts/ccip/test/daml/common/GlobalConfig.daml b/contracts/ccip/test/daml/common/GlobalConfig.daml index 3d450db5a..64f6e37d9 100644 --- a/contracts/ccip/test/daml/common/GlobalConfig.daml +++ b/contracts/ccip/test/daml/common/GlobalConfig.daml @@ -6,9 +6,9 @@ import DA.List (head, (!!)) import DA.Map qualified as Map import DA.Optional (fromSome) -import qualified CCIP.GlobalConfig -import qualified CCIP.GlobalConfigTypes -import Chainlink.InstanceAddress(RawInstanceAddress(..)) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CoreV1.GlobalConfig testGlobalConfig_ApplySourceChainConfigUpdates : Script () testGlobalConfig_ApplySourceChainConfigUpdates = do @@ -17,7 +17,7 @@ testGlobalConfig_ApplySourceChainConfigUpdates = do -- | Create GlobalConfig without any source chain configs globalConfigCid <- submit owner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = instanceId ccipOwner = owner chainSelector = 123.0 @@ -28,21 +28,21 @@ testGlobalConfig_ApplySourceChainConfigUpdates = do -- | Add multiple source chain configs -- | ======================= let sourceChainConfigUpdates1 = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 456.0 isEnabled = True onRampAddresses = ["1111111111111111"] - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] - ,CCIP.GlobalConfigTypes.SourceChainConfigArgs with + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] + ,CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 789.0 isEnabled = True onRampAddresses = ["2222222222222222"] - defaultCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x567"] - laneMandatedCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x567"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] ] globalConfigCid <- submit owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = sourceChainConfigUpdates1 -- Fetch the updated GlobalConfig and verify the source chain configs were added correctly globalConfig <- fromSome <$> queryContractId owner globalConfigCid @@ -60,21 +60,21 @@ testGlobalConfig_ApplySourceChainConfigUpdates = do -- | Update an existing and add a new source chain config -- | ======================= let sourceChainConfigUpdates2 = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 789.0 isEnabled = False onRampAddresses = ["343434"] - defaultCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x567"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x567"] laneMandatedCCVs = [] - ,CCIP.GlobalConfigTypes.SourceChainConfigArgs with + ,CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 123123.0 isEnabled = True onRampAddresses = [] -- empty onRampAddresses, must be allowed defaultCCVs = [] - laneMandatedCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] ] globalConfigCid <- submit owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = sourceChainConfigUpdates2 -- Fetch the updated GlobalConfig and verify the source chain configs were added correctly globalConfig <- fromSome <$> queryContractId owner globalConfigCid @@ -96,43 +96,43 @@ testGlobalConfig_ApplySourceChainConfigUpdates = do -- | Add invalid source chain config updates and verify that the entire transaction is reverted -- | ======================= let invalidSourceChainConfigUpdates = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 0.0 -- Invalid zero chain selector isEnabled = True onRampAddresses = ["1111111111111111"] - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = invalidSourceChainConfigUpdates let invalidSourceChainConfigUpdates = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 123.0 -- Invalid chain selector that is the same as the local chain selector isEnabled = True onRampAddresses = ["1111111111111111"] - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = invalidSourceChainConfigUpdates let invalidSourceChainConfigUpdates = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = -111.0 -- Invalid negative chain selector isEnabled = True onRampAddresses = ["1111111111111111"] - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = invalidSourceChainConfigUpdates let invalidSourceChainConfigUpdates = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 111.0 isEnabled = True onRampAddresses = ["1111111111111111"] @@ -141,127 +141,127 @@ testGlobalConfig_ApplySourceChainConfigUpdates = do laneMandatedCCVs = [] ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = invalidSourceChainConfigUpdates let invalidSourceChainConfigUpdates = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 111.0 isEnabled = True onRampAddresses = ["1111111111111111"] - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xabc"] -- Duplicate CCVs within the default list, which is invalid - laneMandatedCCVs = [RawInstanceAddress "0x123"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] -- Duplicate CCVs within the default list, which is invalid + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = invalidSourceChainConfigUpdates let invalidSourceChainConfigUpdates = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 123.0 isEnabled = True onRampAddresses = ["1111111111111111"] - defaultCCVs = [RawInstanceAddress "0xabc"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x123"] -- Duplicate CCVs within the mandated list, which is invalid + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x123"] -- Duplicate CCVs within the mandated list, which is invalid ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = invalidSourceChainConfigUpdates let invalidSourceChainConfigUpdates = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 111.0 isEnabled = True onRampAddresses = ["1111111111111111"] -- Duplicate CCVs across the default and mandated lists, which is invalid - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0x123"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0x123"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = invalidSourceChainConfigUpdates let invalidSourceChainConfigUpdates = [ - CCIP.GlobalConfigTypes.SourceChainConfigArgs with + CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs with sourceChainSelector = 456.0 isEnabled = True onRampAddresses = [""] -- empty string onramp address must be rejected - defaultCCVs = [RawInstanceAddress "0xabc"] - laneMandatedCCVs = [RawInstanceAddress "0x123"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplySourceChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplySourceChainConfigUpdates with sourceChainConfigUpdates = invalidSourceChainConfigUpdates -- | ======== Test 4 ======== -- | Test creating a GlobalConfig with invalid chain selector and verify that the transaction is reverted -- | ======================= submitMustFail owner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = instanceId ccipOwner = owner chainSelector = 0.0 -- Invalid zero chain selector destChainConfigs = Map.empty sourceChainConfigs = Map.empty submitMustFail owner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = instanceId ccipOwner = owner chainSelector = 123.0 - destChainConfigs = Map.fromList [(123.0, CCIP.GlobalConfigTypes.DestChainConfig with -- Invalid chain selector that is the same as the local chain selector + destChainConfigs = Map.fromList [(123.0, CCIP.CoreV1.GlobalConfig.DestChainConfig with -- Invalid chain selector that is the same as the local chain selector isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "8ffecae212a6c3d2cbd5bfdeedccfa4f0bfde53f" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - laneMandatedCCVs = [RawInstanceAddress "0x123"] - defaultCCVs = [RawInstanceAddress "0xabc"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 )] sourceChainConfigs = Map.empty submitMustFail owner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = instanceId ccipOwner = owner chainSelector = 123.0 - destChainConfigs = Map.fromList [(0.0, CCIP.GlobalConfigTypes.DestChainConfig with -- Invalid zero chain selector + destChainConfigs = Map.fromList [(0.0, CCIP.CoreV1.GlobalConfig.DestChainConfig with -- Invalid zero chain selector isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "8ffecae212a6c3d2cbd5bfdeedccfa4f0bfde53f" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - laneMandatedCCVs = [RawInstanceAddress "0x123"] - defaultCCVs = [RawInstanceAddress "0xabc"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 )] sourceChainConfigs = Map.empty submitMustFail owner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = instanceId ccipOwner = owner chainSelector = 123.0 destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(123.0, CCIP.GlobalConfigTypes.SourceChainConfig with -- Invalid chain selector that is the same as the local chain selector + sourceChainConfigs = Map.fromList [(123.0, CCIP.CoreV1.GlobalConfig.SourceChainConfig with -- Invalid chain selector that is the same as the local chain selector isEnabled = True onRampAddresses = ["1111111111111111"] - defaultCCVs = [RawInstanceAddress "0xabc"] - laneMandatedCCVs = [RawInstanceAddress "0x123"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] )] submitMustFail owner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = instanceId ccipOwner = owner chainSelector = 123.0 destChainConfigs = Map.empty - sourceChainConfigs = Map.fromList [(0.0, CCIP.GlobalConfigTypes.SourceChainConfig with -- Invalid zero chain selector + sourceChainConfigs = Map.fromList [(0.0, CCIP.CoreV1.GlobalConfig.SourceChainConfig with -- Invalid zero chain selector isEnabled = True onRampAddresses = ["1111111111111111"] - defaultCCVs = [RawInstanceAddress "0xabc"] - laneMandatedCCVs = [RawInstanceAddress "0x123"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] )] pure() @@ -273,7 +273,7 @@ testGlobalConfig_ApplyDestChainConfigUpdates = do -- | Create GlobalConfig without any dest chain configs globalConfigCid <- submit owner do - createCmd CCIP.GlobalConfig.GlobalConfig with + createCmd CCIP.CoreV1.GlobalConfig.GlobalConfig with instanceId = instanceId ccipOwner = owner chainSelector = 123.0 @@ -284,33 +284,33 @@ testGlobalConfig_ApplyDestChainConfigUpdates = do -- | Add multiple dest chain configs -- | ======================= let destChainConfigUpdates1 = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 456.0 isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "1111111111111111111111111111111111111111" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 - ,CCIP.GlobalConfigTypes.DestChainConfigArgs with + ,CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 789.0 isEnabled = True addressBytesLength = 32 tokenReceiverAllowed = True baseExecutionGasCost = 0 offRampAddress = "2222222222222222222222222222222222222222222222222222222222222222" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x567"] - laneMandatedCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x567"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] messageNetworkFeeUSDCents = 15.0 tokenNetworkFeeUSDCents = 25.0 ] globalConfigCid <- submit owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = destChainConfigUpdates1 -- Fetch the updated GlobalConfig and verify the dest chain configs were added correctly globalConfig <- fromSome <$> queryContractId owner globalConfigCid @@ -328,33 +328,33 @@ testGlobalConfig_ApplyDestChainConfigUpdates = do -- | Update an existing and add a new dest chain config -- | ======================= let destChainConfigUpdates2 = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 789.0 -- Update the existing config isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "7b546b15ab63b57e65ffeeffd6ccefbf8f164efd" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x567"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x567"] laneMandatedCCVs = [] messageNetworkFeeUSDCents = 100.0 tokenNetworkFeeUSDCents = 200.0 - ,CCIP.GlobalConfigTypes.DestChainConfigArgs with + ,CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 123123.0 -- Add a new config isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "6dcb7fde9ac46dba422dcd6627cab455d7e93b14" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") defaultCCVs = [] - laneMandatedCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] messageNetworkFeeUSDCents = 15.0 tokenNetworkFeeUSDCents = 25.0 ] globalConfigCid <- submit owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = destChainConfigUpdates2 -- Fetch the updated GlobalConfig and verify the dest chain configs were added correctly globalConfig <- fromSome <$> queryContractId owner globalConfigCid @@ -376,68 +376,68 @@ testGlobalConfig_ApplyDestChainConfigUpdates = do -- | Add invalid dest chain config updates and verify that the entire transaction is reverted -- | ======================= let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 0.0 -- Invalid zero chain selector isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "529982d7c7bb378a77d2ecaeb1cbca37b65fd92f" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 123.0 -- Invalid chain selector that is the same as the local chain selector isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "529982d7c7bb378a77d2ecaeb1cbca37b65fd92f" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = -111.0 -- Invalid negative chain selector isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "529982d7c7bb378a77d2ecaeb1cbca37b65fd92f" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xdef"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xdef"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 111.0 isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "bc30fdec959bce0af7a36ac681dfadddfddac2ab" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") -- Empty default and mandated CCV lists, which is invalid since at least one CCV must be provided defaultCCVs = [] laneMandatedCCVs = [] @@ -445,99 +445,99 @@ testGlobalConfig_ApplyDestChainConfigUpdates = do tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 111.0 isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "beafb8e4f9fab41badca6edfb9f0aaea8b6cc9c3" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0xabc"] -- Duplicate CCVs within the default list, which is invalid - laneMandatedCCVs = [RawInstanceAddress "0x123"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] -- Duplicate CCVs within the default list, which is invalid + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 111.0 isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "8a16cb05dcffcbe196a5c8c2d6ebc4ba664fd41b" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0xabc"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x123"] -- Duplicate CCVs within the mandated list, which is invalid + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x123"] -- Duplicate CCVs within the mandated list, which is invalid messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 111.0 isEnabled = True addressBytesLength = 20 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "8fd2fe964b7ebbdf1ba2eaf949fdcf05baead07f" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") -- Duplicate CCVs across the default and mandated lists, which is invalid - defaultCCVs = [RawInstanceAddress "0xabc", RawInstanceAddress "0x123"] - laneMandatedCCVs = [RawInstanceAddress "0x123", RawInstanceAddress "0x456"] + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc", Chainlink.InstanceAddress.RawInstanceAddress "0x123"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123", Chainlink.InstanceAddress.RawInstanceAddress "0x456"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 111.0 isEnabled = True addressBytesLength = 3 tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "12345678" -- 4 bytes, which is invalid given the addressBytesLength of 3 - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0xabc"] - laneMandatedCCVs = [RawInstanceAddress "0x123"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates let invalidDestChainConfigUpdates = [ - CCIP.GlobalConfigTypes.DestChainConfigArgs with + CCIP.CoreV1.GlobalConfig.DestChainConfigArgs with destChainSelector = 111.0 isEnabled = True addressBytesLength = 0 -- Invalid zero address byte length tokenReceiverAllowed = False baseExecutionGasCost = 0 offRampAddress = "" - defaultExecutor = Some (RawInstanceAddress "default-executor@party") - defaultCCVs = [RawInstanceAddress "0xabc"] - laneMandatedCCVs = [RawInstanceAddress "0x123"] + defaultExecutor = Some (Chainlink.InstanceAddress.RawInstanceAddress "default-executor@party") + defaultCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0xabc"] + laneMandatedCCVs = [Chainlink.InstanceAddress.RawInstanceAddress "0x123"] messageNetworkFeeUSDCents = 10.0 tokenNetworkFeeUSDCents = 20.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates -- negative message network fees are rejected. @@ -545,7 +545,7 @@ testGlobalConfig_ApplyDestChainConfigUpdates = do (head destChainConfigUpdates1) with messageNetworkFeeUSDCents = -1.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates -- negative token network fees are rejected. @@ -553,7 +553,7 @@ testGlobalConfig_ApplyDestChainConfigUpdates = do (head destChainConfigUpdates1) with tokenNetworkFeeUSDCents = -1.0 ] submitMustFail owner do - exerciseCmd globalConfigCid CCIP.GlobalConfig.ApplyDestChainConfigUpdates with + exerciseCmd globalConfigCid CCIP.CoreV1.GlobalConfig.ApplyDestChainConfigUpdates with destChainConfigUpdates = invalidDestChainConfigUpdates pure() @@ -561,7 +561,7 @@ testGlobalConfig_ApplyDestChainConfigUpdates = do -- Assertion helpers -- These compare Config <> Args, and therefore cannot assert on the chain selector since it's not part of the config itself, but rather the key in the map. The rest of the fields can be compared directly. -assertDestChainConfigsEqual : CCIP.GlobalConfigTypes.DestChainConfig -> CCIP.GlobalConfigTypes.DestChainConfigArgs -> Script () +assertDestChainConfigsEqual : CCIP.CoreV1.GlobalConfig.DestChainConfig -> CCIP.CoreV1.GlobalConfig.DestChainConfigArgs -> Script () assertDestChainConfigsEqual got expected = do assertMsg ("isEnabled mismatch, got: " <> show got.isEnabled <> ", expected: " <> show expected.isEnabled) (got.isEnabled == expected.isEnabled) assertMsg ("addressBytesLength mismatch, got: " <> show got.addressBytesLength <> ", expected: " <> show expected.addressBytesLength) (got.addressBytesLength == expected.addressBytesLength) @@ -572,7 +572,7 @@ assertDestChainConfigsEqual got expected = do assertMsg ("messageNetworkFeeUSDCents mismatch, got: " <> show got.messageNetworkFeeUSDCents <> ", expected: " <> show expected.messageNetworkFeeUSDCents) (got.messageNetworkFeeUSDCents == expected.messageNetworkFeeUSDCents) assertMsg ("tokenNetworkFeeUSDCents mismatch, got: " <> show got.tokenNetworkFeeUSDCents <> ", expected: " <> show expected.tokenNetworkFeeUSDCents) (got.tokenNetworkFeeUSDCents == expected.tokenNetworkFeeUSDCents) -assertSourceChainConfigsEqual : CCIP.GlobalConfigTypes.SourceChainConfig -> CCIP.GlobalConfigTypes.SourceChainConfigArgs -> Script () +assertSourceChainConfigsEqual : CCIP.CoreV1.GlobalConfig.SourceChainConfig -> CCIP.CoreV1.GlobalConfig.SourceChainConfigArgs -> Script () assertSourceChainConfigsEqual got expected = do assertMsg ("isEnabled mismatch, got: " <> show got.isEnabled <> ", expected: " <> show expected.isEnabled) (got.isEnabled == expected.isEnabled) assertMsg ("onRampAddresses mismatch, got: " <> show got.onRampAddresses <> ", expected: " <> show expected.onRampAddresses) (got.onRampAddresses == expected.onRampAddresses) diff --git a/contracts/ccip/test/daml/common/GlobalConfigTypes.daml b/contracts/ccip/test/daml/common/GlobalConfigTypes.daml index 2e45793c9..fa9ba4271 100644 --- a/contracts/ccip/test/daml/common/GlobalConfigTypes.daml +++ b/contracts/ccip/test/daml/common/GlobalConfigTypes.daml @@ -2,8 +2,9 @@ module GlobalConfigTypes where import Daml.Script -import qualified CCIP.GlobalConfigTypes -import Chainlink.InstanceAddress (RawInstanceAddress(..)) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.CoreV1.GlobalConfigTypes template ValidationHarness with @@ -13,33 +14,33 @@ template ValidationHarness nonconsuming choice RunValidateDefaultAndMandatedCCVs : () with - defaultCCVs : [RawInstanceAddress] - laneMandatedCCVs : [RawInstanceAddress] + defaultCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + laneMandatedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] controller owner do - CCIP.GlobalConfigTypes.validateDefaultAndMandatedCCVs defaultCCVs laneMandatedCCVs + CCIP.CoreV1.GlobalConfigTypes.validateDefaultAndMandatedCCVs defaultCCVs laneMandatedCCVs nonconsuming choice RunAssertNoDuplicates : () with - addresses : [RawInstanceAddress] + addresses : [Chainlink.InstanceAddress.RawInstanceAddress] controller owner do - CCIP.GlobalConfigTypes.assertNoDuplicates addresses + CCIP.CoreV1.GlobalConfigTypes.assertNoDuplicates addresses nonconsuming choice RunValidateNoEmptyAddresses : () with - addresses : [RawInstanceAddress] + addresses : [Chainlink.InstanceAddress.RawInstanceAddress] controller owner do - CCIP.GlobalConfigTypes.validateNoEmptyAddresses addresses + CCIP.CoreV1.GlobalConfigTypes.validateNoEmptyAddresses addresses testValidateDefaultAndMandatedCCVs : Script () testValidateDefaultAndMandatedCCVs = do owner <- allocateParty "owner" - let ccv1 = RawInstanceAddress "ccv1@partyA" - let ccv2 = RawInstanceAddress "ccv2@partyB" - let ccv3 = RawInstanceAddress "ccv3@partyC" - let ccvEmpty = RawInstanceAddress "" + let ccv1 = Chainlink.InstanceAddress.RawInstanceAddress "ccv1@partyA" + let ccv2 = Chainlink.InstanceAddress.RawInstanceAddress "ccv2@partyB" + let ccv3 = Chainlink.InstanceAddress.RawInstanceAddress "ccv3@partyC" + let ccvEmpty = Chainlink.InstanceAddress.RawInstanceAddress "" harness <- submit owner do createCmd ValidationHarness with @@ -102,8 +103,8 @@ testValidateDefaultAndMandatedCCVs = do testAssertNoDuplicates : Script () testAssertNoDuplicates = do owner <- allocateParty "owner" - let ccv1 = RawInstanceAddress "ccv1@partyA" - let ccv2 = RawInstanceAddress "ccv2@partyB" + let ccv1 = Chainlink.InstanceAddress.RawInstanceAddress "ccv1@partyA" + let ccv2 = Chainlink.InstanceAddress.RawInstanceAddress "ccv2@partyB" harness <- submit owner do createCmd ValidationHarness with @@ -132,9 +133,9 @@ testAssertNoDuplicates = do testValidateNoEmptyAddresses : Script () testValidateNoEmptyAddresses = do owner <- allocateParty "owner" - let ccv1 = RawInstanceAddress "ccv1@partyA" - let ccv2 = RawInstanceAddress "ccv2@partyB" - let ccvEmpty = RawInstanceAddress "" + let ccv1 = Chainlink.InstanceAddress.RawInstanceAddress "ccv1@partyA" + let ccv2 = Chainlink.InstanceAddress.RawInstanceAddress "ccv2@partyB" + let ccvEmpty = Chainlink.InstanceAddress.RawInstanceAddress "" harness <- submit owner do createCmd ValidationHarness with diff --git a/contracts/ccip/test/daml/common/MathTest.daml b/contracts/ccip/test/daml/common/MathTest.daml index d5a75f8b2..6d4cb5aac 100644 --- a/contracts/ccip/test/daml/common/MathTest.daml +++ b/contracts/ccip/test/daml/common/MathTest.daml @@ -4,7 +4,7 @@ import Daml.Script import DA.Assert -import qualified CCIP.Math as Math +import qualified CCIP.CodecV1.Math template MathHarness with @@ -20,51 +20,51 @@ template MathHarness localDecimals : Int controller owner do - pure (Math.calculateLocalAmountChecked label remoteAmount remoteDecimals localDecimals) + pure (CCIP.CodecV1.Math.calculateLocalAmountChecked label remoteAmount remoteDecimals localDecimals) usd8 : Decimal -> Numeric 0 usd8 d = intToNumeric (truncate (d * 100000000.0)) testMulDivDown_SmallValues = script do - Math.mulDivDown 7.0 3.0 2.0 === 10.0 - Math.mulDivDown 5.0 3.0 2.0 === 7.0 - Math.mulDivDown 1.0 1.0 3.0 === 0.0 - Math.mulDivDown 10.0 10.0 3.0 === 33.0 - Math.mulDivDown 123.0 456.0 1.0 === 56088.0 + CCIP.CodecV1.Math.mulDivDown 7.0 3.0 2.0 === 10.0 + CCIP.CodecV1.Math.mulDivDown 5.0 3.0 2.0 === 7.0 + CCIP.CodecV1.Math.mulDivDown 1.0 1.0 3.0 === 0.0 + CCIP.CodecV1.Math.mulDivDown 10.0 10.0 3.0 === 33.0 + CCIP.CodecV1.Math.mulDivDown 123.0 456.0 1.0 === 56088.0 testMulDivDown_E8Scale = script do let oneDollarInCents : Numeric 0 = 100.0 let usd8PerUsdCent : Numeric 0 = 1000000.0 let premiumIdentity : Numeric 0 = 100000000.0 - let feeUsd8 = Math.mulDivDown oneDollarInCents usd8PerUsdCent 1.0 + let feeUsd8 = CCIP.CodecV1.Math.mulDivDown oneDollarInCents usd8PerUsdCent 1.0 feeUsd8 === 100000000.0 - Math.mulDivDown feeUsd8 premiumIdentity (usd8 20.0) === 5000000.0 + CCIP.CodecV1.Math.mulDivDown feeUsd8 premiumIdentity (usd8 20.0) === 5000000.0 testMulDivDown_LargePrice = script do - let feeUsd8 = Math.mulDivDown 250.0 1000000.0 1.0 + let feeUsd8 = CCIP.CodecV1.Math.mulDivDown 250.0 1000000.0 1.0 let veryLargePrice = usd8 10000000.0 - Math.mulDivDown feeUsd8 100000000.0 veryLargePrice === 25.0 + CCIP.CodecV1.Math.mulDivDown feeUsd8 100000000.0 veryLargePrice === 25.0 testDecimalBoundaryShifts = script do - Math.decimalToNumeric0 1.0 === 10000000000.0 - Math.decimalToNumeric0 0.0000000001 === 1.0 - Math.numeric0ToDecimal 10000000000.0 === 1.0 - Math.numeric0ToDecimal 1.0 === 0.0000000001 + CCIP.CodecV1.Math.decimalToNumeric0 1.0 === 10000000000.0 + CCIP.CodecV1.Math.decimalToNumeric0 0.0000000001 === 1.0 + CCIP.CodecV1.Math.numeric0ToDecimal 10000000000.0 === 1.0 + CCIP.CodecV1.Math.numeric0ToDecimal 1.0 === 0.0000000001 testCalculateLocalAmountChecked_EqualDecimals = script do - Math.calculateLocalAmountChecked "test" 123456789.0 18 18 === 123456789.0 - Math.calculateLocalAmountChecked "test" 0.0 6 6 === 0.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 123456789.0 18 18 === 123456789.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 0.0 6 6 === 0.0 testCalculateLocalAmountChecked_ScaleUp = script do - Math.calculateLocalAmountChecked "test" 1.0 6 18 === 1000000000000.0 - Math.calculateLocalAmountChecked "test" 1000000.0 6 18 === 1000000000000000000.0 - Math.calculateLocalAmountChecked "test" 1.0 0 18 === 1000000000000000000.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 1.0 6 18 === 1000000000000.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 1000000.0 6 18 === 1000000000000000000.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 1.0 0 18 === 1000000000000000000.0 testCalculateLocalAmountChecked_ScaleUpBoundary_Succeeds = script do let largestPassing : Numeric 0 = 99999999999999999999999999.0 - Math.calculateLocalAmountChecked "test" largestPassing 6 18 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" largestPassing 6 18 === 99999999999999999999999999000000000000.0 - Math.calculateLocalAmountChecked "test" 9.0 0 37 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 9.0 0 37 === 90000000000000000000000000000000000000.0 testCalculateLocalAmountChecked_ScaleUpBoundary_Fails = script do @@ -87,15 +87,15 @@ testCalculateLocalAmountChecked_ScaleUpBoundary_Fails = script do localDecimals = 37 testCalculateLocalAmountChecked_ScaleDownExact = script do - Math.calculateLocalAmountChecked "test" 1000000000000000000.0 18 6 === 1000000.0 - Math.calculateLocalAmountChecked "test" 1000000000000.0 18 6 === 1.0 - Math.calculateLocalAmountChecked "test" 5000000000000000000.0 18 0 === 5.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 1000000000000000000.0 18 6 === 1000000.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 1000000000000.0 18 6 === 1.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 5000000000000000000.0 18 0 === 5.0 testCalculateLocalAmountChecked_ScaleDownInexactRoundsDown = script do - Math.calculateLocalAmountChecked "test" 1234567890123456789.0 18 6 === 1234567.0 - Math.calculateLocalAmountChecked "test" 999999999999.0 18 6 === 0.0 - Math.calculateLocalAmountChecked "test" 1500000000000.0 18 6 === 1.0 - Math.calculateLocalAmountChecked "test" 1999999999999.0 18 6 === 1.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 1234567890123456789.0 18 6 === 1234567.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 999999999999.0 18 6 === 0.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 1500000000000.0 18 6 === 1.0 + CCIP.CodecV1.Math.calculateLocalAmountChecked "test" 1999999999999.0 18 6 === 1.0 testCalculateLocalAmountChecked_RejectsNegativeOrUnsupported = script do owner <- allocateParty "negative-owner" diff --git a/contracts/ccip/test/daml/common/MessageCodecV1.daml b/contracts/ccip/test/daml/common/MessageCodecV1.daml index 6cd7d7850..9e2fd62ce 100644 --- a/contracts/ccip/test/daml/common/MessageCodecV1.daml +++ b/contracts/ccip/test/daml/common/MessageCodecV1.daml @@ -7,31 +7,31 @@ import DA.Crypto.Text (byteCount) import DA.Text qualified as Text import DA.Optional -import CCIP.FinalityConfig qualified as FinalityCodec import qualified Splice.Api.Token.HoldingV1 -import CCIP.MessageCodecV1 qualified as MessageCodecV1 -import CCIP.LockReleaseTokenPool qualified as LockReleaseTokenPool -import CCIP.OnRamp qualified as OnRamp -import CCIP.Uint256 qualified as Uint256 +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.CodecV1.MessageCodecV1 +import qualified CCIP.CodecV1.Uint256 +import qualified CCIP.LockReleaseTokenPoolV1 +import qualified CCIP.RuntimeV1.OnRamp finalityConfig n = if n == 0 - then FinalityCodec.waitForFinalityDecoded + then CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded else fromSomeNote "unsafeDecodeRequestedFinality: invalid finality config" - (FinalityCodec.decodeRequestedFinality (fromSome do - flagsHex <- MessageCodecV1.encodeUint16 0 - blockConfirmationsHex <- MessageCodecV1.encodeUint16 n + (CCIP.CodecV1.FinalityConfig.decodeRequestedFinality (fromSome do + flagsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + blockConfirmationsHex <- CCIP.CodecV1.MessageCodecV1.encodeUint16 n pure (flagsHex <> blockConfirmationsHex))) setup = script do -- ======== Encoding Tests ======== -- Test encoding edge cases - let encodeZero8 = MessageCodecV1.encodeUint8 0 - let encodeMax8 = MessageCodecV1.encodeUint8 255 - let encodeOverflow8 = MessageCodecV1.encodeUint8 256 - let encodeNegative8 = MessageCodecV1.encodeUint8 (-1) + let encodeZero8 = CCIP.CodecV1.MessageCodecV1.encodeUint8 0 + let encodeMax8 = CCIP.CodecV1.MessageCodecV1.encodeUint8 255 + let encodeOverflow8 = CCIP.CodecV1.MessageCodecV1.encodeUint8 256 + let encodeNegative8 = CCIP.CodecV1.MessageCodecV1.encodeUint8 (-1) encodeZero8 === Some "00" encodeMax8 === Some "ff" @@ -39,10 +39,10 @@ setup = script do encodeNegative8 === None debug("uint8 encoding edge cases passed") - let encodeZero16 = MessageCodecV1.encodeUint16 0 - let encodeMax16 = MessageCodecV1.encodeUint16 65535 - let encodeOverflow16 = MessageCodecV1.encodeUint16 65536 - let encodeNegative16 = MessageCodecV1.encodeUint16 (-1) + let encodeZero16 = CCIP.CodecV1.MessageCodecV1.encodeUint16 0 + let encodeMax16 = CCIP.CodecV1.MessageCodecV1.encodeUint16 65535 + let encodeOverflow16 = CCIP.CodecV1.MessageCodecV1.encodeUint16 65536 + let encodeNegative16 = CCIP.CodecV1.MessageCodecV1.encodeUint16 (-1) encodeZero16 === Some "0000" encodeMax16 === Some "ffff" @@ -50,10 +50,10 @@ setup = script do encodeNegative16 === None debug("uint16 encoding edge cases passed") - let encodeZero32 = MessageCodecV1.encodeUint32 0 - let encodeMax32 = MessageCodecV1.encodeUint32 4294967295 - let encodeOverflow32 = MessageCodecV1.encodeUint32 4294967296 - let encodeNegative32 = MessageCodecV1.encodeUint32 (-1) + let encodeZero32 = CCIP.CodecV1.MessageCodecV1.encodeUint32 0 + let encodeMax32 = CCIP.CodecV1.MessageCodecV1.encodeUint32 4294967295 + let encodeOverflow32 = CCIP.CodecV1.MessageCodecV1.encodeUint32 4294967296 + let encodeNegative32 = CCIP.CodecV1.MessageCodecV1.encodeUint32 (-1) encodeZero32 === Some "00000000" encodeMax32 === Some "ffffffff" @@ -61,10 +61,10 @@ setup = script do encodeNegative32 === None debug("uint32 encoding edge cases passed") - let encodeZero64 = MessageCodecV1.encodeUint64 0.0 - let encodeMax64 = MessageCodecV1.encodeUint64 18446744073709551615.0 - let encodeOverflow64 = MessageCodecV1.encodeUint64 18446744073709551616.0 - let encodeNegative64 = MessageCodecV1.encodeUint64 (-1.0) + let encodeZero64 = CCIP.CodecV1.MessageCodecV1.encodeUint64 0.0 + let encodeMax64 = CCIP.CodecV1.MessageCodecV1.encodeUint64 18446744073709551615.0 + let encodeOverflow64 = CCIP.CodecV1.MessageCodecV1.encodeUint64 18446744073709551616.0 + let encodeNegative64 = CCIP.CodecV1.MessageCodecV1.encodeUint64 (-1.0) encodeZero64 === Some "0000000000000000" encodeMax64 === Some "ffffffffffffffff" @@ -72,13 +72,13 @@ setup = script do encodeNegative64 === None debug("uint64 encoding edge cases passed") - let encodeZero256 = MessageCodecV1.encodeUint256 0.0 - let encodeSmall256 = MessageCodecV1.encodeUint256 1000000.0 + let encodeZero256 = CCIP.CodecV1.MessageCodecV1.encodeUint256 0.0 + let encodeSmall256 = CCIP.CodecV1.MessageCodecV1.encodeUint256 1000000.0 -- Numeric 0 can only hold up to ~1e38, so max uint256 (~1.16e77) can't be -- expressed as a literal. Test the largest value Numeric 0 can represent and -- verify the overflow guard via the exceedsMaxUint256 string comparison. - let encodeLargeInRange = MessageCodecV1.encodeUint256 99999999999999999999999999999999999999.0 - let encodeNegative256 = MessageCodecV1.encodeUint256 (-1.0) + let encodeLargeInRange = CCIP.CodecV1.MessageCodecV1.encodeUint256 99999999999999999999999999999999999999.0 + let encodeNegative256 = CCIP.CodecV1.MessageCodecV1.encodeUint256 (-1.0) encodeZero256 === Some "0000000000000000000000000000000000000000000000000000000000000000" encodeSmall256 === Some "00000000000000000000000000000000000000000000000000000000000f4240" @@ -90,29 +90,29 @@ setup = script do party <- allocateParty "testParty" -- Test encodePartyAddress produces 32-byte hash - let partyAddr = MessageCodecV1.encodePartyAddress party + let partyAddr = CCIP.CodecV1.MessageCodecV1.encodePartyAddress party Text.length partyAddr === 64 -- 32 bytes = 64 hex chars -- Test encodeInstanceAddress produces 32-byte hash - let instanceAddr = MessageCodecV1.encodeInstanceAddress "test-instance" party + let instanceAddr = CCIP.CodecV1.MessageCodecV1.encodeInstanceAddress "test-instance" party Text.length instanceAddr === 64 -- 32 bytes = 64 hex chars let ccvAddr1 = "1111111111111111111111111111111111111111111111111111111111111111" let ccvAddr2 = "2222222222222222222222222222222222222222222222222222222222222222" let executorAddr = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - let hashForward = MessageCodecV1.computeCCVAndExecutorHash [ccvAddr1, ccvAddr2] executorAddr - let hashReverse = MessageCodecV1.computeCCVAndExecutorHash [ccvAddr2, ccvAddr1] executorAddr + let hashForward = CCIP.CodecV1.MessageCodecV1.computeCCVAndExecutorHash [ccvAddr1, ccvAddr2] executorAddr + let hashReverse = CCIP.CodecV1.MessageCodecV1.computeCCVAndExecutorHash [ccvAddr2, ccvAddr1] executorAddr assertMsg "ccvAndExecutorHash must preserve CCV ordering" (hashForward /= hashReverse) debug("ccvAndExecutorHash ordering test passed") assertMsg "no-execution sentinel should produce different hash" - (MessageCodecV1.computeCCVAndExecutorHash [ccvAddr1, ccvAddr2] OnRamp.noExecutionAddressBytes /= hashForward) + (CCIP.CodecV1.MessageCodecV1.computeCCVAndExecutorHash [ccvAddr1, ccvAddr2] CCIP.RuntimeV1.OnRamp.noExecutionAddressBytes /= hashForward) debug("no-execution sentinel hashing test passed") - OnRamp.noExecutionAddressBytes + CCIP.RuntimeV1.OnRamp.noExecutionAddressBytes === "eba517d200000000000000000000000000000000000000000000000000000000" - byteCount OnRamp.noExecutionAddressBytes === 32 + byteCount CCIP.RuntimeV1.OnRamp.noExecutionAddressBytes === 32 debug("no-execution sentinel encoding test passed") -- Test InstrumentId round-trip with new id@party format @@ -120,7 +120,7 @@ setup = script do admin = party id = "LINK" - let encodedInstrumentId = MessageCodecV1.encodeInstrumentId instrumentId + let encodedInstrumentId = CCIP.CodecV1.MessageCodecV1.encodeInstrumentId instrumentId debug ("--- PASS ---") @@ -130,7 +130,7 @@ setup = script do -- execGasLimit(4) + ccipReceiveGasLimit(4) + finality(4) + ccvAndExecutorHash(32) -- Variable section: onRampLen(1)+onRamp + offRampLen(1)+offRamp + senderLen(1)+sender + -- receiverLen(1)+receiver + destBlobLen(2)+destBlob + tokenLen(2)+token + dataLen(2)+data - let msg = MessageCodecV1.MessageV1 + let msg = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 123.0 destChainSelector = 456.0 @@ -144,24 +144,24 @@ setup = script do sender = "CD1722F3947DEf4Cf144679Da39c4c32BDC35681" receiver = "B6D4805bf6943c5875C0C7b67EDa24b2bDACBF6e" destBlob = "636f6d706c65782064657374696e6174696f6e20626c6f62" - tokenTransfer = Some (MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 1000000.0) + tokenTransfer = Some (CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 1000000.0) sourcePoolAddress = "ed3ee8542acd9e483c658350ad4984483eb0afdc" sourceTokenAddress = "c283f6085a391df8e3f78ddc49c6b47016122838" destTokenAddress = "c22ff98123e0785520915c5bd97e83ac649180a1" tokenReceiver = "bcd565166cafb25d53079c7e6522c18c2c0e39c3" extraData = "746f6b656e2065787472612064617461") messageData = "6d657373616765207769746820746f6b656e2064617461" - let encodedMessage = Text.asciiToLower (MessageCodecV1.encodeMessageV1 msg) + let encodedMessage = Text.asciiToLower (CCIP.CodecV1.MessageCodecV1.encodeMessageV1 msg) debug("Encoded MessageV1: " <> encodedMessage) -- ======== Decoding Tests ======== -- Test uint8 decoding - let test8_0 = MessageCodecV1.decodeUint8 "00" - let test8_1 = MessageCodecV1.decodeUint8 "01" - let test8_255 = MessageCodecV1.decodeUint8 "ff" - let test8_invalid = MessageCodecV1.decodeUint8 "0000" -- wrong length + let test8_0 = CCIP.CodecV1.MessageCodecV1.decodeUint8 "00" + let test8_1 = CCIP.CodecV1.MessageCodecV1.decodeUint8 "01" + let test8_255 = CCIP.CodecV1.MessageCodecV1.decodeUint8 "ff" + let test8_invalid = CCIP.CodecV1.MessageCodecV1.decodeUint8 "0000" -- wrong length test8_0 === Some 0 test8_1 === Some 1 @@ -170,11 +170,11 @@ setup = script do debug("uint8 decoding tests passed") -- Test uint16 decoding - let test16_0 = MessageCodecV1.decodeUint16 "0000" - let test16_1 = MessageCodecV1.decodeUint16 "0001" - let test16_256 = MessageCodecV1.decodeUint16 "0100" - let test16_max = MessageCodecV1.decodeUint16 "ffff" - let test16_invalid = MessageCodecV1.decodeUint16 "00" -- wrong length + let test16_0 = CCIP.CodecV1.MessageCodecV1.decodeUint16 "0000" + let test16_1 = CCIP.CodecV1.MessageCodecV1.decodeUint16 "0001" + let test16_256 = CCIP.CodecV1.MessageCodecV1.decodeUint16 "0100" + let test16_max = CCIP.CodecV1.MessageCodecV1.decodeUint16 "ffff" + let test16_invalid = CCIP.CodecV1.MessageCodecV1.decodeUint16 "00" -- wrong length test16_0 === Some 0 test16_1 === Some 1 @@ -184,11 +184,11 @@ setup = script do debug("uint16 decoding tests passed") -- Test uint32 decoding - let test32_0 = MessageCodecV1.decodeUint32 "00000000" - let test32_1 = MessageCodecV1.decodeUint32 "00000001" - let test32_65536 = MessageCodecV1.decodeUint32 "00010000" - let test32_max = MessageCodecV1.decodeUint32 "ffffffff" - let test32_invalid = MessageCodecV1.decodeUint32 "0000" -- wrong length + let test32_0 = CCIP.CodecV1.MessageCodecV1.decodeUint32 "00000000" + let test32_1 = CCIP.CodecV1.MessageCodecV1.decodeUint32 "00000001" + let test32_65536 = CCIP.CodecV1.MessageCodecV1.decodeUint32 "00010000" + let test32_max = CCIP.CodecV1.MessageCodecV1.decodeUint32 "ffffffff" + let test32_invalid = CCIP.CodecV1.MessageCodecV1.decodeUint32 "0000" -- wrong length test32_0 === Some 0 test32_1 === Some 1 @@ -198,13 +198,13 @@ setup = script do debug("uint32 decoding tests passed") -- Test uint64 decoding - let test64_0 = MessageCodecV1.decodeUint64 "0000000000000000" - let test64_1 = MessageCodecV1.decodeUint64 "0000000000000001" - let test64_16 = MessageCodecV1.decodeUint64 "0000000000000010" - let test64_256 = MessageCodecV1.decodeUint64 "0000000000000100" - let test64_65536 = MessageCodecV1.decodeUint64 "0000000000010000" - let test64_max = MessageCodecV1.decodeUint64 "ffffffffffffffff" - let test64_invalid = MessageCodecV1.decodeUint64 "00000000" -- wrong length + let test64_0 = CCIP.CodecV1.MessageCodecV1.decodeUint64 "0000000000000000" + let test64_1 = CCIP.CodecV1.MessageCodecV1.decodeUint64 "0000000000000001" + let test64_16 = CCIP.CodecV1.MessageCodecV1.decodeUint64 "0000000000000010" + let test64_256 = CCIP.CodecV1.MessageCodecV1.decodeUint64 "0000000000000100" + let test64_65536 = CCIP.CodecV1.MessageCodecV1.decodeUint64 "0000000000010000" + let test64_max = CCIP.CodecV1.MessageCodecV1.decodeUint64 "ffffffffffffffff" + let test64_invalid = CCIP.CodecV1.MessageCodecV1.decodeUint64 "00000000" -- wrong length test64_0 === Some 0.0 test64_1 === Some 1.0 @@ -216,11 +216,11 @@ setup = script do debug("uint64 decoding tests passed") -- Test uint256 decoding - let test256_0 = MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000000000000000000" - let test256_1 = MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000000000000000001" - let test256_max64 = MessageCodecV1.decodeUint256 "000000000000000000000000000000000000000000000000ffffffffffffffff" - let test256_tooLargeForNumeric0 = MessageCodecV1.decodeUint256 "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - let test256_invalid = MessageCodecV1.decodeUint256 "0000000000000000" -- wrong length + let test256_0 = CCIP.CodecV1.MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000000000000000000" + let test256_1 = CCIP.CodecV1.MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000000000000000001" + let test256_max64 = CCIP.CodecV1.MessageCodecV1.decodeUint256 "000000000000000000000000000000000000000000000000ffffffffffffffff" + let test256_tooLargeForNumeric0 = CCIP.CodecV1.MessageCodecV1.decodeUint256 "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + let test256_invalid = CCIP.CodecV1.MessageCodecV1.decodeUint256 "0000000000000000" -- wrong length test256_0 === Some 0.0 test256_1 === Some 1.0 @@ -232,7 +232,7 @@ setup = script do -- ======== Round-Trip Tests ======== -- Test round-trip encoding/decoding - case MessageCodecV1.decodeMessageV1 encodedMessage of + case CCIP.CodecV1.MessageCodecV1.decodeMessageV1 encodedMessage of Some decodedMsg -> do debug("Round-trip test: Decoding successful") decodedMsg.sourceChainSelector === msg.sourceChainSelector @@ -261,14 +261,14 @@ setup = script do -- Test 1: TokenTransfer encoding (from EVM test__encodeTokenTransferV1_checkRawBytes) -- Input: amount=100, sourcePoolAddress=0x1234567890abcdef, etc. - let tokenTransferTest = MessageCodecV1.TokenTransferV1 with - amount = fromSome (MessageCodecV1.encodeUint256 100.0) + let tokenTransferTest = CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with + amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 100.0) sourcePoolAddress = "1234567890abcdef" sourceTokenAddress = "abcdef1234567890" destTokenAddress = "fedcba0987654321" tokenReceiver = "aabbccdd" extraData = "0c117e57da7a" - let encodedTokenTransfer = Text.asciiToLower (MessageCodecV1.encodeTokenTransferV1 tokenTransferTest) + let encodedTokenTransfer = Text.asciiToLower (CCIP.CodecV1.MessageCodecV1.encodeTokenTransferV1 tokenTransferTest) -- Expected structure: version(1) + amount(32) + sourcePoolLen(1) + sourcePool(8) + -- sourceTokenLen(1) + sourceToken(8) + destTokenLen(1) + destToken(8) + -- tokenReceiverLen(1) + tokenReceiver(4) + extraDataLen(2) + extraData(6) = 73 bytes = 146 hex chars @@ -279,13 +279,13 @@ setup = script do debug("TokenTransfer encoding length test PASSED") -- Test 2: Empty message encoding (minimal message) - let emptyMsg = MessageCodecV1.MessageV1 with + let emptyMsg = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 0.0 destChainSelector = 0.0 sequenceNumber = 0.0 executionGasLimit = 0 ccipReceiveGasLimit = 0 - finality = FinalityCodec.waitForFinalityDecoded + finality = CCIP.CodecV1.FinalityConfig.waitForFinalityDecoded ccvAndExecutorHash = "0000000000000000000000000000000000000000000000000000000000000000" onRampAddress = "" offRampAddress = "" @@ -294,7 +294,7 @@ setup = script do destBlob = "" tokenTransfer = None messageData = "" - let encodedEmptyMsg = Text.asciiToLower (MessageCodecV1.encodeMessageV1 emptyMsg) + let encodedEmptyMsg = Text.asciiToLower (CCIP.CodecV1.MessageCodecV1.encodeMessageV1 emptyMsg) -- Expected: MESSAGE_V1_BASE_SIZE = 79 bytes = 158 hex chars -- Static(69) + onRampLen(1) + offRampLen(1) + senderLen(1) + receiverLen(1) + -- destBlobLen(2) + tokenLen(2) + dataLen(2) = 79 @@ -305,7 +305,7 @@ setup = script do -- Test 3: Verify messageId computation -- messageId = keccak256(encodedMessage) - let msgId = MessageCodecV1.messageId msg + let msgId = CCIP.CodecV1.MessageCodecV1.messageId msg debug("MessageId: " <> msgId) -- The messageId should be a 32-byte (64 hex char) keccak256 hash Text.length msgId === 64 @@ -319,23 +319,23 @@ setup = script do testDecodeUint256_Numeric0Boundary : Script () testDecodeUint256_Numeric0Boundary = script do -- 38 nines — largest integer that fits in Numeric 0 - MessageCodecV1.decodeUint256 "000000000000000000000000000000004b3b4ca85a86c47a098a223fffffffff" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "000000000000000000000000000000004b3b4ca85a86c47a098a223fffffffff" === Some 99999999999999999999999999999999999999.0 -- 37 nines — comfortably within range - MessageCodecV1.decodeUint256 "000000000000000000000000000000000785ee10d5da46d900f4369fffffffff" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "000000000000000000000000000000000785ee10d5da46d900f4369fffffffff" === Some 9999999999999999999999999999999999999.0 -- 10^36 — large value well within range - MessageCodecV1.decodeUint256 "0000000000000000000000000000000000c097ce7bc90715b34b9f1000000000" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "0000000000000000000000000000000000c097ce7bc90715b34b9f1000000000" === Some 1000000000000000000000000000000000000.0 -- 10^38 — one above Numeric 0 range - MessageCodecV1.decodeUint256 "000000000000000000000000000000004b3b4ca85a86c47a098a224000000000" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "000000000000000000000000000000004b3b4ca85a86c47a098a224000000000" === None -- uint256 max — well above Numeric 0 range - MessageCodecV1.decodeUint256 "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" === None debug "testDecodeUint256_Numeric0Boundary: PASSED" @@ -345,27 +345,27 @@ testDecodeUint256_Numeric0Boundary = script do testDecodeUint256_HexArithmetic : Script () testDecodeUint256_HexArithmetic = script do -- 0xdeadbeef = 3735928559 - MessageCodecV1.decodeUint256 "00000000000000000000000000000000000000000000000000000000deadbeef" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "00000000000000000000000000000000000000000000000000000000deadbeef" === Some 3735928559.0 -- 1e18 (0xDE0B6B3A7640000) — standard 18-decimal token unit - MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000de0b6b3a7640000" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000de0b6b3a7640000" === Some 1000000000000000000.0 -- 0xabcdef0123456789 — exercises hex digits a through f - MessageCodecV1.decodeUint256 "000000000000000000000000000000000000000000000000abcdef0123456789" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "000000000000000000000000000000000000000000000000abcdef0123456789" === Some 12379813738877118345.0 -- 0xffffffffffff (6 bytes of 0xff) — stress test for repeated carries - MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000000ffffffffffff" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000000ffffffffffff" === Some 281474976710655.0 -- uint64 max — already tested in setup but verify here in isolation - MessageCodecV1.decodeUint256 "000000000000000000000000000000000000000000000000ffffffffffffffff" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "000000000000000000000000000000000000000000000000ffffffffffffffff" === Some 18446744073709551615.0 -- 7e12 (0x65DD0837000) — the exact amount used in decimal conversion integration test - MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000000065dd0837000" + CCIP.CodecV1.MessageCodecV1.decodeUint256 "0000000000000000000000000000000000000000000000000000065dd0837000" === Some 7000000000000.0 debug "testDecodeUint256_HexArithmetic: PASSED" @@ -373,14 +373,14 @@ testDecodeUint256_HexArithmetic = script do -- End-to-end: decode a full token transfer and verify extraData round-trips testDecodeTokenTransfer_WithExtraData : Script () testDecodeTokenTransfer_WithExtraData = script do - let amount = fromSome (MessageCodecV1.encodeUint256 7000000000000.0) + let amount = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 7000000000000.0) let sourcePool = "7e3febbdaf80e7e96c1ae107508ec3fafc36d7f3" let sourceToken = "acdafefb07bff5b120b7afa6ea777cf7eabacc0d" let destToken = "2851f23b4fbecadbe74222334f9d9032e6cb3f4a77ae563ec17de729bec33d33" let receiver = "d73bc3441bce8f77ba3c605808d1b781910119725cb33636f34e2b86c7df0044" - let sourcePoolData = fromSome (MessageCodecV1.encodeUint256 18.0) + let sourcePoolData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 18.0) - let tt = MessageCodecV1.TokenTransferV1 with + let tt = CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with amount sourcePoolAddress = sourcePool sourceTokenAddress = sourceToken @@ -388,88 +388,88 @@ testDecodeTokenTransfer_WithExtraData = script do tokenReceiver = receiver extraData = sourcePoolData - let encoded = MessageCodecV1.encodeTokenTransferV1 tt - let decoded = fromSome (MessageCodecV1.decodeTokenTransfer encoded) + let encoded = CCIP.CodecV1.MessageCodecV1.encodeTokenTransferV1 tt + let decoded = fromSome (CCIP.CodecV1.MessageCodecV1.decodeTokenTransfer encoded) decoded.amount === amount decoded.extraData === sourcePoolData decoded.sourcePoolAddress === sourcePool - let sourceDecimals = LockReleaseTokenPool.parseSourcePoolDecimals 6 decoded.extraData + let sourceDecimals = CCIP.LockReleaseTokenPoolV1.parseSourcePoolDecimals 6 decoded.extraData sourceDecimals === 18 - let localAmount = (fromSome (Uint256.calculateLocalAmountFromUint256Checked "testDecodeTokenTransfer_WithExtraData" decoded.amount sourceDecimals 6)).localAmount + let localAmount = (fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromUint256Checked "testDecodeTokenTransfer_WithExtraData" decoded.amount sourceDecimals 6)).localAmount localAmount === 7.0 debug "testDecodeTokenTransfer_WithExtraData: PASSED" testUint256_TextBytesRoundTripAndValidation : Script () testUint256_TextBytesRoundTripAndValidation = script do - let maxBytes = fromSome (Uint256.decimalTextToUint256Bytes Uint256.maxUint256DecimalText) - Uint256.uint256BytesToDecimalText maxBytes === Some Uint256.maxUint256DecimalText - Uint256.isUint256Bytes maxBytes === True + let maxBytes = fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes CCIP.CodecV1.Uint256.maxUint256DecimalText) + CCIP.CodecV1.Uint256.uint256BytesToDecimalText maxBytes === Some CCIP.CodecV1.Uint256.maxUint256DecimalText + CCIP.CodecV1.Uint256.isUint256Bytes maxBytes === True let aboveNumeric0 = "100000000000000000000000000000000000000" - let aboveNumeric0Bytes = fromSome (Uint256.decimalTextToUint256Bytes aboveNumeric0) - Uint256.uint256BytesToDecimalText aboveNumeric0Bytes === Some aboveNumeric0 - Uint256.decimalTextFitsNumeric0 aboveNumeric0 === False - Uint256.decimalTextFitsNumeric0 Uint256.maxNumeric0DecimalText === True + let aboveNumeric0Bytes = fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes aboveNumeric0) + CCIP.CodecV1.Uint256.uint256BytesToDecimalText aboveNumeric0Bytes === Some aboveNumeric0 + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 aboveNumeric0 === False + CCIP.CodecV1.Uint256.decimalTextFitsNumeric0 CCIP.CodecV1.Uint256.maxNumeric0DecimalText === True - Uint256.decimalTextToUint256Bytes "00000123" === Uint256.decimalTextToUint256Bytes "123" - Uint256.decimalTextToUint256Bytes "" === None - Uint256.decimalTextToUint256Bytes "-1" === None - Uint256.decimalTextToUint256Bytes "1.0" === None - Uint256.decimalTextToUint256Bytes "abc" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "00000123" === CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "123" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "-1" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "1.0" === None + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "abc" === None - let aboveUint256 = Uint256.maxUint256DecimalText <> "0" - Uint256.decimalTextToUint256Bytes aboveUint256 === None + let aboveUint256 = CCIP.CodecV1.Uint256.maxUint256DecimalText <> "0" + CCIP.CodecV1.Uint256.decimalTextToUint256Bytes aboveUint256 === None debug "testUint256_TextBytesRoundTripAndValidation: PASSED" testUint256_LocalAmountConversion_EqualDecimals : Script () testUint256_LocalAmountConversion_EqualDecimals = script do - let sameDecimals = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "same-decimals" "1234567890" 18 18) + let sameDecimals = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "same-decimals" "1234567890" 18 18) sameDecimals.localAmount === 1234567890.0 sameDecimals.truncatedRemainder === "0" sameDecimals.wasTruncated === False - let maxNumeric = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "max-numeric" Uint256.maxNumeric0DecimalText 18 18) + let maxNumeric = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "max-numeric" CCIP.CodecV1.Uint256.maxNumeric0DecimalText 18 18) maxNumeric.localAmount === 99999999999999999999999999999999999999.0 - Uint256.calculateLocalAmountFromDecimalTextChecked "too-large-same-decimals" "100000000000000000000000000000000000000" 18 18 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "too-large-same-decimals" "100000000000000000000000000000000000000" 18 18 === None - Uint256.calculateLocalAmountFromDecimalTextChecked "above-uint256-downscale" (Uint256.maxUint256DecimalText <> "0") 80 0 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "above-uint256-downscale" (CCIP.CodecV1.Uint256.maxUint256DecimalText <> "0") 80 0 === None debug "testUint256_LocalAmountConversion_EqualDecimals: PASSED" testUint256_LocalAmountConversion_Downscale : Script () testUint256_LocalAmountConversion_Downscale = script do - let oneToken = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "one-token" "1000000000000000000" 18 6) + let oneToken = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "one-token" "1000000000000000000" 18 6) oneToken.localAmount === 1000000.0 oneToken.truncatedRemainder === "0" oneToken.wasTruncated === False - let fractional = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "fractional" "123456789123456789" 18 6) + let fractional = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "fractional" "123456789123456789" 18 6) fractional.localAmount === 123456.0 fractional.truncatedRemainder === "789123456789" fractional.wasTruncated === True - let belowUnit = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "below-unit" "999999999999" 18 6) + let belowUnit = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "below-unit" "999999999999" 18 6) belowUnit.localAmount === 0.0 belowUnit.truncatedRemainder === "999999999999" belowUnit.wasTruncated === True - let exactUnit = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "exact-unit" "1000000000000" 18 6) + let exactUnit = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "exact-unit" "1000000000000" 18 6) exactUnit.localAmount === 1.0 exactUnit.truncatedRemainder === "0" exactUnit.wasTruncated === False - let largeAboveNumeric0 = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "large-above-numeric0" "1000000000000000000000000000000000000000000000000" 30 6) + let largeAboveNumeric0 = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "large-above-numeric0" "1000000000000000000000000000000000000000000000000" 30 6) largeAboveNumeric0.localAmount === 1000000000000000000000000.0 largeAboveNumeric0.wasTruncated === False - let maxUint256TinyLocal = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "max-uint256" Uint256.maxUint256DecimalText 77 0) + let maxUint256TinyLocal = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "max-uint256" CCIP.CodecV1.Uint256.maxUint256DecimalText 77 0) maxUint256TinyLocal.localAmount === 1.0 maxUint256TinyLocal.wasTruncated === True @@ -477,42 +477,42 @@ testUint256_LocalAmountConversion_Downscale = script do testUint256_LocalAmountConversion_Upscale : Script () testUint256_LocalAmountConversion_Upscale = script do - let sixToEighteen = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "six-to-eighteen" "123456" 6 18) + let sixToEighteen = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "six-to-eighteen" "123456" 6 18) sixToEighteen.localAmount === 123456000000000000.0 sixToEighteen.wasTruncated === False - let zeroToEighteen = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "zero-to-eighteen" "1" 0 18) + let zeroToEighteen = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "zero-to-eighteen" "1" 0 18) zeroToEighteen.localAmount === 1000000000000000000.0 - let boundary = fromSome (Uint256.calculateLocalAmountFromDecimalTextChecked "upscale-boundary" "99999999999999999999999999" 6 18) + let boundary = fromSome (CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "upscale-boundary" "99999999999999999999999999" 6 18) boundary.localAmount === 99999999999999999999999999000000000000.0 - Uint256.calculateLocalAmountFromDecimalTextChecked "upscale-overflow" "100000000000000000000000000" 6 18 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "upscale-overflow" "100000000000000000000000000" 6 18 === None - Uint256.calculateLocalAmountFromDecimalTextChecked "negative-decimals" "1" (-1) 18 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "negative-decimals" "1" (-1) 18 === None - Uint256.calculateLocalAmountFromDecimalTextChecked "too-many-decimals" "1" 18 256 + CCIP.CodecV1.Uint256.calculateLocalAmountFromDecimalTextChecked "too-many-decimals" "1" 18 256 === None debug "testUint256_LocalAmountConversion_Upscale: PASSED" testMessageCodec_TokenTransferAmountAboveNumeric0Decodes : Script () testMessageCodec_TokenTransferAmountAboveNumeric0Decodes = script do - let amountAboveNumeric0 = fromSome (Uint256.decimalTextToUint256Bytes "100000000000000000000000000000000000000") - let maxAmount = fromSome (Uint256.decimalTextToUint256Bytes Uint256.maxUint256DecimalText) + let amountAboveNumeric0 = fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes "100000000000000000000000000000000000000") + let maxAmount = fromSome (CCIP.CodecV1.Uint256.decimalTextToUint256Bytes CCIP.CodecV1.Uint256.maxUint256DecimalText) - let tt = MessageCodecV1.TokenTransferV1 with + let tt = CCIP.CodecV1.MessageCodecV1.TokenTransferV1 with amount = amountAboveNumeric0 sourcePoolAddress = "1234567890abcdef" sourceTokenAddress = "abcdef1234567890" destTokenAddress = "fedcba0987654321" tokenReceiver = "aabbccdd" - extraData = fromSome (MessageCodecV1.encodeUint256 18.0) - let decodedTt = fromSome (MessageCodecV1.decodeTokenTransfer (MessageCodecV1.encodeTokenTransferV1 tt)) + extraData = fromSome (CCIP.CodecV1.MessageCodecV1.encodeUint256 18.0) + let decodedTt = fromSome (CCIP.CodecV1.MessageCodecV1.decodeTokenTransfer (CCIP.CodecV1.MessageCodecV1.encodeTokenTransferV1 tt)) decodedTt.amount === amountAboveNumeric0 - Uint256.uint256BytesToDecimalText decodedTt.amount === Some "100000000000000000000000000000000000000" + CCIP.CodecV1.Uint256.uint256BytesToDecimalText decodedTt.amount === Some "100000000000000000000000000000000000000" - let msg = MessageCodecV1.MessageV1 with + let msg = CCIP.CodecV1.MessageCodecV1.MessageV1 with sourceChainSelector = 123.0 destChainSelector = 456.0 sequenceNumber = 789.0 @@ -527,9 +527,9 @@ testMessageCodec_TokenTransferAmountAboveNumeric0Decodes = script do destBlob = "" tokenTransfer = Some (tt with amount = maxAmount) messageData = "" - let decodedMsg = fromSome (MessageCodecV1.decodeMessageV1 (MessageCodecV1.encodeMessageV1 msg)) + let decodedMsg = fromSome (CCIP.CodecV1.MessageCodecV1.decodeMessageV1 (CCIP.CodecV1.MessageCodecV1.encodeMessageV1 msg)) let decodedMsgTt = fromSome decodedMsg.tokenTransfer decodedMsgTt.amount === maxAmount - Uint256.uint256BytesToDecimalText decodedMsgTt.amount === Some Uint256.maxUint256DecimalText + CCIP.CodecV1.Uint256.uint256BytesToDecimalText decodedMsgTt.amount === Some CCIP.CodecV1.Uint256.maxUint256DecimalText debug "testMessageCodec_TokenTransferAmountAboveNumeric0Decodes: PASSED" diff --git a/contracts/ccip/tickets/daml.yaml b/contracts/ccip/tickets/daml.yaml new file mode 100644 index 000000000..7ee63aea6 --- /dev/null +++ b/contracts/ccip/tickets/daml.yaml @@ -0,0 +1,18 @@ +sdk-version: 3.4.11 +name: ccip-tickets +source: daml +version: 2.0.0 +build-options: + - "-Wno-crypto-text-is-alpha" + - "-Werror=unused-dependency" +data-dependencies: + - ../../dependencies/splice/splice-api-token-metadata-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-holding-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-burn-mint-v1-1.0.0.dar + - ../../dependencies/splice/splice-api-token-transfer-instruction-v1-1.0.0.dar + - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar + - ../codec/.daml/dist/ccip-codec-2.0.0.dar + - ../api/.daml/dist/ccip-api-2.0.0.dar +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/core/daml/CCIP/Tickets.daml b/contracts/ccip/tickets/daml/CCIP/TicketsV1.daml similarity index 61% rename from contracts/ccip/core/daml/CCIP/Tickets.daml rename to contracts/ccip/tickets/daml/CCIP/TicketsV1.daml index 51fb2160e..60d9706c8 100644 --- a/contracts/ccip/core/daml/CCIP/Tickets.daml +++ b/contracts/ccip/tickets/daml/CCIP/TicketsV1.daml @@ -1,32 +1,15 @@ --- | Ticket contracts for cross-participant CCIP communication. -module CCIP.Tickets where +module CCIP.TicketsV1 where import DA.Crypto.Text (BytesHex) import DA.List (dedup) -import qualified CCIP.FinalityConfig -import Chainlink.InstanceAddress (RawInstanceAddress) import qualified Splice.Api.Token.HoldingV1 +import qualified Splice.Api.Token.MetadataV1 --- | Issuer type for receipts. -data IssuerType - = IssuerType_CCV -- Cross-chain verifier - | IssuerType_Pool -- Token pool - | IssuerType_Executor -- Executor - | IssuerType_Network -- Network/protocol fee - deriving (Eq, Show) +import qualified Chainlink.InstanceAddress --- | Fee/gas accounting for a single entity (CCV, pool, executor, or network). -data Receipt = Receipt - with - issuerType : IssuerType -- Type of issuer - issuerAddress : BytesHex -- 32-byte instance address - versionTag : Optional BytesHex -- 4-byte version tag for CCVs, None for pools/network - destGasLimit : Int -- Gas allocated for dest chain execution - destBytesOverhead : Int -- Data availability overhead in bytes - feeTokenAmount : Numeric 0 -- Fee amount in fee token units - extraArgs : BytesHex -- Entity-specific arguments - deriving (Eq, Show) +import qualified CCIP.CodecV1.FinalityConfig +import qualified CCIP.APIV1.ExecutingMessage -- | Ticket issued by consuming ExecutingMessageV1 after successful message verification. -- The signatory set includes CCV-owner parties accumulated during inbound verification, @@ -39,15 +22,15 @@ template TokenReceiveTicket ccvOwners : [Party] -- Exact CCV instances that verified the message on the inbound path. -- Pools use these to preserve instance-level trust checks. - verifiedCCVs : [RawInstanceAddress] + verifiedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] -- Resolved inbound pool-required CCV instances captured at execute-time. -- Uses EVM-equivalent semantics: -- * empty pool list means source defaults -- * useDefaultCCVs sentinel expands to source defaults - requiredInboundPoolCCVs : [RawInstanceAddress] + requiredInboundPoolCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] tokenAdminRegistryInstanceId : Text -- Identifies the issuing TAR -- Exact registered pool instance that performed inbound pool verification. - poolAddress : RawInstanceAddress + poolAddress : Chainlink.InstanceAddress.RawInstanceAddress poolOwner : Party -- Observer - pool that should release receiver : Party -- Message receiver (observer) tokenReceiver : Party -- Who gets the tokens (may differ from receiver) @@ -58,7 +41,9 @@ template TokenReceiveTicket messageId : BytesHex sourceChainSelector : Numeric 0 - finality : CCIP.FinalityConfig.FinalityConfig + finality : CCIP.CodecV1.FinalityConfig.FinalityConfig + + context : Splice.Api.Token.MetadataV1.ChoiceContext where signatory dedup ([ccipOwner, poolOwner] ++ ccvOwners) observer receiver, tokenReceiver @@ -70,3 +55,10 @@ template TokenReceiveTicket controller ccipOwner, poolOwner do pure () + + interface instance CCIP.APIV1.ExecutingMessage.ITokenReceiveTicket for TokenReceiveTicket where + view = CCIP.APIV1.ExecutingMessage.TokenReceiveTicketView with + ccipOwner = ccipOwner + poolOwner = poolOwner + ccvOwners = ccvOwners + context = Splice.Api.Token.MetadataV1.emptyChoiceContext diff --git a/contracts/ccip/utils/daml.yaml b/contracts/ccip/utils/daml.yaml new file mode 100644 index 000000000..f1b991fcd --- /dev/null +++ b/contracts/ccip/utils/daml.yaml @@ -0,0 +1,13 @@ +sdk-version: 3.4.11 +name: ccip-utils +source: daml +version: 2.0.0 +build-options: + - "-Wno-crypto-text-is-alpha" + - "-Werror=unused-dependency" +data-dependencies: + - ../../dependencies/splice/splice-api-token-metadata-v1-1.0.0.dar + - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/core/daml/CCIP/ContextCodec.daml b/contracts/ccip/utils/daml/CCIP/UtilsV1/Context.daml similarity index 59% rename from contracts/ccip/core/daml/CCIP/ContextCodec.daml rename to contracts/ccip/utils/daml/CCIP/UtilsV1/Context.daml index 544f6d1f9..a7a7a4da2 100644 --- a/contracts/ccip/core/daml/CCIP/ContextCodec.daml +++ b/contracts/ccip/utils/daml/CCIP/UtilsV1/Context.daml @@ -1,25 +1,12 @@ --- | Codec module for ChoiceContext and AnyValue encoding/decoding --- Used by pool contracts for MCMS operations that need to set poolReceiveContext -module CCIP.ContextCodec - ( -- ChoiceContext encoding - encodeChoiceContext - , decodeChoiceContextAt - -- AnyValue encoding (for extensibility) - , encodeAnyValue - , decodeAnyValueAt - -- TextMap encoding - , encodeTextMapAnyValue - , decodeTextMapAnyValueAt - ) where - -import DA.Time (RelTime, subTime, addRelTime, convertMicrosecondsToRelTime, convertRelTimeToMicroseconds, time) +module CCIP.UtilsV1.Context where + import DA.Date (date, Month(..), subDate, addDays) -import DA.TextMap (TextMap) +import DA.Time import DA.TextMap qualified as TextMap import DA.Crypto.Text (BytesHex) import DA.Optional (fromSome) -import Splice.Api.Token.MetadataV1 (ChoiceContext(..), AnyValue(..)) +import Splice.Api.Token.MetadataV1 import MCMS.Codec ( extractBytes @@ -37,6 +24,150 @@ import MCMS.Codec , decodeList ) +-- Choice context creation and parsing +-------------------------------------- + +-- | Values that can be converted to AnyValue +class ToAnyValue a where + toAnyValue : a -> AnyValue + +-- | Convenience function to create maps that contain an optional value if it is +-- set. See its use sites for examples. +addOptionalAnyValue : ToAnyValue a => Text -> Optional a -> TextMap.TextMap AnyValue -> TextMap.TextMap AnyValue +addOptionalAnyValue _k None m = m +addOptionalAnyValue k (Some value) m = TextMap.insert k (toAnyValue value) m + +-- | Attempt to parse a value from AnyValue. +-- +-- If a type implements both `ToAnyValue` and `FromAnyValue` then it must hold that +-- `fromAnyValue (toAnyValue x) = Right x` for all `x`. +class FromAnyValue a where + fromAnyValue : AnyValue -> Either Text a + +-- | Lookup and decode a value within a choice context. +lookupFromContext : FromAnyValue a => ChoiceContext -> Text -> Either Text (Optional a) +lookupFromContext context k = do + case TextMap.lookup k context.values of + None -> pure None + Some av -> case fromAnyValue av of + Left err -> fail $ "Failed to decode context value for '" <> k <> "': " <> err + Right v -> pure (Some v) + +-- | Get a value from a choice context, failing if it is not present or fails to parse. +getFromContext : FromAnyValue a => ChoiceContext -> Text -> Either Text a +getFromContext context k = do + optValue <- lookupFromContext context k + case optValue of + None -> fail $ "Missing context entry for: " <> k + Some v -> pure v + +-- | Convenience version of `lookupFromContext` that raises the failure within the `Update`. +lookupFromContextU : FromAnyValue a => ChoiceContext -> Text -> Update (Optional a) +lookupFromContextU context k = either fail pure $ lookupFromContext context k + +-- | Convenience version of `getFromContext` that raises the failure within the `Update`. +getFromContextU : FromAnyValue a => ChoiceContext -> Text -> Update a +getFromContextU context k = either fail pure $ getFromContext context k + + +-- instances for ToAnyValue +--------------------------- + +instance ToAnyValue Text where + toAnyValue t = AV_Text t + +instance ToAnyValue Int where + toAnyValue x = AV_Int x + +instance ToAnyValue Decimal where + toAnyValue t = AV_Decimal t + +instance ToAnyValue Bool where + toAnyValue x = AV_Bool x + +instance ToAnyValue Date where + toAnyValue x = AV_Date x + +instance ToAnyValue Time where + toAnyValue x = AV_Time x + +instance ToAnyValue RelTime where + toAnyValue x = AV_RelTime x +instance ToAnyValue Party where + toAnyValue p = AV_Party p + +instance ToAnyValue (ContractId t) where + toAnyValue x = AV_ContractId $ coerceContractId x + +instance ToAnyValue a => ToAnyValue [a] where + toAnyValue = AV_List . map toAnyValue + +instance ToAnyValue ChoiceContext where + toAnyValue (ChoiceContext values) = AV_Map values + + +-- FromAnyValue instances +------------------------- + +instance FromAnyValue Text where + fromAnyValue (AV_Text t) = Right t + fromAnyValue av = Left $ "expected Text, got: " <> show av + +instance FromAnyValue Int where + fromAnyValue (AV_Int i) = Right i + fromAnyValue av = Left $ "expected Int, got: " <> show av + +instance FromAnyValue Decimal where + fromAnyValue (AV_Decimal i) = Right i + fromAnyValue av = Left $ "expected Decimal, got: " <> show av + +instance FromAnyValue Bool where + fromAnyValue (AV_Bool b) = Right b + fromAnyValue av = Left $ "expected bool, got: " <> show av + +instance FromAnyValue Date where + fromAnyValue (AV_Date p) = Right p + fromAnyValue av = Left $ "expected Date, got: " <> show av + +instance FromAnyValue Time where + fromAnyValue (AV_Time t) = Right t + fromAnyValue av = Left $ "expected Time, got: " <> show av +instance FromAnyValue RelTime where + fromAnyValue (AV_RelTime t) = Right t + fromAnyValue av = Left $ "expected RelTime, got: " <> show av + +instance FromAnyValue Party where + fromAnyValue (AV_Party p) = Right p + fromAnyValue av = Left $ "expected Party, got: " <> show av + +instance Template t => FromAnyValue (ContractId t) where + fromAnyValue (AV_ContractId av) = Right (coerceContractId av) + fromAnyValue av = Left $ "expected contract id, got: " <> show av + +instance FromAnyValue a => FromAnyValue [a] where + fromAnyValue (AV_List avs) = mapA fromAnyValue avs + fromAnyValue av = Left $ "expected list, got: " <> show av + +instance FromAnyValue ChoiceContext where + fromAnyValue (AV_Map values) = Right $ ChoiceContext with values + fromAnyValue av = Left $ "expected map, got: " <> show av + +instance FromAnyValue AnyValue where + fromAnyValue av = Right av + +instance FromAnyValue (TextMap.TextMap AnyValue) where + fromAnyValue (AV_Map values) = Right values + fromAnyValue av = Left $ "expected map, got: " <> show av + +instance FromAnyValue (TextMap.TextMap Text) where + fromAnyValue (AV_Map values) = do + let kvs = TextMap.toList values + results <- mapA (\(k, av) -> do + txt <- fromAnyValue av + pure (k, txt)) kvs + pure $ TextMap.fromList results + fromAnyValue av = Left $ "expected map, got: " <> show av + -- =========================================================================== -- CHOICECONTEXT ENCODING/DECODING -- ChoiceContext is a wrapper around TextMap AnyValue @@ -58,7 +189,7 @@ decodeChoiceContextAt encoded offset = do -- =========================================================================== -- | Encode TextMap AnyValue -encodeTextMapAnyValue : TextMap AnyValue -> BytesHex +encodeTextMapAnyValue : TextMap.TextMap AnyValue -> BytesHex encodeTextMapAnyValue m = let entries = TextMap.toList m count = length entries @@ -66,14 +197,14 @@ encodeTextMapAnyValue m = in fromSome (encodeUint8 count) <> foldl (\acc entry -> acc <> encodeEntry entry) "" entries -- | Decode TextMap AnyValue -decodeTextMapAnyValueAt : BytesHex -> Int -> Optional (TextMap AnyValue, Int) +decodeTextMapAnyValueAt : BytesHex -> Int -> Optional (TextMap.TextMap AnyValue, Int) decodeTextMapAnyValueAt encoded offset = do countHex <- extractBytes encoded offset 1 count <- decodeUint8 countHex decodeTextMapEntries encoded (offset + 1) count [] -- | Helper to decode TextMap entries -decodeTextMapEntries : BytesHex -> Int -> Int -> [(Text, AnyValue)] -> Optional (TextMap AnyValue, Int) +decodeTextMapEntries : BytesHex -> Int -> Int -> [(Text, AnyValue)] -> Optional (TextMap.TextMap AnyValue, Int) decodeTextMapEntries _ offset 0 acc = Some (TextMap.fromList (reverse acc), offset) decodeTextMapEntries encoded offset remaining acc = do (key, offset1) <- decodeTextAt encoded offset diff --git a/contracts/cmd/damlcodecs/main.go b/contracts/cmd/damlcodecs/main.go index a46d6ee44..9fa4f0a1e 100644 --- a/contracts/cmd/damlcodecs/main.go +++ b/contracts/cmd/damlcodecs/main.go @@ -20,14 +20,14 @@ var customCodecs = map[string]damltemplate.CustomCodec{ "RawInstanceAddress": { EncodeFunc: "encodeRawInstanceAddress", DecodeFunc: "decodeRawInstanceAddressAt", - ImportModule: "CCIP.Codec", + ImportModule: "CCIP.CodecV1", EncodeListFunc: "encodeRawInstanceAddressList", DecodeListFunc: "decodeRawInstanceAddressList", }, "InstrumentId": { EncodeFunc: "encodeInstrumentId", DecodeFunc: "decodeInstrumentId", - ImportModule: "CCIP.Codec", + ImportModule: "CCIP.CodecV1", EncodeListFunc: "encodeInstrumentIdList", DecodeListFunc: "decodeInstrumentIdList", }, @@ -46,7 +46,7 @@ var customCodecs = map[string]damltemplate.CustomCodec{ "FinalityConfig": { EncodeFunc: "encodeRequestedFinality", DecodeFunc: "decodeRequestedFinalityAt", - ImportModule: "CCIP.Codec", + ImportModule: "CCIP.CodecV1", }, } diff --git a/contracts/contracts.go b/contracts/contracts.go index 350169e66..e65f0ef1d 100644 --- a/contracts/contracts.go +++ b/contracts/contracts.go @@ -18,19 +18,23 @@ const ( Coin = Package("coin") Link = Package("link") - ChainlinkAPI = Package("chainlink-api") - ChainlinkInstanceAPI = ChainlinkAPI + ChainlinkAPI = Package("chainlink-api") MCMSAPI = Package("mcms-api") MCMSCore = Package("mcms-core") - MCMS = MCMSCore MCMSTest = Package("mcms-test") GlobalConfig = Package("globalconfig") + CCIPAPI = Package("ccip-api") + CCIPCodec = Package("ccip-codec") + CCIPTickets = Package("ccip-tickets") + CCIPEvents = Package("ccip-events") + CCIPRateLimiter = Package("ccip-rate-limiter") + CCIPClientAPI = Package("ccip-client-api") + CCIPUtils = Package("ccip-utils") CCIPCore = Package("ccip-core") CCIPExtensionAPI = Package("ccip-extension-api") CCIPRuntime = Package("ccip-runtime") - CCIPMain = CCIPRuntime CCIPSender = Package("ccip-sender") CCIPReceiver = Package("ccip-receiver") CCIPCommitteeVerifier = Package("ccip-committee-verifier") @@ -40,16 +44,6 @@ const ( CCIPFactory = Package("ccip-factory") CCIPTest = Package("ccip-test") - CCIPClient = CCIPCore - CCIPCommon = CCIPCore - CCIPFeeQuoter = CCIPCore - CCIPTokenAdminRegistry = CCIPCore - CCIPRMN = CCIPCore - CCIPOnRamp = CCIPRuntime - CCIPOffRamp = CCIPRuntime - CCIPPerPartyRouter = CCIPRuntime - CCIPPoolInterfaces = CCIPExtensionAPI - SpliceApiTokenBurnMintV1 = Package("splice-api-token-burn-mint-v1") SpliceApiTokenHoldingV1 = Package("splice-api-token-holding-v1") SpliceApiTokenMetadataV1 = Package("splice-api-token-metadata-v1") @@ -73,6 +67,13 @@ var Versions map[Package][]string = map[Package][]string{ MCMSTest: []string{CurrentVersion}, GlobalConfig: []string{"1.0.0", "2.0.0", CurrentVersion}, + CCIPAPI: []string{CurrentVersion}, + CCIPCodec: []string{CurrentVersion}, + CCIPTickets: []string{CurrentVersion}, + CCIPEvents: []string{CurrentVersion}, + CCIPRateLimiter: []string{CurrentVersion}, + CCIPClientAPI: []string{CurrentVersion}, + CCIPUtils: []string{CurrentVersion}, CCIPCore: []string{"2.0.0", CurrentVersion}, CCIPExtensionAPI: []string{"2.0.0", CurrentVersion}, CCIPRuntime: []string{"2.0.0", CurrentVersion}, @@ -136,6 +137,12 @@ var OutputDirs = map[Package][]string{ MCMSCore: []string{"mcms", "core"}, MCMSTest: []string{"mcms", "mcmstest"}, + CCIPAPI: []string{"ccip", "ccipapi"}, + CCIPCodec: []string{"ccip", "ccipcodec"}, + CCIPTickets: []string{"ccip", "tickets"}, + CCIPEvents: []string{"ccip", "events"}, + CCIPRateLimiter: []string{"ccip", "ratelimiter"}, + CCIPClientAPI: []string{"ccip", "clientapi"}, CCIPCore: []string{"ccip", "core"}, CCIPExtensionAPI: []string{"ccip", "extensionapi"}, CCIPRuntime: []string{"ccip", "ccipruntime"}, diff --git a/contracts/dars/current/ccip-api-current.dar b/contracts/dars/current/ccip-api-current.dar new file mode 100644 index 000000000..fcd029083 Binary files /dev/null and b/contracts/dars/current/ccip-api-current.dar differ diff --git a/contracts/dars/current/ccip-burn-mint-token-pool-current.dar b/contracts/dars/current/ccip-burn-mint-token-pool-current.dar index e5b672d4a..31838e0fa 100644 Binary files a/contracts/dars/current/ccip-burn-mint-token-pool-current.dar and b/contracts/dars/current/ccip-burn-mint-token-pool-current.dar differ diff --git a/contracts/dars/current/ccip-client-api-current.dar b/contracts/dars/current/ccip-client-api-current.dar new file mode 100644 index 000000000..668b8da60 Binary files /dev/null and b/contracts/dars/current/ccip-client-api-current.dar differ diff --git a/contracts/dars/current/ccip-codec-current.dar b/contracts/dars/current/ccip-codec-current.dar new file mode 100644 index 000000000..3a875612b Binary files /dev/null and b/contracts/dars/current/ccip-codec-current.dar differ diff --git a/contracts/dars/current/ccip-committee-verifier-current.dar b/contracts/dars/current/ccip-committee-verifier-current.dar index 3c71b364f..a90013051 100644 Binary files a/contracts/dars/current/ccip-committee-verifier-current.dar and b/contracts/dars/current/ccip-committee-verifier-current.dar differ diff --git a/contracts/dars/current/ccip-core-current.dar b/contracts/dars/current/ccip-core-current.dar index 31f1bd458..30eb0a283 100644 Binary files a/contracts/dars/current/ccip-core-current.dar and b/contracts/dars/current/ccip-core-current.dar differ diff --git a/contracts/dars/current/ccip-events-current.dar b/contracts/dars/current/ccip-events-current.dar new file mode 100644 index 000000000..218a59bbe Binary files /dev/null and b/contracts/dars/current/ccip-events-current.dar differ diff --git a/contracts/dars/current/ccip-executor-current.dar b/contracts/dars/current/ccip-executor-current.dar index 8b18f776c..10d47ba0d 100644 Binary files a/contracts/dars/current/ccip-executor-current.dar and b/contracts/dars/current/ccip-executor-current.dar differ diff --git a/contracts/dars/current/ccip-extension-api-current.dar b/contracts/dars/current/ccip-extension-api-current.dar index fb6c55d03..a1d16b431 100644 Binary files a/contracts/dars/current/ccip-extension-api-current.dar and b/contracts/dars/current/ccip-extension-api-current.dar differ diff --git a/contracts/dars/current/ccip-factory-current.dar b/contracts/dars/current/ccip-factory-current.dar index b7108985f..c460cede7 100644 Binary files a/contracts/dars/current/ccip-factory-current.dar and b/contracts/dars/current/ccip-factory-current.dar differ diff --git a/contracts/dars/current/ccip-lock-release-token-pool-current.dar b/contracts/dars/current/ccip-lock-release-token-pool-current.dar index 0086c1dee..69d990060 100644 Binary files a/contracts/dars/current/ccip-lock-release-token-pool-current.dar and b/contracts/dars/current/ccip-lock-release-token-pool-current.dar differ diff --git a/contracts/dars/current/ccip-rate-limiter-current.dar b/contracts/dars/current/ccip-rate-limiter-current.dar new file mode 100644 index 000000000..b6260aa86 Binary files /dev/null and b/contracts/dars/current/ccip-rate-limiter-current.dar differ diff --git a/contracts/dars/current/ccip-receiver-current.dar b/contracts/dars/current/ccip-receiver-current.dar index 806e7ddea..c08ac7fb4 100644 Binary files a/contracts/dars/current/ccip-receiver-current.dar and b/contracts/dars/current/ccip-receiver-current.dar differ diff --git a/contracts/dars/current/ccip-runtime-current.dar b/contracts/dars/current/ccip-runtime-current.dar index c77204a09..9b908d222 100644 Binary files a/contracts/dars/current/ccip-runtime-current.dar and b/contracts/dars/current/ccip-runtime-current.dar differ diff --git a/contracts/dars/current/ccip-sender-current.dar b/contracts/dars/current/ccip-sender-current.dar index 8ad004359..ec6be249b 100644 Binary files a/contracts/dars/current/ccip-sender-current.dar and b/contracts/dars/current/ccip-sender-current.dar differ diff --git a/contracts/dars/current/ccip-test-current.dar b/contracts/dars/current/ccip-test-current.dar index 3c46ac418..7a56ded0d 100644 Binary files a/contracts/dars/current/ccip-test-current.dar and b/contracts/dars/current/ccip-test-current.dar differ diff --git a/contracts/dars/current/ccip-tickets-current.dar b/contracts/dars/current/ccip-tickets-current.dar new file mode 100644 index 000000000..07324d228 Binary files /dev/null and b/contracts/dars/current/ccip-tickets-current.dar differ diff --git a/contracts/dars/current/ccip-utils-current.dar b/contracts/dars/current/ccip-utils-current.dar new file mode 100644 index 000000000..9c5598e2d Binary files /dev/null and b/contracts/dars/current/ccip-utils-current.dar differ diff --git a/contracts/multi-package.yaml b/contracts/multi-package.yaml index 9390d3006..ba1504250 100644 --- a/contracts/multi-package.yaml +++ b/contracts/multi-package.yaml @@ -11,8 +11,12 @@ packages: - mcms/test/globalconfig-v1 - mcms/test/globalconfig-v1-upgraded + - ccip/api + - ccip/client-api + - ccip/codec - ccip/core - ccip/extension-api + - ccip/events - ccip/runtime - ccip/sender - ccip/receiver @@ -20,8 +24,11 @@ packages: - ccip/committee-verifier - ccip/pools/lock-release-token-pool - ccip/pools/burn-mint-token-pool + - ccip/rate-limiter - ccip/factory - ccip/test + - ccip/tickets + - ccip/utils - test/interfaces - test/proxy diff --git a/deployment/adapters/deploy_chain_contracts_adapter.go b/deployment/adapters/deploy_chain_contracts_adapter.go index 6783eb0c2..ef0f56468 100644 --- a/deployment/adapters/deploy_chain_contracts_adapter.go +++ b/deployment/adapters/deploy_chain_contracts_adapter.go @@ -18,6 +18,7 @@ import ( cldf_ops "github.com/smartcontractkit/chainlink-deployments-framework/operations" "github.com/smartcontractkit/go-daml/pkg/types" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/executor" @@ -264,7 +265,7 @@ func defaultExecutorParams(ownerParty string) sequences.ExecutorParams { } } -func requestedFinality(cfg finality.Config) core.FinalityConfig { +func requestedFinality(cfg finality.Config) ccipcodec.FinalityConfig { if cfg.IsZero() || cfg.WaitForFinality { return waitForFinalityRequested() } @@ -275,16 +276,16 @@ func requestedFinality(cfg finality.Config) core.FinalityConfig { return waitForSafeRequested() } if cfg.BlockDepth > 0 { - return core.FinalityConfig{BlockDepth: new(types.INT64(cfg.BlockDepth))} + return ccipcodec.FinalityConfig{BlockDepth: new(types.INT64(cfg.BlockDepth))} } return waitForFinalityRequested() } -func waitForFinalityRequested() core.FinalityConfig { - return core.FinalityConfig{WaitForFinality: &types.UNIT{}} +func waitForFinalityRequested() ccipcodec.FinalityConfig { + return ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}} } -func waitForSafeRequested() core.FinalityConfig { - return core.FinalityConfig{WaitForSafe: &types.UNIT{}} +func waitForSafeRequested() ccipcodec.FinalityConfig { + return ccipcodec.FinalityConfig{WaitForSafe: &types.UNIT{}} } diff --git a/deployment/changesets/configure_chain_contracts_test.go b/deployment/changesets/configure_chain_contracts_test.go index 67fa4d331..88f9c11a2 100644 --- a/deployment/changesets/configure_chain_contracts_test.go +++ b/deployment/changesets/configure_chain_contracts_test.go @@ -104,7 +104,7 @@ func TestConfigureGlobalConfig_MCMSProposal(t *testing.T) { participant := cantonChain.Participants[0] party := participant.PartyID - uploadDARs(t, participant, contracts.CCIPCommon, contracts.MCMS) + uploadDARs(t, participant, contracts.CCIPRuntime, contracts.MCMSCore) gcAddrRef := deployGlobalConfig(t, bundle, *cantonChain, party) gcRawAddr, err := contracts.RawInstanceAddressFromString(gcAddrRef.Labels.List()[0]) @@ -217,14 +217,10 @@ func uploadDARs(t *testing.T, participant canton.Participant, packages ...contra func uploadChainContractDARs(t *testing.T, participant canton.Participant) { t.Helper() uploadDARs(t, participant, - contracts.CCIPCommon, - contracts.CCIPOffRamp, - contracts.CCIPOnRamp, - contracts.CCIPTokenAdminRegistry, + contracts.CCIPRuntime, + contracts.CCIPCore, contracts.CCIPCommitteeVerifier, contracts.CCIPLockReleaseTokenPool, - contracts.CCIPPerPartyRouter, - contracts.CCIPRMN, ) } diff --git a/deployment/changesets/deploy_chain_contracts_test.go b/deployment/changesets/deploy_chain_contracts_test.go index ff96a11b0..3c473fcad 100644 --- a/deployment/changesets/deploy_chain_contracts_test.go +++ b/deployment/changesets/deploy_chain_contracts_test.go @@ -41,13 +41,10 @@ func TestDeployChainContracts(t *testing.T) { // Upload Dars uploadDARs(t, participant, - contracts.CCIPCommon, - contracts.CCIPOffRamp, - contracts.CCIPOnRamp, - contracts.CCIPTokenAdminRegistry, + contracts.CCIPRuntime, + contracts.CCIPCore, contracts.CCIPCommitteeVerifier, contracts.CCIPLockReleaseTokenPool, - contracts.CCIPPerPartyRouter, ) reporter := cld_ops.NewMemoryReporter() diff --git a/deployment/changesets/deploy_lock_release_token_pool.go b/deployment/changesets/deploy_lock_release_token_pool.go index 569d1cb7e..f2ee39e27 100644 --- a/deployment/changesets/deploy_lock_release_token_pool.go +++ b/deployment/changesets/deploy_lock_release_token_pool.go @@ -40,7 +40,7 @@ type DeployLockReleaseTokenPoolConfig struct { // Optional; defaults to empty map. RemoteChainConfigs map[types.NUMERIC]lockreleasetokenpool.RemoteChainConfig // Optional; defaults to empty map. - TokenTransferFeeConfigs map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig2 + TokenTransferFeeConfigs map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig // Optional; zero-value deps if not provided. Deps lockreleasetokenpool.LockReleaseTokenPoolDeps // If set, the pool is registered with this TokenAdminRegistry (ProposeAdministrator, AcceptAdminRole, SetPool) in the same changeset. @@ -88,7 +88,7 @@ func (d DeployLockReleaseTokenPool) Apply(e cldf.Environment, config CantonCSDep } tokenTransferFeeConfigs := cfg.TokenTransferFeeConfigs if tokenTransferFeeConfigs == nil { - tokenTransferFeeConfigs = map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig2{} + tokenTransferFeeConfigs = map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig{} } var rawPoolAddr contracts.RawInstanceAddress diff --git a/deployment/changesets/deploy_lock_release_token_pool_test.go b/deployment/changesets/deploy_lock_release_token_pool_test.go index 12d75ffb9..44012e085 100644 --- a/deployment/changesets/deploy_lock_release_token_pool_test.go +++ b/deployment/changesets/deploy_lock_release_token_pool_test.go @@ -43,9 +43,9 @@ func TestDeployTokenPool(t *testing.T) { participant := cantonChain.Participants[0] party := participant.PartyID - commonDar, err := contracts.GetDar(contracts.CCIPCommon, contracts.CurrentVersion) + commonDar, err := contracts.GetDar(contracts.CCIPRuntime, contracts.CurrentVersion) require.NoError(t, err) - tarDar, err := contracts.GetDar(contracts.CCIPTokenAdminRegistry, contracts.CurrentVersion) + tarDar, err := contracts.GetDar(contracts.CCIPCore, contracts.CurrentVersion) require.NoError(t, err) poolDar, err := contracts.GetDar(contracts.CCIPLockReleaseTokenPool, contracts.CurrentVersion) require.NoError(t, err) @@ -70,7 +70,7 @@ func TestDeployTokenPool(t *testing.T) { // Deploy TAR so we have an instance address for register-with-TAR tarAddrRef, err := cld_ops.ExecuteOperation(bundle, token_admin_registry.Deploy, *cantonChain, contract.DeployInput[core.TokenAdminRegistry]{ Template: core.TokenAdminRegistry{ - Owner: types.PARTY(party), + CcipOwner: types.PARTY(party), InstanceId: "", EntryCount: 0, }, diff --git a/deployment/operations/ccip/factory/factory.go b/deployment/operations/ccip/factory/factory.go index 383533b15..215ffe07b 100644 --- a/deployment/operations/ccip/factory/factory.go +++ b/deployment/operations/ccip/factory/factory.go @@ -245,7 +245,6 @@ func encodeDeployOnRamp(args factorybindings.DeployOnRamp) (*bind.EncodedChoice, RmnRemote: args.Contract.Deps.RmnRemote, TokenAdminRegistry: args.Contract.Deps.TokenAdminRegistry, FeeQuoter: args.Contract.Deps.FeeQuoter, - CcvRegistry: args.Contract.Deps.CcvRegistry, MaxUSDCentsPerMsg: args.Contract.MaxUSDCentsPerMsg, }) } diff --git a/deployment/operations/ccip/fee_quoter/fee_quoter.go b/deployment/operations/ccip/fee_quoter/fee_quoter.go index 5209f7acf..6e4f3031e 100644 --- a/deployment/operations/ccip/fee_quoter/fee_quoter.go +++ b/deployment/operations/ccip/fee_quoter/fee_quoter.go @@ -25,13 +25,13 @@ var Deploy = contract.NewDeploy(contract.DeployParams[core.FeeQuoter]{ TypeAndVersion: deployment.NewTypeAndVersion(ContractType, *Version), Description: "Deploys the CCIP FeeQuoter contract on Canton", Validate: func(template core.FeeQuoter) error { - if template.Owner == "" { + if template.CcipOwner == "" { return errors.New("owner cannot be empty") } return nil }, - PackageName: string(contracts.CCIPFeeQuoter), + PackageName: string(contracts.CCIPCore), Prefix: "feequoter", }) diff --git a/deployment/operations/ccip/global_config/global_config.go b/deployment/operations/ccip/global_config/global_config.go index eeda567c8..c38602c2d 100644 --- a/deployment/operations/ccip/global_config/global_config.go +++ b/deployment/operations/ccip/global_config/global_config.go @@ -38,7 +38,7 @@ var Deploy = contract.NewDeploy(contract.DeployParams[core.GlobalConfig]{ return nil }, - PackageName: string(contracts.CCIPCommon), + PackageName: string(contracts.CCIPCore), Prefix: "globalconfig", }) diff --git a/deployment/operations/ccip/offramp/offramp.go b/deployment/operations/ccip/offramp/offramp.go index c1242a807..3190ee1ae 100644 --- a/deployment/operations/ccip/offramp/offramp.go +++ b/deployment/operations/ccip/offramp/offramp.go @@ -26,6 +26,6 @@ var Deploy = contract.NewDeploy(contract.DeployParams[ccipruntime.OffRamp]{ return nil }, - PackageName: string(contracts.CCIPOffRamp), + PackageName: string(contracts.CCIPRuntime), Prefix: "offramp", }) diff --git a/deployment/operations/ccip/onramp/onramp.go b/deployment/operations/ccip/onramp/onramp.go index 8b546e33a..efbbb51cf 100644 --- a/deployment/operations/ccip/onramp/onramp.go +++ b/deployment/operations/ccip/onramp/onramp.go @@ -26,6 +26,6 @@ var Deploy = contract.NewDeploy(contract.DeployParams[ccipruntime.OnRamp]{ return nil }, - PackageName: string(contracts.CCIPOnRamp), + PackageName: string(contracts.CCIPRuntime), Prefix: "onramp", }) diff --git a/deployment/operations/ccip/per_party_router_factory/per_party_router_factory.go b/deployment/operations/ccip/per_party_router_factory/per_party_router_factory.go index c91e12a89..156c27d9f 100644 --- a/deployment/operations/ccip/per_party_router_factory/per_party_router_factory.go +++ b/deployment/operations/ccip/per_party_router_factory/per_party_router_factory.go @@ -29,7 +29,7 @@ var Deploy = contract.NewDeploy(contract.DeployParams[ccipruntime.PerPartyRouter return nil }, - PackageName: string(contracts.CCIPPerPartyRouter), + PackageName: string(contracts.CCIPRuntime), Prefix: "perpartyrouterfactory", }) diff --git a/deployment/operations/ccip/rate_limiter/rate_limiter.go b/deployment/operations/ccip/rate_limiter/rate_limiter.go index 1b16fcd62..dcfdf9113 100644 --- a/deployment/operations/ccip/rate_limiter/rate_limiter.go +++ b/deployment/operations/ccip/rate_limiter/rate_limiter.go @@ -6,7 +6,7 @@ import ( "github.com/Masterminds/semver/v3" "github.com/smartcontractkit/chainlink-deployments-framework/deployment" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ratelimiter" "github.com/smartcontractkit/chainlink-canton/contracts" "github.com/smartcontractkit/chainlink-canton/deployment/utils/operations/contract" ) @@ -16,11 +16,11 @@ var ContractTypeOutbound = deployment.ContractType("CantonTokenPoolOutboundRateL var Version = semver.MustParse("2.0.0") -var DeployInbound = contract.NewDeploy(contract.DeployParams[core.RateLimiter]{ +var DeployInbound = contract.NewDeploy(contract.DeployParams[ratelimiter.RateLimiter]{ Name: "canton/ccip/token_pool_inbound_rate_limiter/deploy", TypeAndVersion: deployment.NewTypeAndVersion(ContractTypeInbound, *Version), Description: "Deploys an Inbound Token Pool Rate Limiter contract on Canton", - Validate: func(template core.RateLimiter) error { + Validate: func(template ratelimiter.RateLimiter) error { if template.PoolInstanceId == "" { return fmt.Errorf("PoolInstanceId is required") } @@ -30,7 +30,7 @@ var DeployInbound = contract.NewDeploy(contract.DeployParams[core.RateLimiter]{ if template.RemoteChainSelector == "" { return fmt.Errorf("RemoteChainSelector is required") } - if template.Direction == core.RateLimitDirectionRateLimitDirection_Outbound { + if template.Direction == ratelimiter.RateLimitDirectionRateLimitDirection_Outbound { return fmt.Errorf("cannot use this operation to deploy an outbound rate limiter") } if template.Mode == "" { @@ -39,15 +39,15 @@ var DeployInbound = contract.NewDeploy(contract.DeployParams[core.RateLimiter]{ return nil }, - PackageName: string(contracts.CCIPCommon), + PackageName: string(contracts.CCIPRateLimiter), Prefix: "inbound-rate-limiter", }) -var DeployOutbound = contract.NewDeploy(contract.DeployParams[core.RateLimiter]{ +var DeployOutbound = contract.NewDeploy(contract.DeployParams[ratelimiter.RateLimiter]{ Name: "canton/ccip/token_pool_outbound_rate_limiter/deploy", TypeAndVersion: deployment.NewTypeAndVersion(ContractTypeOutbound, *Version), Description: "Deploys an Outbound Token Pool Rate Limiter contract on Canton", - Validate: func(template core.RateLimiter) error { + Validate: func(template ratelimiter.RateLimiter) error { if template.PoolInstanceId == "" { return fmt.Errorf("PoolInstanceId is required") } @@ -57,7 +57,7 @@ var DeployOutbound = contract.NewDeploy(contract.DeployParams[core.RateLimiter]{ if template.RemoteChainSelector == "" { return fmt.Errorf("RemoteChainSelector is required") } - if template.Direction == core.RateLimitDirectionRateLimitDirection_Inbound { + if template.Direction == ratelimiter.RateLimitDirectionRateLimitDirection_Inbound { return fmt.Errorf("cannot use this operation to deploy an inbound rate limiter") } if template.Mode == "" { @@ -66,6 +66,6 @@ var DeployOutbound = contract.NewDeploy(contract.DeployParams[core.RateLimiter]{ return nil }, - PackageName: string(contracts.CCIPCommon), + PackageName: string(contracts.CCIPRateLimiter), Prefix: "outbound-rate-limiter", }) diff --git a/deployment/operations/ccip/rmn_remote/rmn_remote.go b/deployment/operations/ccip/rmn_remote/rmn_remote.go index f2c62449c..2a94e881b 100644 --- a/deployment/operations/ccip/rmn_remote/rmn_remote.go +++ b/deployment/operations/ccip/rmn_remote/rmn_remote.go @@ -28,7 +28,7 @@ var Deploy = contract.NewDeploy(contract.DeployParams[core.RMNRemote]{ return nil }, - PackageName: string(contracts.CCIPRMN), + PackageName: string(contracts.CCIPCore), Prefix: "rmn_remote", }) diff --git a/deployment/operations/ccip/token_admin_registry/token_admin_registry.go b/deployment/operations/ccip/token_admin_registry/token_admin_registry.go index 315bb031d..41ff447f7 100644 --- a/deployment/operations/ccip/token_admin_registry/token_admin_registry.go +++ b/deployment/operations/ccip/token_admin_registry/token_admin_registry.go @@ -23,13 +23,13 @@ var Deploy = contract.NewDeploy(contract.DeployParams[core.TokenAdminRegistry]{ TypeAndVersion: deployment.NewTypeAndVersion(ContractType, *Version), Description: "Deploys the CCIP TokenAdminRegistry contract on Canton", Validate: func(template core.TokenAdminRegistry) error { - if template.Owner == "" { + if template.CcipOwner == "" { return errors.New("owner cannot be empty") } return nil }, - PackageName: string(contracts.CCIPTokenAdminRegistry), + PackageName: string(contracts.CCIPCore), Prefix: "core", }) diff --git a/deployment/operations/mcms/mcms.go b/deployment/operations/mcms/mcms.go index 9096d3e87..a9dda9f3c 100644 --- a/deployment/operations/mcms/mcms.go +++ b/deployment/operations/mcms/mcms.go @@ -31,7 +31,7 @@ var Deploy = contract.NewDeploy(contract.DeployParams[mcmsCore.MCMS]{ return nil }, - PackageName: string(contracts.MCMS), + PackageName: string(contracts.MCMSCore), Prefix: "mcms", }) diff --git a/deployment/operations/mcms/mcms_test.go b/deployment/operations/mcms/mcms_test.go index 306a3ba22..9260e5766 100644 --- a/deployment/operations/mcms/mcms_test.go +++ b/deployment/operations/mcms/mcms_test.go @@ -34,7 +34,7 @@ func TestMCMSOps(t *testing.T) { primaryParty := participant.PartyID // Upload Dar - mcmdDar, err := contracts.GetDar(contracts.MCMS, contracts.CurrentVersion) + mcmdDar, err := contracts.GetDar(contracts.MCMSCore, contracts.CurrentVersion) require.NoError(t, err, "failed to get MCMS dar file") _, err = participant.AdminServices.Package.UploadDar(t.Context(), &participantv30.UploadDarRequest{ Dars: []*participantv30.UploadDarRequest_UploadDarData{ diff --git a/deployment/sequences/deploy_chain_contracts.go b/deployment/sequences/deploy_chain_contracts.go index 011570b8d..c9953757d 100644 --- a/deployment/sequences/deploy_chain_contracts.go +++ b/deployment/sequences/deploy_chain_contracts.go @@ -146,7 +146,7 @@ var DeployChainContracts = operations.NewSequence( // Deploy Token Admin Registry deployTokenAdminRegistryReport, err := operations.ExecuteOperation(b, token_admin_registry.Deploy, deps, contract.DeployInput[core.TokenAdminRegistry]{ Template: core.TokenAdminRegistry{ - Owner: types.PARTY(input.CCIPOwnerParty), + CcipOwner: types.PARTY(input.CCIPOwnerParty), EntryCount: 0, }, OwnerParty: types.PARTY(input.CCIPOwnerParty), @@ -171,7 +171,7 @@ var DeployChainContracts = operations.NewSequence( } deployFeeQuoterReport, err := operations.ExecuteOperation(b, fee_quoter.Deploy, deps, contract.DeployInput[core.FeeQuoter]{ Template: core.FeeQuoter{ - Owner: types.PARTY(input.CCIPOwnerParty), + CcipOwner: types.PARTY(input.CCIPOwnerParty), FeeTokens: types.SET{}, DestChainConfigs: nil, TokenTransferFeeConfigs: nil, @@ -256,7 +256,6 @@ var DeployChainContracts = operations.NewSequence( RmnRemote: rmnRemoteRawInstanceAddress.Binding(), TokenAdminRegistry: tokenAdminRegistryRawInstanceAddress.Binding(), FeeQuoter: feeQuoterRawInstanceAddress.Binding(), - CcvRegistry: chainlinkapi.RawInstanceAddress{}, }, }, OwnerParty: types.PARTY(input.CCIPOwnerParty), diff --git a/deployment/sequences/deploy_chain_contracts_from_factory.go b/deployment/sequences/deploy_chain_contracts_from_factory.go index f4d0abcf8..e2fa0dbc4 100644 --- a/deployment/sequences/deploy_chain_contracts_from_factory.go +++ b/deployment/sequences/deploy_chain_contracts_from_factory.go @@ -17,7 +17,6 @@ import ( "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" factorybindings "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/factory" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" "github.com/smartcontractkit/chainlink-canton/contracts" "github.com/smartcontractkit/chainlink-canton/deployment/operations/ccip/committee_verifier" @@ -90,7 +89,7 @@ var DeployChainContractsFromFactory = operations.NewSequence( } tokenAdminRegistryTemplate := core.TokenAdminRegistry{ InstanceId: types.TEXT(tokenAdminRegistryInstanceID), - Owner: ccipOwnerParty, + CcipOwner: ccipOwnerParty, EntryCount: 0, } deployTokenAdminRegistryReport, err := operations.ExecuteOperation(b, factoryops.DeployTokenAdminRegistry, deps, newChoiceInput(factoryRawInstanceAddress, factorybindings.DeployTokenAdminRegistry{Contract: tokenAdminRegistryTemplate}, input.ProposalDriven)) @@ -138,7 +137,7 @@ var DeployChainContractsFromFactory = operations.NewSequence( } feeQuoterTemplate := core.FeeQuoter{ InstanceId: types.TEXT(feeQuoterInstanceID), - Owner: ccipOwnerParty, + CcipOwner: ccipOwnerParty, FeeTokens: types.SET{}, DestChainConfigs: nil, TokenTransferFeeConfigs: nil, @@ -155,13 +154,6 @@ var DeployChainContractsFromFactory = operations.NewSequence( feeQuoterRawInstanceAddress := feeQuoterInstanceID.RawInstanceAddress(ccipOwnerParty) addresses = append(addresses, newAddressRef(deps.ChainSelector(), feeQuoterRawInstanceAddress, fee_quoter.ContractType, fee_quoter.Version, "")) - var firstCommitteeVerifierBinding chainlinkapi.RawInstanceAddress - if len(input.CommitteeVerifiers) == 0 { - if input.CcvRegistryBinding.Unpack == "" { - return sequences.OnChainOutput{}, fmt.Errorf("CcvRegistryBinding is required when CommitteeVerifiers is empty") - } - firstCommitteeVerifierBinding = input.CcvRegistryBinding - } var ccvOwnerParty types.PARTY if len(input.CommitteeVerifiers) > 0 { ccvOwnerParty, err = requireCCVOwnerParty(input) @@ -198,9 +190,6 @@ var DeployChainContractsFromFactory = operations.NewSequence( } proposalOutputs = appendExerciseOutput(proposalOutputs, deployCommitteeVerifierReport.Output, input.ProposalDriven) committeeVerifierRawInstanceAddress := committeeVerifierInstanceID.RawInstanceAddress(committeeVerifierOwner) - if i == 0 { - firstCommitteeVerifierBinding = committeeVerifierRawInstanceAddress.Binding() - } addresses = append(addresses, newAddressRef(deps.ChainSelector(), committeeVerifierRawInstanceAddress, committee_verifier.ContractType, committee_verifier.Version, qualifier)) } @@ -238,7 +227,6 @@ var DeployChainContractsFromFactory = operations.NewSequence( RmnRemote: rmnRemoteRawInstanceAddress.Binding(), TokenAdminRegistry: tokenAdminRegistryRawInstanceAddress.Binding(), FeeQuoter: feeQuoterRawInstanceAddress.Binding(), - CcvRegistry: firstCommitteeVerifierBinding, }, } deployOnRampReport, err := operations.ExecuteOperation(b, factoryops.DeployOnRamp, deps, newChoiceInput(factoryRawInstanceAddress, factorybindings.DeployOnRamp{Contract: onRampTemplate}, input.ProposalDriven)) diff --git a/deployment/sequences/register_token_pool.go b/deployment/sequences/register_token_pool.go index 14491ad9a..e83f8315b 100644 --- a/deployment/sequences/register_token_pool.go +++ b/deployment/sequences/register_token_pool.go @@ -174,7 +174,7 @@ func registerTokenPool(b operations.Bundle, deps canton.Chain, input RegisterTok Args: core.SetPool{ TokenConfigCid: tokenConfigCid, InstrumentId: instrumentId, - TokenPool: &core.PoolRegistration{ + TokenPool: &core.PoolRegistration2{ PoolOwner: poolOwnerPartyTyped, PoolInstanceId: types.TEXT(input.PoolInstanceID), }, diff --git a/deployment/sequences/token_pools.go b/deployment/sequences/token_pools.go index 13939d24a..582916259 100644 --- a/deployment/sequences/token_pools.go +++ b/deployment/sequences/token_pools.go @@ -25,9 +25,10 @@ import ( "github.com/smartcontractkit/chainlink-canton/bindings" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/burnminttokenpool" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" factorybindings "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/factory" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/lockreleasetokenpool" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ratelimiter" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" @@ -64,7 +65,7 @@ type tokenPoolChainUpdate struct { RemoteTokenAddress types.TEXT InboundCCVs []chainlinkapi.RawInstanceAddress OutboundCCVs []chainlinkapi.RawInstanceAddress - FinalityConfig core.FinalityConfig + FinalityConfig ccipcodec.FinalityConfig InboundRateLimiter chainlinkapi.RawInstanceAddress InboundCustomBlockConfirmationsRateLimiter chainlinkapi.RawInstanceAddress OutboundRateLimiter chainlinkapi.RawInstanceAddress @@ -194,7 +195,7 @@ var ConfigureTokenForTransfers = operations.NewSequence( remoteSelectorKeyStr, "outbound", outboundDefaultCfg, - core.RateLimitModeRateLimitMode_DefaultFinality, + ratelimiter.RateLimitModeRateLimitMode_DefaultFinality, &proposalOutputs, ) if err != nil { @@ -214,7 +215,7 @@ var ConfigureTokenForTransfers = operations.NewSequence( remoteSelectorKeyStr, "inbound", inboundDefaultCfg, - core.RateLimitModeRateLimitMode_DefaultFinality, + ratelimiter.RateLimitModeRateLimitMode_DefaultFinality, &proposalOutputs, ) if err != nil { @@ -234,7 +235,7 @@ var ConfigureTokenForTransfers = operations.NewSequence( remoteSelectorKeyStr, "inbound-custom", inboundCustomCfg, - core.RateLimitModeRateLimitMode_CustomFinality, + ratelimiter.RateLimitModeRateLimitMode_CustomFinality, &proposalOutputs, ) if err != nil { @@ -510,7 +511,7 @@ var DeployTokenPoolForToken = operations.NewSequence( InstrumentId: instrumentID, Decimals: types.INT64(10), RemoteChainConfigs: map[types.NUMERIC]lockreleasetokenpool.RemoteChainConfig{}, - TokenTransferFeeConfigs: map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig2{}, + TokenTransferFeeConfigs: map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig{}, PoolReceiveContext: poolReceiveContext, TransferTimeout: lockreleasetokenpool.TransferTimeout{ RelativeHours: new(types.INT64(24)), @@ -620,16 +621,16 @@ var DeployTokenPoolForToken = operations.NewSequence( }, ) -func toCantonFinalityConfig(cfg tokenadaptersfinality.Config) core.FinalityConfig { +func toCantonFinalityConfig(cfg tokenadaptersfinality.Config) ccipcodec.FinalityConfig { switch { case cfg.BlockDepth > 0: - return core.FinalityConfig{BlockDepth: new(types.INT64(cfg.BlockDepth))} + return ccipcodec.FinalityConfig{BlockDepth: new(types.INT64(cfg.BlockDepth))} case cfg.WaitForSafe: - return core.FinalityConfig{WaitForSafe: &types.UNIT{}} + return ccipcodec.FinalityConfig{WaitForSafe: &types.UNIT{}} case cfg.WaitForFinality: - return core.FinalityConfig{WaitForFinality: &types.UNIT{}} + return ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}} default: - return core.FinalityConfig{} + return ccipcodec.FinalityConfig{} } } @@ -694,7 +695,7 @@ func deployTokenPoolRateLimiter( remoteSelectorKey string, direction string, cfg tokenadapters.RateLimiterConfig, - mode core.RateLimitMode, + mode ratelimiter.RateLimitMode, proposalOutputs *[]contract.ExerciseOutput, ) (datastore.AddressRef, chainlinkapi.RawInstanceAddress, error) { qualifier := tokenPoolRateLimiterQualifier(tokenPoolAddress, direction, remoteSelectorKey) @@ -711,9 +712,9 @@ func deployTokenPoolRateLimiter( return ref, raw, nil } - dirEnum := core.RateLimitDirectionRateLimitDirection_Inbound + dirEnum := ratelimiter.RateLimitDirectionRateLimitDirection_Inbound if direction == "outbound" { - dirEnum = core.RateLimitDirectionRateLimitDirection_Outbound + dirEnum = ratelimiter.RateLimitDirectionRateLimitDirection_Outbound } capacity := types.NUMERIC("0") @@ -730,7 +731,7 @@ func deployTokenPoolRateLimiter( return datastore.AddressRef{}, chainlinkapi.RawInstanceAddress{}, err } report, err := operations.ExecuteOperation(b, factoryops.DeployRateLimiter, cantonChain, newChoiceInput(factoryRaw, factorybindings.DeployRateLimiter{ - Contract: core.RateLimiter{ + Contract: ratelimiter.RateLimiter{ InstanceId: types.TEXT(limiterInstanceID), PoolInstanceId: poolMeta.InstanceId, PoolOwner: poolMeta.PoolOwner, diff --git a/deployment/sequences/token_pools_test.go b/deployment/sequences/token_pools_test.go index 73e67cfe3..6cf54328f 100644 --- a/deployment/sequences/token_pools_test.go +++ b/deployment/sequences/token_pools_test.go @@ -8,7 +8,7 @@ import ( "github.com/smartcontractkit/go-daml/pkg/types" "github.com/stretchr/testify/require" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" ) @@ -74,7 +74,7 @@ func TestToCantonFinalityConfig(t *testing.T) { tests := []struct { name string cfg tokenadaptersfinality.Config - want func(t *testing.T, got core.FinalityConfig) + want func(t *testing.T, got ccipcodec.FinalityConfig) }{ { name: "block depth takes precedence over wait for finality", @@ -82,7 +82,7 @@ func TestToCantonFinalityConfig(t *testing.T) { WaitForFinality: true, BlockDepth: 1, }, - want: func(t *testing.T, got core.FinalityConfig) { + want: func(t *testing.T, got ccipcodec.FinalityConfig) { t.Helper() require.NotNil(t, got.BlockDepth) require.Equal(t, types.INT64(1), *got.BlockDepth) @@ -94,7 +94,7 @@ func TestToCantonFinalityConfig(t *testing.T) { cfg: tokenadaptersfinality.Config{ WaitForSafe: true, }, - want: func(t *testing.T, got core.FinalityConfig) { + want: func(t *testing.T, got ccipcodec.FinalityConfig) { t.Helper() require.NotNil(t, got.WaitForSafe) }, @@ -104,7 +104,7 @@ func TestToCantonFinalityConfig(t *testing.T) { cfg: tokenadaptersfinality.Config{ WaitForFinality: true, }, - want: func(t *testing.T, got core.FinalityConfig) { + want: func(t *testing.T, got ccipcodec.FinalityConfig) { t.Helper() require.NotNil(t, got.WaitForFinality) }, diff --git a/eds/internal/api/ccip/ccip.go b/eds/internal/api/ccip/ccip.go index cd6e49179..5e053a6df 100644 --- a/eds/internal/api/ccip/ccip.go +++ b/eds/internal/api/ccip/ccip.go @@ -16,6 +16,7 @@ import ( "github.com/smartcontractkit/chainlink-ccv/protocol" "github.com/smartcontractkit/go-daml/pkg/types" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" @@ -355,19 +356,19 @@ func (s Server) PostCCIPSend(c *gin.Context) { choiceContext := splice_api_token_metadata_v1.ChoiceContext{ Values: map[string]splice_api_token_metadata_v1.AnyValue{ - string(ccipruntime.OnRampKey): { + string(ccipruntime.OnRampContextKey): { AVContractId: new(types.CONTRACT_ID(activeOnRampContract.GetCreatedEvent().GetContractId())), }, - string(core.GlobalConfigKey): { + string(ccipapi.GlobalConfigContextKey): { AVContractId: new(types.CONTRACT_ID(activeGlobalConfigContract.GetCreatedEvent().GetContractId())), }, - string(core.TokenAdminRegistryKey): { + string(ccipapi.TokenAdminRegistryContextKey): { AVContractId: new(types.CONTRACT_ID(activeTokenAdminRegistryContract.GetCreatedEvent().GetContractId())), }, - string(core.RmnRemoteKey): { + string(ccipapi.RmnRemoteContextKey): { AVContractId: new(types.CONTRACT_ID(activeRMNRemoteContract.GetCreatedEvent().GetContractId())), }, - string(core.FeeQuoterKey): { + string(ccipapi.FeeQuoterContextKey): { AVContractId: new(types.CONTRACT_ID(activeFeeQuoterContract.GetCreatedEvent().GetContractId())), }, }, @@ -431,7 +432,7 @@ func (s Server) PostCCIPSend(c *gin.Context) { c.AbortWithStatusJSON(http.StatusBadRequest, oapiCommon.ErrorResponse{Error: fmt.Sprintf("no token pool registered for token: %s", encodedInstrumentId.Hex())}) return } - choiceContext.Values[string(core.TokenConfigKey)] = splice_api_token_metadata_v1.AnyValue{ + choiceContext.Values[string(ccipapi.TokenConfigContextKey)] = splice_api_token_metadata_v1.AnyValue{ AVContractId: new(types.CONTRACT_ID(activeTokenConfigContract.GetCreatedEvent().GetContractId())), } disclosedContracts = append(disclosedContracts, converters.ActiveContractToDisclosedContract(activeTokenConfigContract)) @@ -506,16 +507,16 @@ func (s Server) PostCCIPExecute(c *gin.Context) { choiceContext := splice_api_token_metadata_v1.ChoiceContext{ Values: map[string]splice_api_token_metadata_v1.AnyValue{ - string(ccipruntime.OffRampKey): { + string(ccipruntime.OffRampContextKey): { AVContractId: new(types.CONTRACT_ID(activeOffRampContract.GetCreatedEvent().GetContractId())), }, - string(core.GlobalConfigKey): { + string(ccipapi.GlobalConfigContextKey): { AVContractId: new(types.CONTRACT_ID(activeGlobalConfigContract.GetCreatedEvent().GetContractId())), }, - string(core.TokenAdminRegistryKey): { + string(ccipapi.TokenAdminRegistryContextKey): { AVContractId: new(types.CONTRACT_ID(activeTokenAdminRegistryContract.GetCreatedEvent().GetContractId())), }, - string(core.RmnRemoteKey): { + string(ccipapi.RmnRemoteContextKey): { AVContractId: new(types.CONTRACT_ID(activeRMNRemoteContract.GetCreatedEvent().GetContractId())), }, }, @@ -557,7 +558,7 @@ func (s Server) PostCCIPExecute(c *gin.Context) { return } tokenPool = new(oapiCommon.RawInstanceAddress(contracts.InstanceID(parsedTokenConfig.Pool.PoolInstanceId).RawInstanceAddress(parsedTokenConfig.Pool.PoolOwner))) - choiceContext.Values[string(core.TokenConfigKey)] = splice_api_token_metadata_v1.AnyValue{ + choiceContext.Values[string(ccipapi.TokenConfigContextKey)] = splice_api_token_metadata_v1.AnyValue{ AVContractId: new(types.CONTRACT_ID(activeTokenConfigContract.GetCreatedEvent().GetContractId())), } disclosedContracts = append(disclosedContracts, converters.ActiveContractToDisclosedContract(activeTokenConfigContract)) diff --git a/eds/internal/api/ccip/ccip_test.go b/eds/internal/api/ccip/ccip_test.go index 13f6c4fa6..26f53ba4e 100644 --- a/eds/internal/api/ccip/ccip_test.go +++ b/eds/internal/api/ccip/ccip_test.go @@ -170,7 +170,7 @@ func TestServer_GetTokenAdminRegistryToken(t *testing.T) { tokenAdminRegistry := core.TokenAdminRegistry{ InstanceId: types.TEXT(tokenAdminRegistryAddress.InstanceID()), - Owner: types.PARTY(tokenAdminRegistryAddress.Owner()), + CcipOwner: types.PARTY(tokenAdminRegistryAddress.Owner()), EntryCount: 2, } tokenConfig := core.TokenConfig{ @@ -180,7 +180,7 @@ func TestServer_GetTokenAdminRegistryToken(t *testing.T) { Index: 1, IsCCIPManaged: false, InstrumentId: instrumentId, - TokenPool: &core.PoolRegistration{ + TokenPool: &core.PoolRegistration2{ PoolOwner: types.PARTY(tokenPoolAddress.Owner()), PoolInstanceId: types.TEXT(tokenPoolAddress.InstanceID()), }, @@ -397,7 +397,7 @@ func TestServer_PostCCIPSend(t *testing.T) { return mockActiveContractStore, client } - tokenConfigContract := func(contractId string, instrumentId splice_api_token_holding_v1.InstrumentId, tokenPool *core.PoolRegistration) *apiv2.ActiveContract { + tokenConfigContract := func(contractId string, instrumentId splice_api_token_holding_v1.InstrumentId, tokenPool *core.PoolRegistration2) *apiv2.ActiveContract { encodedInstrumentId := contracts.EncodeInstrumentID(instrumentId) return &apiv2.ActiveContract{CreatedEvent: &apiv2.CreatedEvent{ ContractId: contractId, @@ -416,7 +416,7 @@ func TestServer_PostCCIPSend(t *testing.T) { }), }} } - tokenPoolRegistration := &core.PoolRegistration{ + tokenPoolRegistration := &core.PoolRegistration2{ PoolOwner: types.PARTY(tokenPoolAddress.Owner()), PoolInstanceId: types.TEXT(tokenPoolAddress.InstanceID()), } @@ -444,7 +444,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: true, DefaultExecutor: new(defaultExecutor.Binding()), @@ -472,7 +472,7 @@ func TestServer_PostCCIPSend(t *testing.T) { }, CreateArguments: bindings.MarshalTemplateToRecord(core.TokenAdminRegistry{ InstanceId: "tokenadminregistry", - Owner: "owner", + CcipOwner: "owner", EntryCount: 1, }), }}, true) @@ -982,7 +982,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: false, MessageNetworkFeeUSDCents: "0", @@ -1012,7 +1012,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: true, MessageNetworkFeeUSDCents: "0", @@ -1043,7 +1043,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: true, MessageNetworkFeeUSDCents: "0", @@ -1074,7 +1074,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: true, MessageNetworkFeeUSDCents: "0", @@ -1110,7 +1110,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: true, MessageNetworkFeeUSDCents: "0", @@ -1140,7 +1140,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: true, MessageNetworkFeeUSDCents: "0", @@ -1153,7 +1153,7 @@ func TestServer_PostCCIPSend(t *testing.T) { mockActiveContractStore.EXPECT().Get(cfg.TokenAdminRegistry.InstanceAddress).Return(&apiv2.ActiveContract{CreatedEvent: &apiv2.CreatedEvent{ CreateArguments: bindings.MarshalTemplateToRecord(core.TokenAdminRegistry{ InstanceId: "tokenadminregistry", - Owner: "owner", + CcipOwner: "owner", EntryCount: 1, }), }}, true) @@ -1179,7 +1179,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: true, MessageNetworkFeeUSDCents: "0", @@ -1192,7 +1192,7 @@ func TestServer_PostCCIPSend(t *testing.T) { mockActiveContractStore.EXPECT().Get(cfg.TokenAdminRegistry.InstanceAddress).Return(&apiv2.ActiveContract{CreatedEvent: &apiv2.CreatedEvent{ CreateArguments: bindings.MarshalTemplateToRecord(core.TokenAdminRegistry{ InstanceId: "tokenadminregistry", - Owner: "owner", + CcipOwner: "owner", EntryCount: 1, }), }}, true) @@ -1217,7 +1217,7 @@ func TestServer_PostCCIPSend(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "owner", ChainSelector: types.NUMERIC(sourceSelector), - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC(destSelector): { IsEnabled: true, MessageNetworkFeeUSDCents: "0", @@ -1230,7 +1230,7 @@ func TestServer_PostCCIPSend(t *testing.T) { mockActiveContractStore.EXPECT().Get(cfg.TokenAdminRegistry.InstanceAddress).Return(&apiv2.ActiveContract{CreatedEvent: &apiv2.CreatedEvent{ CreateArguments: bindings.MarshalTemplateToRecord(core.TokenAdminRegistry{ InstanceId: "tokenadminregistry", - Owner: "owner", + CcipOwner: "owner", EntryCount: 1, }), }}, true) @@ -1338,7 +1338,7 @@ func TestServer_PostCCIPExecute(t *testing.T) { }, CreateArguments: bindings.MarshalTemplateToRecord(core.TokenAdminRegistry{ InstanceId: "tokenadminregistry", - Owner: "owner", + CcipOwner: "owner", EntryCount: 1, }), }}, true) @@ -1363,7 +1363,7 @@ func TestServer_PostCCIPExecute(t *testing.T) { RegistryOwner: types.PARTY(tokenAdminRegistryAddress.Owner()), Index: 0, InstrumentId: tokenInstrumentId, - TokenPool: &core.PoolRegistration{ + TokenPool: &core.PoolRegistration2{ PoolOwner: types.PARTY(tokenPoolAddress.Owner()), PoolInstanceId: types.TEXT(tokenPoolAddress.InstanceID()), }, @@ -1572,7 +1572,7 @@ func TestServer_PostCCIPExecute(t *testing.T) { mockActiveContractStore.EXPECT().Get(cfg.TokenAdminRegistry.InstanceAddress).Return(&apiv2.ActiveContract{CreatedEvent: &apiv2.CreatedEvent{ CreateArguments: bindings.MarshalTemplateToRecord(core.TokenAdminRegistry{ InstanceId: "tokenadminregistry", - Owner: "owner", + CcipOwner: "owner", EntryCount: 1, }), }}, true) @@ -1595,7 +1595,7 @@ func TestServer_PostCCIPExecute(t *testing.T) { mockActiveContractStore.EXPECT().Get(cfg.TokenAdminRegistry.InstanceAddress).Return(&apiv2.ActiveContract{CreatedEvent: &apiv2.CreatedEvent{ CreateArguments: bindings.MarshalTemplateToRecord(core.TokenAdminRegistry{ InstanceId: "tokenadminregistry", - Owner: "owner", + CcipOwner: "owner", EntryCount: 1, }), }}, true) @@ -1617,7 +1617,7 @@ func TestServer_PostCCIPExecute(t *testing.T) { mockActiveContractStore.EXPECT().Get(cfg.TokenAdminRegistry.InstanceAddress).Return(&apiv2.ActiveContract{CreatedEvent: &apiv2.CreatedEvent{ CreateArguments: bindings.MarshalTemplateToRecord(core.TokenAdminRegistry{ InstanceId: "tokenadminregistry", - Owner: "owner", + CcipOwner: "owner", EntryCount: 1, }), }}, true) diff --git a/eds/internal/api/ccip/parse.go b/eds/internal/api/ccip/parse.go index fac13a1a3..db9e02d62 100644 --- a/eds/internal/api/ccip/parse.go +++ b/eds/internal/api/ccip/parse.go @@ -91,7 +91,7 @@ func ParseGlobalConfig(createdEvent *apiv2.CreatedEvent) (*GlobalConfig, error) }, nil } -func parseSourceChainConfig(sourceChainConfig core.SourceChainConfig) (SourceChainConfig, error) { +func parseSourceChainConfig(sourceChainConfig core.SourceChainConfig2) (SourceChainConfig, error) { laneMandatedCCVs, err := parse.RawInstanceAddressList(sourceChainConfig.LaneMandatedCCVs) if err != nil { return SourceChainConfig{}, fmt.Errorf("failed to parse lane mandated CCVs: %w", err) @@ -108,7 +108,7 @@ func parseSourceChainConfig(sourceChainConfig core.SourceChainConfig) (SourceCha }, nil } -func parseDestChainConfig(destChainConfig core.DestChainConfig) (DestChainConfig, error) { +func parseDestChainConfig(destChainConfig core.DestChainConfig2) (DestChainConfig, error) { laneMandatedCCVs, err := parse.RawInstanceAddressList(destChainConfig.LaneMandatedCCVs) if err != nil { return DestChainConfig{}, fmt.Errorf("failed to parse lane mandated CCVs: %w", err) @@ -146,7 +146,7 @@ func ParseTokenAdminRegistry(createdEvent *apiv2.CreatedEvent) (*TokenAdminRegis return nil, fmt.Errorf("failed to unmarshal TokenAdminRegistry: %w", err) } - address := contracts.NewRawInstanceAddress(contracts.InstanceID(boundContract.InstanceId), boundContract.Owner) + address := contracts.NewRawInstanceAddress(contracts.InstanceID(boundContract.InstanceId), boundContract.CcipOwner) return &TokenAdminRegistry{ Address: address, @@ -160,7 +160,7 @@ type TokenConfig struct { Index types.INT64 InstrumentId contracts.EncodedInstrumentID IsCCIPManaged types.BOOL - Pool *core.PoolRegistration + Pool *core.PoolRegistration2 } func ParseTokenConfig(createdEvent *apiv2.CreatedEvent) (*TokenConfig, error) { diff --git a/eds/internal/api/ccip/parse_test.go b/eds/internal/api/ccip/parse_test.go index a14e4c885..c2443afcf 100644 --- a/eds/internal/api/ccip/parse_test.go +++ b/eds/internal/api/ccip/parse_test.go @@ -30,7 +30,7 @@ func TestParseGlobalConfig(t *testing.T) { InstanceId: "globalconfig", CcipOwner: "ccipOwner", ChainSelector: "1", - DestChainConfigs: map[types.NUMERIC]core.DestChainConfig{ + DestChainConfigs: map[types.NUMERIC]core.DestChainConfig2{ types.NUMERIC("111"): { IsEnabled: true, AddressBytesLength: 32, @@ -48,7 +48,7 @@ func TestParseGlobalConfig(t *testing.T) { TokenNetworkFeeUSDCents: "400", }, }, - SourceChainConfigs: map[types.NUMERIC]core.SourceChainConfig{ + SourceChainConfigs: map[types.NUMERIC]core.SourceChainConfig2{ types.NUMERIC("222"): { IsEnabled: true, OnRampAddresses: []types.TEXT{ @@ -93,7 +93,7 @@ func TestParseGlobalConfig(t *testing.T) { createdEvent: &apiv2.CreatedEvent{ CreateArguments: bindings.MarshalTemplateToRecord(core.FeeQuoter{ InstanceId: "feequoter", - Owner: "ccipOwner", + CcipOwner: "ccipOwner", }), }, want: nil, diff --git a/eds/internal/api/executor/executor_test.go b/eds/internal/api/executor/executor_test.go index 4f65eda14..d62db2d5d 100644 --- a/eds/internal/api/executor/executor_test.go +++ b/eds/internal/api/executor/executor_test.go @@ -12,10 +12,11 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" + "github.com/smartcontractkit/go-daml/pkg/types" "github.com/smartcontractkit/chainlink-canton/bindings" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" executorBinding "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/executor" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/contracts" @@ -58,7 +59,7 @@ func TestServer_PostExecutorSend(t *testing.T) { Owner: types.PARTY(executorAddress.Owner()), MaxCCVsPerMsg: 2, DynamicConfig: executorBinding.DynamicConfig{ - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: new(types.UNIT)}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: new(types.UNIT)}, CcvAllowlistEnabled: true, }, AllowedCCVs: []chainlinkapi.RawInstanceAddress{ @@ -396,7 +397,7 @@ func TestServer_PostExecutorSend(t *testing.T) { Owner: types.PARTY(executorAddress.Owner()), MaxCCVsPerMsg: 3, DynamicConfig: executorBinding.DynamicConfig{ - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: new(types.UNIT)}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: new(types.UNIT)}, CcvAllowlistEnabled: false, // allowlist disabled, CCVs in the request shouldn't be checked }, AllowedCCVs: []chainlinkapi.RawInstanceAddress{ @@ -706,7 +707,7 @@ func TestServer_PostExecutorSend(t *testing.T) { }, CreateArguments: bindings.MarshalTemplateToRecord(executorBinding.Executor{ DynamicConfig: executorBinding.DynamicConfig{ - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, }, AllowedCCVs: []chainlinkapi.RawInstanceAddress{ chainlinkapi.RawInstanceAddress{Unpack: "invalidaddress"}, diff --git a/eds/internal/api/tokenpool/tokenpool.go b/eds/internal/api/tokenpool/tokenpool.go index b70e6ed33..2b2eb770b 100644 --- a/eds/internal/api/tokenpool/tokenpool.go +++ b/eds/internal/api/tokenpool/tokenpool.go @@ -20,6 +20,7 @@ import ( "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/burnminttokenpool" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/lockreleasetokenpool" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ratelimiter" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" "github.com/smartcontractkit/chainlink-canton/contracts" "github.com/smartcontractkit/chainlink-canton/eds/config" @@ -67,7 +68,7 @@ func NewServer( Owner: types.PARTY(tokenPool.PoolOwner), } s.activeContractStore.RegisterTemplates(store.RegisteredTemplate{ - TemplateID: contracts.TemplateIDFromBinding(core.RateLimiter{}), + TemplateID: contracts.TemplateIDFromBinding(ratelimiter.RateLimiter{}), PartyID: tokenPool.PartyID, }) s.instrumentHoldingStore.RegisterParty(tokenPool.PoolOwner) @@ -229,7 +230,7 @@ func (s Server) lockReleaseTokenPoolSend( // The ChoiceContext that will be passed to the Token Pool choiceContext := splice_api_token_metadata_v1.ChoiceContext{Values: map[string]splice_api_token_metadata_v1.AnyValue{ - string(core.RateLimiterKey): {AVContractId: new(types.CONTRACT_ID(rateLimiter.GetCreatedEvent().GetContractId()))}, + string(ratelimiter.RateLimiterContextKey): {AVContractId: new(types.CONTRACT_ID(rateLimiter.GetCreatedEvent().GetContractId()))}, string(lockreleasetokenpool.TokenPoolHoldingsContextKey): {AVList: new(tokenPoolHoldings)}, }} @@ -342,7 +343,7 @@ func (s Server) burnMintTokenPoolSend( // The ChoiceContext that will be passed to the Token Pool choiceContext := splice_api_token_metadata_v1.ChoiceContext{Values: map[string]splice_api_token_metadata_v1.AnyValue{ - string(core.RateLimiterKey): {AVContractId: new(types.CONTRACT_ID(rateLimiter.GetCreatedEvent().GetContractId()))}, + string(ratelimiter.RateLimiterContextKey): {AVContractId: new(types.CONTRACT_ID(rateLimiter.GetCreatedEvent().GetContractId()))}, }} // The ChoiceContext that will be passed to the BurnMintFactory by the Token Pool @@ -535,7 +536,7 @@ func (s Server) lockReleaseTokenPoolExecute( // The ChoiceContext that will be passed to the Token Pool choiceContext := splice_api_token_metadata_v1.ChoiceContext{Values: map[string]splice_api_token_metadata_v1.AnyValue{ - string(core.RateLimiterKey): {AVContractId: new(types.CONTRACT_ID(rateLimiter.GetCreatedEvent().GetContractId()))}, + string(ratelimiter.RateLimiterContextKey): {AVContractId: new(types.CONTRACT_ID(rateLimiter.GetCreatedEvent().GetContractId()))}, string(lockreleasetokenpool.TokenPoolHoldingsContextKey): {AVList: new(tokenPoolHoldings)}, }} @@ -645,7 +646,7 @@ func (s Server) burnMintTokenPoolExecute( // The ChoiceContext that will be passed to the Token Pool choiceContext := splice_api_token_metadata_v1.ChoiceContext{Values: map[string]splice_api_token_metadata_v1.AnyValue{ - string(core.RateLimiterKey): {AVContractId: new(types.CONTRACT_ID(rateLimiter.GetCreatedEvent().GetContractId()))}, + string(ratelimiter.RateLimiterContextKey): {AVContractId: new(types.CONTRACT_ID(rateLimiter.GetCreatedEvent().GetContractId()))}, }} // The ChoiceContext that will be passed to the BurnMintFactory by the Token Pool diff --git a/eds/internal/api/tokenpool/tokenpool_execute_test.go b/eds/internal/api/tokenpool/tokenpool_execute_test.go index b65108664..9c5199806 100644 --- a/eds/internal/api/tokenpool/tokenpool_execute_test.go +++ b/eds/internal/api/tokenpool/tokenpool_execute_test.go @@ -16,7 +16,7 @@ import ( "github.com/smartcontractkit/chainlink-canton/bindings" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/burnminttokenpool" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/lockreleasetokenpool" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" @@ -52,7 +52,7 @@ func TestServer_PostTokenPoolExecute_LockRelease(t *testing.T) { Decimals: 18, RemoteChainConfigs: map[types.NUMERIC]lockreleasetokenpool.RemoteChainConfig{ "123": { - FinalityConfig: core.FinalityConfig{WaitForFinality: new(types.UNIT)}, + FinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: new(types.UNIT)}, InboundRateLimiter: inboundRL.Binding(), InboundCustomBlockConfirmationsRateLimiter: inboundCustomRL.Binding(), OutboundRateLimiter: outboundRL.Binding(), @@ -507,7 +507,7 @@ func TestServer_PostTokenPoolExecute_BurnMint(t *testing.T) { Decimals: 18, RemoteChainConfigs: map[types.NUMERIC]burnminttokenpool.RemoteChainConfig{ "123": { - FinalityConfig: core.FinalityConfig{WaitForFinality: new(types.UNIT)}, + FinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: new(types.UNIT)}, InboundRateLimiter: inboundRL.Binding(), InboundCustomBlockConfirmationsRateLimiter: inboundCustomRL.Binding(), OutboundRateLimiter: outboundRL.Binding(), diff --git a/eds/internal/api/tokenpool/tokenpool_send_test.go b/eds/internal/api/tokenpool/tokenpool_send_test.go index 16f111a4b..cddeb8e27 100644 --- a/eds/internal/api/tokenpool/tokenpool_send_test.go +++ b/eds/internal/api/tokenpool/tokenpool_send_test.go @@ -15,7 +15,7 @@ import ( "github.com/smartcontractkit/chainlink-canton/bindings" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/burnminttokenpool" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/lockreleasetokenpool" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" @@ -67,7 +67,7 @@ func TestServer_PostTokenPoolSend_LockRelease(t *testing.T) { Decimals: 18, RemoteChainConfigs: map[types.NUMERIC]lockreleasetokenpool.RemoteChainConfig{ "456": { - FinalityConfig: core.FinalityConfig{WaitForFinality: new(types.UNIT)}, + FinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: new(types.UNIT)}, InboundRateLimiter: inboundRL.Binding(), InboundCustomBlockConfirmationsRateLimiter: inboundCustomRL.Binding(), OutboundRateLimiter: outboundRL.Binding(), @@ -419,7 +419,7 @@ func TestServer_PostTokenPoolSend_BurnMint(t *testing.T) { Decimals: 18, RemoteChainConfigs: map[types.NUMERIC]burnminttokenpool.RemoteChainConfig{ "456": { - FinalityConfig: core.FinalityConfig{WaitForFinality: new(types.UNIT)}, + FinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: new(types.UNIT)}, InboundRateLimiter: inboundRL.Binding(), InboundCustomBlockConfirmationsRateLimiter: inboundCustomRL.Binding(), OutboundRateLimiter: outboundRL.Binding(), diff --git a/eds/internal/api/tokenpool/tokenpool_test.go b/eds/internal/api/tokenpool/tokenpool_test.go index 5ac9968cc..6a4384c24 100644 --- a/eds/internal/api/tokenpool/tokenpool_test.go +++ b/eds/internal/api/tokenpool/tokenpool_test.go @@ -13,7 +13,7 @@ import ( "github.com/smartcontractkit/chainlink-canton/bindings" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/burnminttokenpool" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/lockreleasetokenpool" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_metadata_v1" "github.com/smartcontractkit/chainlink-canton/contracts" @@ -33,7 +33,7 @@ func TestServer_FilterContracts(t *testing.T) { tokenPool1 := burnminttokenpool.BurnMintTokenPool{ RemoteChainConfigs: map[types.NUMERIC]burnminttokenpool.RemoteChainConfig{ types.NUMERIC("123"): { - FinalityConfig: core.FinalityConfig{WaitForFinality: new(types.UNIT)}, // Unit types must be set in order for the unmarshal to work + FinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: new(types.UNIT)}, // Unit types must be set in order for the unmarshal to work InboundRateLimiter: rl1.Binding(), InboundCustomBlockConfirmationsRateLimiter: rl2.Binding(), OutboundRateLimiter: rl3.Binding(), @@ -47,7 +47,7 @@ func TestServer_FilterContracts(t *testing.T) { tokenPool2 := lockreleasetokenpool.LockReleaseTokenPool{ RemoteChainConfigs: map[types.NUMERIC]lockreleasetokenpool.RemoteChainConfig{ "456": { - FinalityConfig: core.FinalityConfig{WaitForFinality: new(types.UNIT)}, + FinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: new(types.UNIT)}, InboundRateLimiter: rl4.Binding(), InboundCustomBlockConfirmationsRateLimiter: rl5.Binding(), OutboundRateLimiter: rl6.Binding(), diff --git a/examples/cli/cmd/canton.go b/examples/cli/cmd/canton.go index b9421b07b..d76d7cd8f 100644 --- a/examples/cli/cmd/canton.go +++ b/examples/cli/cmd/canton.go @@ -21,7 +21,8 @@ import ( "github.com/smartcontractkit/go-daml/pkg/types" "github.com/smartcontractkit/chainlink-canton/bindings" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/clientapi" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/receiver" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/sender" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" @@ -101,9 +102,9 @@ func newCantonListEventsCmd(g *Globals) *cobra.Command { var tmpl *apiv2.Identifier switch eventName { case "sent": - tmpl = &apiv2.Identifier{PackageId: "#ccip-core", ModuleName: "CCIP.Events", EntityName: "CCIPMessageSent"} + tmpl = contracts.IdentifierFromBinding(events.CCIPMessageSent{}) case "executed": - tmpl = &apiv2.Identifier{PackageId: "#ccip-core", ModuleName: "CCIP.Events", EntityName: "ExecutionStateChanged"} + tmpl = contracts.IdentifierFromBinding(events.ExecutionStateChanged{}) default: return fmt.Errorf("invalid --event %q (sent|executed)", eventName) } @@ -120,7 +121,7 @@ func newCantonListEventsCmd(g *Globals) *cobra.Command { tw.SetTitle("CCIPMessageSent Events") tw.AppendHeader(table.Row{"Message ID", "Destination Chain", "Sequence Number", "Sender"}) for _, c := range active { - ev, err := bindings.UnmarshalCreatedEvent[core.CCIPMessageSent](c.GetCreatedEvent()) + ev, err := bindings.UnmarshalCreatedEvent[events.CCIPMessageSent](c.GetCreatedEvent()) if err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -135,7 +136,7 @@ func newCantonListEventsCmd(g *Globals) *cobra.Command { tw.SetTitle("ExecutionStateChanged Events") tw.AppendHeader(table.Row{"Message ID", "Source Chain", "Sequence Number", "State", "Receiver"}) for _, c := range active { - ev, err := bindings.UnmarshalCreatedEvent[core.ExecutionStateChanged](c.GetCreatedEvent()) + ev, err := bindings.UnmarshalCreatedEvent[events.ExecutionStateChanged](c.GetCreatedEvent()) if err != nil { return fmt.Errorf("unmarshal: %w", err) } @@ -453,7 +454,7 @@ func cantonExecute(ctx context.Context, b *clients.Bundle, vr protocol.VerifierR tokenTransferInput = &receiver.TokenTransferInput{ TokenPoolCid: types.CONTRACT_ID(tokenPoolExecuteDisclosure.ContractId), TokenReceiverParty: types.PARTY(b.Participant.PartyID), - PoolExtraContext: tokenPoolExecuteDisclosure.ChoiceContext, + Context: tokenPoolExecuteDisclosure.ChoiceContext, } allDisclosures = slices.Concat( tokenPoolExecuteDisclosure.DisclosedContracts, @@ -469,7 +470,7 @@ func cantonExecute(ctx context.Context, b *clients.Bundle, vr protocol.VerifierR CcvInputs: []receiver.CCVInput{{ CcvCid: types.CONTRACT_ID(ccvExecuteDisclosure.ContractId), VerifierResults: types.TEXT(hex.EncodeToString(vr.CCVData)), - CcvExtraContext: ccvExecuteDisclosure.ChoiceContext, + Context: ccvExecuteDisclosure.ChoiceContext, }}, } @@ -479,7 +480,7 @@ func cantonExecute(ctx context.Context, b *clients.Bundle, vr protocol.VerifierR CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-receiver", ModuleName: "CCIP.CCIPReceiver", EntityName: "CCIPReceiver"}, + TemplateId: contracts.IdentifierFromBinding(receiver.CCIPReceiver{}), ContractId: receiverCid, Choice: "Execute", ChoiceArgument: ledger.MapToValue(executeArgs), @@ -758,7 +759,7 @@ func cantonSend( var ( executorInput *sender.ExecutorInput executorDisclosures []*apiv2.DisclosedContract - executorExtraArg core.ExecutorExtraArg + executorExtraArg clientapi.ExecutorExtraArg ) switch executorMode { case "default": @@ -771,29 +772,29 @@ func cantonSend( return fmt.Errorf("executor send disclosure: %w", err) } executorInput = &sender.ExecutorInput{ - ExecutorCid: types.CONTRACT_ID(execDisc.ContractId), - ExecutorExtraContext: splice_api_token_metadata_v1.ChoiceContext{}, + ExecutorCid: types.CONTRACT_ID(execDisc.ContractId), + Context: splice_api_token_metadata_v1.ChoiceContext{}, } executorDisclosures = execDisc.DisclosedContracts - executorExtraArg = core.ExecutorExtraArg{ - ExecutorUseDefault: &core.ExecutorUseDefault{ExecutorArgs: ""}, + executorExtraArg = clientapi.ExecutorExtraArg{ + ExecutorUseDefault: &clientapi.ExecutorUseDefault{ExecutorArgs: ""}, } case "none": // No executor — message will not be auto-executed on the destination. executorInput = nil executorDisclosures = nil - executorExtraArg = core.ExecutorExtraArg{ + executorExtraArg = clientapi.ExecutorExtraArg{ ExecutorNoExecutor: &types.UNIT{}, } } // --- Build sendArgs --- - canton2Any := core.Canton2AnyMessage{ + canton2Any := clientapi.Canton2AnyMessage{ Receiver: types.TEXT(msg.Receiver), Payload: types.TEXT(msg.Payload), FeeToken: *feeTokenInstrumentId, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: clientapi.ExtraArgs{ + V3: &clientapi.GenericExtraArgsV3{ GasLimit: types.INT64(msg.GasLimit), Ccvs: nil, Executor: executorExtraArg, @@ -803,7 +804,7 @@ func cantonSend( }, } if withToken { - canton2Any.TokenTransfer = &core.TokenTransfer{ + canton2Any.TokenTransfer = &clientapi.TokenTransfer{ Token: *linkInstrumentId, Amount: types.NUMERIC(msg.TokenTransfer.Amount), } @@ -824,17 +825,17 @@ func cantonSend( }, }, CcvSendInputs: []sender.CCVSendInput{{ - CcvAddress: ccvSendDisclosure.Address.Binding(), - CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), - CcvExtraContext: splice_api_token_metadata_v1.ChoiceContext{}, + CcvAddress: ccvSendDisclosure.Address.Binding(), + CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), + Context: splice_api_token_metadata_v1.ChoiceContext{}, }}, ExecutorInput: executorInput, } if withToken { sendArgs.TokenTransferInput = &sender.TokenTransferInput{ - SenderInputCids: tokenTransferInputCids, - TokenPoolCid: types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId), - PoolExtraContext: tokenPoolSendDisclosure.ChoiceContext, + SenderInputCids: tokenTransferInputCids, + TokenPoolCid: types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId), + Context: tokenPoolSendDisclosure.ChoiceContext, } } @@ -877,7 +878,7 @@ func cantonSend( CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender"}, + TemplateId: contracts.IdentifierFromBinding(sender.CCIPSender{}), ContractId: senderCid, Choice: "Send", ChoiceArgument: ledger.MapToValue(sendArgs), diff --git a/examples/cli/internal/cantonops/cantonops.go b/examples/cli/internal/cantonops/cantonops.go index 43d503de1..9a1c36c5f 100644 --- a/examples/cli/internal/cantonops/cantonops.go +++ b/examples/cli/internal/cantonops/cantonops.go @@ -17,9 +17,11 @@ import ( "github.com/smartcontractkit/go-daml/pkg/types" "github.com/smartcontractkit/chainlink-canton/bindings" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/receiver" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/sender" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/contracts" oapiCCIP "github.com/smartcontractkit/chainlink-canton/openapi/gen/eds/ccip" @@ -28,18 +30,10 @@ import ( ) var ( - perPartyRouterTemplateID = &apiv2.Identifier{ - PackageId: "#ccip-runtime", ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouter", - } - perPartyRouterFactoryTemplateID = &apiv2.Identifier{ - PackageId: "#ccip-runtime", ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouterFactory", - } - ccipSenderTemplateID = &apiv2.Identifier{ - PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender", - } - ccipReceiverTemplateID = &apiv2.Identifier{ - PackageId: "#ccip-receiver", ModuleName: "CCIP.CCIPReceiver", EntityName: "CCIPReceiver", - } + perPartyRouterTemplateID = contracts.IdentifierFromBinding(ccipruntime.PerPartyRouter{}) + perPartyRouterFactoryTemplateID = contracts.IdentifierFromBinding(ccipruntime.PerPartyRouterFactory{}) + ccipSenderTemplateID = contracts.IdentifierFromBinding(sender.CCIPSender{}) + ccipReceiverTemplateID = contracts.IdentifierFromBinding(receiver.CCIPReceiver{}) ) // propagationTimeout bounds how long we'll wait for a freshly created @@ -164,7 +158,7 @@ func GetOrCreateSender(ctx context.Context, participant canton.Participant) (str return contract.GetCreatedEvent().GetContractId(), nil } -func finalityConfigEqual(a, b core.FinalityConfig) bool { +func finalityConfigEqual(a, b ccipcodec.FinalityConfig) bool { switch a.GetVariantTag() { case "WaitForFinality": return b.GetVariantTag() == "WaitForFinality" @@ -183,7 +177,7 @@ func finalityConfigEqual(a, b core.FinalityConfig) bool { } } -func receiverFinalityLabel(cfg core.FinalityConfig) string { +func receiverFinalityLabel(cfg ccipcodec.FinalityConfig) string { switch cfg.GetVariantTag() { case "BlockDepth": depth, ok := cfg.GetVariantValue().(*types.INT64) @@ -197,7 +191,7 @@ func receiverFinalityLabel(cfg core.FinalityConfig) string { } } -func receiverInstanceID(cfg core.FinalityConfig) string { +func receiverInstanceID(cfg ccipcodec.FinalityConfig) string { switch cfg.GetVariantTag() { case "WaitForFinality": return "ccipreceiver-WaitForFinality" @@ -243,7 +237,7 @@ func receiverRequiredCCVConfigured(recv *receiver.CCIPReceiver, requiredCCV cont func findActiveReceiverByFinality( ctx context.Context, participant canton.Participant, - receiverFinality core.FinalityConfig, + receiverFinality ccipcodec.FinalityConfig, ) (string, *receiver.CCIPReceiver, error) { active, err := testhelpers.ListActiveContractsByTemplateId(ctx, participant, ccipReceiverTemplateID) if err != nil { @@ -325,7 +319,7 @@ func extractCreatedReceiverCID(tx *apiv2.Transaction) (string, error) { func waitForReceiverWithFinality( ctx context.Context, participant canton.Participant, - receiverFinality core.FinalityConfig, + receiverFinality ccipcodec.FinalityConfig, ) (string, error) { deadline := time.Now().Add(propagationTimeout) for { @@ -351,7 +345,7 @@ func waitForReceiverWithFinality( } } -func receiverFinalityField(cfg core.FinalityConfig) *apiv2.Value { +func receiverFinalityField(cfg ccipcodec.FinalityConfig) *apiv2.Value { switch cfg.GetVariantTag() { case "WaitForFinality": return &apiv2.Value{Sum: &apiv2.Value_Variant{Variant: &apiv2.Variant{ @@ -384,7 +378,7 @@ func receiverFinalityField(cfg core.FinalityConfig) *apiv2.Value { func GetOrCreateReceiver( ctx context.Context, participant canton.Participant, - receiverFinality core.FinalityConfig, + receiverFinality ccipcodec.FinalityConfig, requiredCCV contracts.RawInstanceAddress, ) (string, error) { requiredCCVs := []contracts.RawInstanceAddress{requiredCCV} @@ -458,7 +452,7 @@ func GetMessageIdFromTransaction(tx *apiv2.Transaction) (string, error) { if e.Created.GetTemplateId().GetEntityName() != "CCIPMessageSent" { continue } - msg, err := bindings.UnmarshalCreatedEvent[core.CCIPMessageSent](e.Created) + msg, err := bindings.UnmarshalCreatedEvent[events.CCIPMessageSent](e.Created) if err != nil { return "", fmt.Errorf("unmarshal CCIPMessageSent: %w", err) } diff --git a/examples/cli/internal/cantonops/cantonops_test.go b/examples/cli/internal/cantonops/cantonops_test.go index 1d99abeff..56f8e6509 100644 --- a/examples/cli/internal/cantonops/cantonops_test.go +++ b/examples/cli/internal/cantonops/cantonops_test.go @@ -7,7 +7,7 @@ import ( "github.com/smartcontractkit/go-daml/pkg/types" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/receiver" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/contracts" @@ -16,10 +16,10 @@ import ( func TestFinalityConfigEqual(t *testing.T) { t.Parallel() - waitForFinality := core.FinalityConfig{WaitForFinality: &types.UNIT{}} - waitForSafe := core.FinalityConfig{WaitForSafe: &types.UNIT{}} - blockDepth1 := core.FinalityConfig{BlockDepth: new(types.INT64(1))} - blockDepth5 := core.FinalityConfig{BlockDepth: new(types.INT64(5))} + waitForFinality := ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}} + waitForSafe := ccipcodec.FinalityConfig{WaitForSafe: &types.UNIT{}} + blockDepth1 := ccipcodec.FinalityConfig{BlockDepth: new(types.INT64(1))} + blockDepth5 := ccipcodec.FinalityConfig{BlockDepth: new(types.INT64(5))} require.True(t, finalityConfigEqual(waitForFinality, waitForFinality)) require.True(t, finalityConfigEqual(blockDepth1, blockDepth1)) @@ -31,13 +31,13 @@ func TestFinalityConfigEqual(t *testing.T) { func TestReceiverInstanceID(t *testing.T) { t.Parallel() - require.Equal(t, "ccipreceiver-WaitForFinality", receiverInstanceID(core.FinalityConfig{ + require.Equal(t, "ccipreceiver-WaitForFinality", receiverInstanceID(ccipcodec.FinalityConfig{ WaitForFinality: &types.UNIT{}, })) - require.Equal(t, "ccipreceiver-WaitForSafe", receiverInstanceID(core.FinalityConfig{ + require.Equal(t, "ccipreceiver-WaitForSafe", receiverInstanceID(ccipcodec.FinalityConfig{ WaitForSafe: &types.UNIT{}, })) - require.Equal(t, "ccipreceiver-BlockDepth-1", receiverInstanceID(core.FinalityConfig{ + require.Equal(t, "ccipreceiver-BlockDepth-1", receiverInstanceID(ccipcodec.FinalityConfig{ BlockDepth: new(types.INT64(1)), })) } @@ -45,10 +45,10 @@ func TestReceiverInstanceID(t *testing.T) { func TestReceiverFinalityLabel(t *testing.T) { t.Parallel() - require.Equal(t, "WaitForFinality", receiverFinalityLabel(core.FinalityConfig{ + require.Equal(t, "WaitForFinality", receiverFinalityLabel(ccipcodec.FinalityConfig{ WaitForFinality: &types.UNIT{}, })) - require.Equal(t, "BlockDepth(1)", receiverFinalityLabel(core.FinalityConfig{ + require.Equal(t, "BlockDepth(1)", receiverFinalityLabel(ccipcodec.FinalityConfig{ BlockDepth: new(types.INT64(1)), })) } diff --git a/examples/cli/internal/finality/finality.go b/examples/cli/internal/finality/finality.go index 71e4ac768..6b172f78e 100644 --- a/examples/cli/internal/finality/finality.go +++ b/examples/cli/internal/finality/finality.go @@ -8,13 +8,13 @@ import ( "github.com/smartcontractkit/chainlink-ccv/protocol" "github.com/smartcontractkit/go-daml/pkg/types" - "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" ) // Parsed holds the EVM extraArgs finality and matching Canton receiver config. type Parsed struct { EVM protocol.Finality - Receiver core.FinalityConfig + Receiver ccipcodec.FinalityConfig Label string } @@ -27,13 +27,13 @@ func Parse(s string) (Parsed, error) { case "finality": return Parsed{ EVM: protocol.FinalityWaitForFinality, - Receiver: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + Receiver: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, Label: "WaitForFinality", }, nil case "safe": return Parsed{ EVM: protocol.FinalityWaitForSafe, - Receiver: core.FinalityConfig{WaitForSafe: &types.UNIT{}}, + Receiver: ccipcodec.FinalityConfig{WaitForSafe: &types.UNIT{}}, Label: "WaitForSafe", }, nil default: @@ -45,7 +45,7 @@ func Parse(s string) (Parsed, error) { return Parsed{ EVM: protocol.NewFinality().WithBlockDepth(depth), - Receiver: core.FinalityConfig{BlockDepth: new(types.INT64(int64(depth)))}, + Receiver: ccipcodec.FinalityConfig{BlockDepth: new(types.INT64(int64(depth)))}, Label: fmt.Sprintf("BlockDepth(%d)", depth), }, nil } diff --git a/go.mod b/go.mod index 00d4e9367..5026e49f0 100644 --- a/go.mod +++ b/go.mod @@ -42,7 +42,7 @@ require ( github.com/smartcontractkit/chainlink-deployments-framework v0.114.2 github.com/smartcontractkit/chainlink-testing-framework/framework v0.16.6-0.20260630120514-36abe27604df github.com/smartcontractkit/chainlink-testing-framework/wasp v1.52.0 - github.com/smartcontractkit/go-daml v0.0.0-20260630200614-6e739bf6e282 + github.com/smartcontractkit/go-daml v0.0.0-20260702101944-3a593d4e8e19 github.com/spf13/viper v1.21.0 github.com/stretchr/testify v1.11.1 github.com/testcontainers/testcontainers-go v0.43.0 diff --git a/go.sum b/go.sum index 3445c98ce..89aad58c8 100644 --- a/go.sum +++ b/go.sum @@ -1233,8 +1233,8 @@ github.com/smartcontractkit/chainlink/v2 v2.29.0 h1:MyvQ/LAhHw//yDXgo2EvH7jq4NH3 github.com/smartcontractkit/chainlink/v2 v2.29.0/go.mod h1:6SHH9QHlKh1mKuEhG8Y7nGutUzhQwu1Qrpp/0qLzaR0= github.com/smartcontractkit/freeport v0.1.3-0.20250828155247-add56fa28aad h1:lgHxTHuzJIF3Vj6LSMOnjhqKgRqYW+0MV2SExtCYL1Q= github.com/smartcontractkit/freeport v0.1.3-0.20250828155247-add56fa28aad/go.mod h1:T4zH9R8R8lVWKfU7tUvYz2o2jMv1OpGCdpY2j2QZXzU= -github.com/smartcontractkit/go-daml v0.0.0-20260630200614-6e739bf6e282 h1:96Jd9XwZ2OaFrbR7lSYXIC/DzEbO5oQEmkXg86blj40= -github.com/smartcontractkit/go-daml v0.0.0-20260630200614-6e739bf6e282/go.mod h1:SqWfl3Bp9NleC9jhzFUaOGzOZeKfldpY4QOW6A6NSNM= +github.com/smartcontractkit/go-daml v0.0.0-20260702101944-3a593d4e8e19 h1:AMgphQyCCdvyA5P6xxPlRvHF7GCN/4KMMKkHon3U5K0= +github.com/smartcontractkit/go-daml v0.0.0-20260702101944-3a593d4e8e19/go.mod h1:SqWfl3Bp9NleC9jhzFUaOGzOZeKfldpY4QOW6A6NSNM= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= github.com/smartcontractkit/libocr v0.0.0-20260304194147-a03701e2c02e h1:poXTj5cFVM6XfC4HICIDYkDVc/A6OYB0eeID0wU2JQE= diff --git a/integration-tests/ccip/ccip_execute_test.go b/integration-tests/ccip/ccip_execute_test.go index 30114c958..557e0e606 100644 --- a/integration-tests/ccip/ccip_execute_test.go +++ b/integration-tests/ccip/ccip_execute_test.go @@ -48,6 +48,7 @@ import ( "github.com/smartcontractkit/go-daml/pkg/service/ledger" "github.com/smartcontractkit/go-daml/pkg/types" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" @@ -135,28 +136,18 @@ func TestCCIPExecuteE2E(t *testing.T) { }) // Upload DARs - commonDar, err := contracts.GetDar(contracts.CCIPCommon, contracts.CurrentVersion) + runtimeDar, err := contracts.GetDar(contracts.CCIPRuntime, contracts.CurrentVersion) require.NoError(t, err) - offRampDar, err := contracts.GetDar(contracts.CCIPOffRamp, contracts.CurrentVersion) - require.NoError(t, err) - onRampDar, err := contracts.GetDar(contracts.CCIPOnRamp, contracts.CurrentVersion) - require.NoError(t, err) - feeQuoterDar, err := contracts.GetDar(contracts.CCIPFeeQuoter, contracts.CurrentVersion) - require.NoError(t, err) - tokenAdminRegistryDar, err := contracts.GetDar(contracts.CCIPTokenAdminRegistry, contracts.CurrentVersion) + coreDar, err := contracts.GetDar(contracts.CCIPCore, contracts.CurrentVersion) require.NoError(t, err) committeeVerifierDar, err := contracts.GetDar(contracts.CCIPCommitteeVerifier, contracts.CurrentVersion) require.NoError(t, err) - perPartyRouterDar, err := contracts.GetDar(contracts.CCIPPerPartyRouter, contracts.CurrentVersion) - require.NoError(t, err) - rmnDar, err := contracts.GetDar(contracts.CCIPRMN, contracts.CurrentVersion) - require.NoError(t, err) ccipReceiverDar, err := contracts.GetDar(contracts.CCIPReceiver, contracts.CurrentVersion) require.NoError(t, err) executorDar, err := contracts.GetDar(contracts.CCIPExecutor, contracts.CurrentVersion) require.NoError(t, err) - dars := [][]byte{rmnDar, commonDar, tokenAdminRegistryDar, offRampDar, onRampDar, feeQuoterDar, committeeVerifierDar, perPartyRouterDar, ccipReceiverDar, executorDar} + dars := [][]byte{runtimeDar, coreDar, committeeVerifierDar, ccipReceiverDar, executorDar} packageIds, err := testhelpers.UploadDARstoMultipleParticipants(t.Context(), dars, ccipParticipant, receiverParticipant) require.NoError(t, err) t.Logf("Uploaded DARs to all participants: %v", packageIds) @@ -252,7 +243,7 @@ func TestCCIPExecuteE2E(t *testing.T) { MaxCCVsPerMsg: 10, DynamicConfig: executorBinding.DynamicConfig{ FeeAggregator: nil, - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, CcvAllowlistEnabled: false, }, AllowedCCVs: nil, @@ -446,7 +437,7 @@ func TestCCIPExecuteE2E(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#" + ccipruntime.PackageName, ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouterFactory"}, + TemplateId: contracts.IdentifierFromBinding(ccipruntime.PerPartyRouterFactory{}), ContractId: perPartyRouterFactoryDisclosure.ContractId, Choice: "CreateRouter", ChoiceArgument: ledger.MapToValue(ccipruntime.CreateRouter{ @@ -516,7 +507,7 @@ func TestCCIPExecuteE2E(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Create{Create: &apiv2.CreateCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-receiver", ModuleName: "CCIP.CCIPReceiver", EntityName: "CCIPReceiver"}, + TemplateId: contracts.IdentifierFromBinding(receiver.CCIPReceiver{}), CreateArguments: &apiv2.Record{Fields: []*apiv2.RecordField{ {Label: "instanceId", Value: &apiv2.Value{Sum: &apiv2.Value_Text{Text: "test-ccipreceiver"}}}, {Label: "owner", Value: &apiv2.Value{Sum: &apiv2.Value_Party{Party: partyReceiver}}}, @@ -550,7 +541,7 @@ func TestCCIPExecuteE2E(t *testing.T) { { CcvCid: types.CONTRACT_ID(ccvExecuteDisclosure.ContractId), VerifierResults: types.TEXT(verifierResultsHex), - CcvExtraContext: ccvExecuteDisclosure.ChoiceContext, + Context: ccvExecuteDisclosure.ChoiceContext, }, }, } @@ -562,7 +553,7 @@ func TestCCIPExecuteE2E(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-receiver", ModuleName: "CCIP.CCIPReceiver", EntityName: "CCIPReceiver"}, + TemplateId: contracts.IdentifierFromBinding(receiver.CCIPReceiver{}), ContractId: ccipReceiverCid, Choice: "Execute", ChoiceArgument: ledger.MapToValue(executeArgs), diff --git a/integration-tests/ccip/ccip_execute_token_bnm_test.go b/integration-tests/ccip/ccip_execute_token_bnm_test.go index ba3ca7270..08574faaf 100644 --- a/integration-tests/ccip/ccip_execute_token_bnm_test.go +++ b/integration-tests/ccip/ccip_execute_token_bnm_test.go @@ -37,10 +37,12 @@ import ( "github.com/smartcontractkit/go-daml/pkg/types" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/burnminttokenpool" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" executorBinding "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/executor" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ratelimiter" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/receiver" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/link" @@ -113,13 +115,9 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest // DAR Uploading // Read DARs - rmnDar, err := contracts.GetDar(contracts.CCIPRMN, contracts.CurrentVersion) + runtimeDar, err := contracts.GetDar(contracts.CCIPRuntime, contracts.CurrentVersion) require.NoError(t, err) - commonDar, err := contracts.GetDar(contracts.CCIPCommon, contracts.CurrentVersion) - require.NoError(t, err) - offRampDar, err := contracts.GetDar(contracts.CCIPOffRamp, contracts.CurrentVersion) - require.NoError(t, err) - tokenAdminRegistryDar, err := contracts.GetDar(contracts.CCIPTokenAdminRegistry, contracts.CurrentVersion) + coreDar, err := contracts.GetDar(contracts.CCIPCore, contracts.CurrentVersion) require.NoError(t, err) committeeVerifierDar, err := contracts.GetDar(contracts.CCIPCommitteeVerifier, contracts.CurrentVersion) require.NoError(t, err) @@ -127,19 +125,13 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest require.NoError(t, err) linkTokenDar, err := contracts.GetDar(contracts.Link, contracts.CurrentVersion) require.NoError(t, err) - perPartyRouterDar, err := contracts.GetDar(contracts.CCIPPerPartyRouter, contracts.CurrentVersion) - require.NoError(t, err) ccipReceiverDar, err := contracts.GetDar(contracts.CCIPReceiver, contracts.CurrentVersion) require.NoError(t, err) - onRampDar, err := contracts.GetDar(contracts.CCIPOnRamp, contracts.CurrentVersion) - require.NoError(t, err) - feeQuoterDar, err := contracts.GetDar(contracts.CCIPFeeQuoter, contracts.CurrentVersion) - require.NoError(t, err) executorDar, err := contracts.GetDar(contracts.CCIPExecutor, contracts.CurrentVersion) require.NoError(t, err) // Upload DARs to all participants - dars := [][]byte{rmnDar, commonDar, offRampDar, tokenAdminRegistryDar, committeeVerifierDar, tokenPoolDar, linkTokenDar, perPartyRouterDar, ccipReceiverDar, onRampDar, feeQuoterDar, executorDar} + dars := [][]byte{runtimeDar, coreDar, committeeVerifierDar, tokenPoolDar, linkTokenDar, ccipReceiverDar, executorDar} packageIds, err := testhelpers.UploadDARstoMultipleParticipants(t.Context(), dars, ccipParticipant, receiverParticipant, tokenPoolOwnerParticipant) require.NoError(t, err) t.Logf("Uploaded DARs to all participants: %v", packageIds) @@ -240,7 +232,7 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest MaxCCVsPerMsg: 10, DynamicConfig: executorBinding.DynamicConfig{ FeeAggregator: nil, - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, CcvAllowlistEnabled: false, }, AllowedCCVs: nil, @@ -358,14 +350,14 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest // Keep it enabled but lower-capacity so the test fails if the default-finality limiter // is selected for this FTF transfer instead of the custom-finality limiter. poolInstanceId := "test-pool-receive" - inboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployInbound, env.Chain, contractops.DeployInput[core.RateLimiter]{ + inboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployInbound, env.Chain, contractops.DeployInput[ratelimiter.RateLimiter]{ OwnerParty: types.PARTY(partyTokenPoolOwner), - Template: core.RateLimiter{ + Template: ratelimiter.RateLimiter{ PoolInstanceId: types.TEXT(poolInstanceId), PoolOwner: types.PARTY(partyTokenPoolOwner), RemoteChainSelector: types.NUMERIC(sourceChainSelector), - Direction: core.RateLimitDirectionRateLimitDirection_Inbound, - Mode: core.RateLimitModeRateLimitMode_DefaultFinality, + Direction: ratelimiter.RateLimitDirectionRateLimitDirection_Inbound, + Mode: ratelimiter.RateLimitModeRateLimitMode_DefaultFinality, IsEnabled: true, Capacity: types.NUMERIC(tc.defaultInboundLimiterCapacity), Rate: types.NUMERIC(tc.defaultInboundLimiterCapacity), @@ -378,14 +370,14 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest inboundRateLimiterAddr, err := contracts.RawInstanceAddressFromString(inboundRateLimiterRawAddr) require.NoError(t, err, "failed to parse inbound rate limiter address") - inboundCustomRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployInbound, env.Chain, contractops.DeployInput[core.RateLimiter]{ + inboundCustomRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployInbound, env.Chain, contractops.DeployInput[ratelimiter.RateLimiter]{ OwnerParty: types.PARTY(partyTokenPoolOwner), - Template: core.RateLimiter{ + Template: ratelimiter.RateLimiter{ PoolInstanceId: types.TEXT(poolInstanceId), PoolOwner: types.PARTY(partyTokenPoolOwner), RemoteChainSelector: types.NUMERIC(sourceChainSelector), - Direction: core.RateLimitDirectionRateLimitDirection_Inbound, - Mode: core.RateLimitModeRateLimitMode_CustomFinality, + Direction: ratelimiter.RateLimitDirectionRateLimitDirection_Inbound, + Mode: ratelimiter.RateLimitModeRateLimitMode_CustomFinality, IsEnabled: true, Capacity: types.NUMERIC(tc.customInboundLimiterCapacity), Rate: types.NUMERIC(tc.customInboundLimiterCapacity), @@ -398,14 +390,14 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest inboundCustomRateLimiterAddr, err := contracts.RawInstanceAddressFromString(inboundCustomRateLimiterRawAddr) require.NoError(t, err, "failed to parse inbound custom rate limiter address") - outboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployOutbound, env.Chain, contractops.DeployInput[core.RateLimiter]{ + outboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployOutbound, env.Chain, contractops.DeployInput[ratelimiter.RateLimiter]{ OwnerParty: types.PARTY(partyTokenPoolOwner), - Template: core.RateLimiter{ + Template: ratelimiter.RateLimiter{ PoolInstanceId: types.TEXT(poolInstanceId), PoolOwner: types.PARTY(partyTokenPoolOwner), RemoteChainSelector: types.NUMERIC(sourceChainSelector), - Direction: core.RateLimitDirectionRateLimitDirection_Outbound, - Mode: core.RateLimitModeRateLimitMode_DefaultFinality, + Direction: ratelimiter.RateLimitDirectionRateLimitDirection_Outbound, + Mode: ratelimiter.RateLimitModeRateLimitMode_DefaultFinality, IsEnabled: false, Capacity: types.NUMERIC("0"), Rate: types.NUMERIC("0"), @@ -439,7 +431,7 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest RemoteTokenAddress: types.TEXT(hex.EncodeToString(remoteTokenAddress)), InboundCCVs: []chainlinkapi.RawInstanceAddress{}, OutboundCCVs: []chainlinkapi.RawInstanceAddress{}, - FinalityConfig: core.FinalityConfig{ + FinalityConfig: ccipcodec.FinalityConfig{ BlockDepth: new(types.INT64(2000)), }, InboundRateLimiter: inboundRateLimiterAddr.Binding(), @@ -578,7 +570,7 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#" + ccipruntime.PackageName, ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouterFactory"}, + TemplateId: contracts.IdentifierFromBinding(ccipruntime.PerPartyRouterFactory{}), ContractId: perPartyRouterFactoryDisclosure.ContractId, Choice: "CreateRouter", ChoiceArgument: &apiv2.Value{Sum: &apiv2.Value_Record{Record: &apiv2.Record{Fields: []*apiv2.RecordField{ @@ -651,7 +643,7 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Create{Create: &apiv2.CreateCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-receiver", ModuleName: "CCIP.CCIPReceiver", EntityName: "CCIPReceiver"}, + TemplateId: contracts.IdentifierFromBinding(receiver.CCIPReceiver{}), CreateArguments: &apiv2.Record{Fields: []*apiv2.RecordField{ {Label: "instanceId", Value: &apiv2.Value{Sum: &apiv2.Value_Text{Text: "test-ccipreceiver"}}}, {Label: "owner", Value: &apiv2.Value{Sum: &apiv2.Value_Party{Party: partyReceiver}}}, @@ -690,13 +682,13 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest TokenTransfer: &receiver.TokenTransferInput{ TokenPoolCid: types.CONTRACT_ID(tokenPoolDisclosure.ContractId), TokenReceiverParty: types.PARTY(partyReceiver), - PoolExtraContext: tokenPoolDisclosure.ChoiceContext, + Context: tokenPoolDisclosure.ChoiceContext, }, CcvInputs: []receiver.CCVInput{ { CcvCid: types.CONTRACT_ID(ccvExecuteDisclosure.ContractId), VerifierResults: types.TEXT(verifierResultsHex), - CcvExtraContext: ccvExecuteDisclosure.ChoiceContext, + Context: ccvExecuteDisclosure.ChoiceContext, }, }, } @@ -708,7 +700,7 @@ func runBnMTokenPoolReceiveFlowTest(t *testing.T, tc bnmTokenPoolReceiveFlowTest CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-receiver", ModuleName: "CCIP.CCIPReceiver", EntityName: "CCIPReceiver"}, + TemplateId: contracts.IdentifierFromBinding(receiver.CCIPReceiver{}), ContractId: ccipReceiverCid, Choice: "Execute", ChoiceArgument: ledger.MapToValue(executeArgs), diff --git a/integration-tests/ccip/ccip_execute_token_lnr_test.go b/integration-tests/ccip/ccip_execute_token_lnr_test.go index 37e27743c..240061520 100644 --- a/integration-tests/ccip/ccip_execute_token_lnr_test.go +++ b/integration-tests/ccip/ccip_execute_token_lnr_test.go @@ -37,11 +37,13 @@ import ( "github.com/smartcontractkit/go-daml/pkg/service/ledger" "github.com/smartcontractkit/go-daml/pkg/types" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" executorBinding "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/executor" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/lockreleasetokenpool" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ratelimiter" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/receiver" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" @@ -141,31 +143,21 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest // DAR Uploading // Read DARs - rmnDar, err := contracts.GetDar(contracts.CCIPRMN, contracts.CurrentVersion) + runtimeDar, err := contracts.GetDar(contracts.CCIPRuntime, contracts.CurrentVersion) require.NoError(t, err) - commonDar, err := contracts.GetDar(contracts.CCIPCommon, contracts.CurrentVersion) - require.NoError(t, err) - offRampDar, err := contracts.GetDar(contracts.CCIPOffRamp, contracts.CurrentVersion) - require.NoError(t, err) - tokenAdminRegistryDar, err := contracts.GetDar(contracts.CCIPTokenAdminRegistry, contracts.CurrentVersion) + coreDar, err := contracts.GetDar(contracts.CCIPCore, contracts.CurrentVersion) require.NoError(t, err) committeeVerifierDar, err := contracts.GetDar(contracts.CCIPCommitteeVerifier, contracts.CurrentVersion) require.NoError(t, err) tokenPoolDar, err := contracts.GetDar(contracts.CCIPLockReleaseTokenPool, contracts.CurrentVersion) require.NoError(t, err) - perPartyRouterDar, err := contracts.GetDar(contracts.CCIPPerPartyRouter, contracts.CurrentVersion) - require.NoError(t, err) ccipReceiverDar, err := contracts.GetDar(contracts.CCIPReceiver, contracts.CurrentVersion) require.NoError(t, err) - onRampDar, err := contracts.GetDar(contracts.CCIPOnRamp, contracts.CurrentVersion) - require.NoError(t, err) - feeQuoterDar, err := contracts.GetDar(contracts.CCIPFeeQuoter, contracts.CurrentVersion) - require.NoError(t, err) executorDar, err := contracts.GetDar(contracts.CCIPExecutor, contracts.CurrentVersion) require.NoError(t, err) // Upload DARs to all participants - dars := [][]byte{rmnDar, commonDar, offRampDar, tokenAdminRegistryDar, committeeVerifierDar, tokenPoolDar, perPartyRouterDar, ccipReceiverDar, onRampDar, feeQuoterDar, executorDar} + dars := [][]byte{runtimeDar, coreDar, committeeVerifierDar, tokenPoolDar, ccipReceiverDar, executorDar} packageIds, err := testhelpers.UploadDARstoMultipleParticipants(t.Context(), dars, ccipParticipant, receiverParticipant, tokenPoolOwnerParticipant) require.NoError(t, err) t.Logf("Uploaded DARs to all participants: %v", packageIds) @@ -268,7 +260,7 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest MaxCCVsPerMsg: 10, DynamicConfig: executorBinding.DynamicConfig{ FeeAggregator: nil, - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, CcvAllowlistEnabled: false, }, AllowedCCVs: nil, @@ -373,14 +365,14 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest // Keep it enabled but lower-capacity so the test fails if the default-finality limiter // is selected for this FTF transfer instead of the custom-finality limiter. poolInstanceId := "test-pool-receive" - inboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployInbound, env.Chain, contractops.DeployInput[core.RateLimiter]{ + inboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployInbound, env.Chain, contractops.DeployInput[ratelimiter.RateLimiter]{ OwnerParty: types.PARTY(partyTokenPoolOwner), - Template: core.RateLimiter{ + Template: ratelimiter.RateLimiter{ PoolInstanceId: types.TEXT(poolInstanceId), PoolOwner: types.PARTY(partyTokenPoolOwner), RemoteChainSelector: types.NUMERIC(sourceChainSelector), - Direction: core.RateLimitDirectionRateLimitDirection_Inbound, - Mode: core.RateLimitModeRateLimitMode_DefaultFinality, + Direction: ratelimiter.RateLimitDirectionRateLimitDirection_Inbound, + Mode: ratelimiter.RateLimitModeRateLimitMode_DefaultFinality, IsEnabled: true, Capacity: types.NUMERIC(tc.defaultInboundLimiterCapacity), Rate: types.NUMERIC(tc.defaultInboundLimiterCapacity), @@ -393,14 +385,14 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest inboundRateLimiterAddr, err := contracts.RawInstanceAddressFromString(inboundRateLimiterRawAddr) require.NoError(t, err, "failed to parse inbound rate limiter address") - inboundCustomRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployInbound, env.Chain, contractops.DeployInput[core.RateLimiter]{ + inboundCustomRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployInbound, env.Chain, contractops.DeployInput[ratelimiter.RateLimiter]{ OwnerParty: types.PARTY(partyTokenPoolOwner), - Template: core.RateLimiter{ + Template: ratelimiter.RateLimiter{ PoolInstanceId: types.TEXT(poolInstanceId), PoolOwner: types.PARTY(partyTokenPoolOwner), RemoteChainSelector: types.NUMERIC(sourceChainSelector), - Direction: core.RateLimitDirectionRateLimitDirection_Inbound, - Mode: core.RateLimitModeRateLimitMode_CustomFinality, + Direction: ratelimiter.RateLimitDirectionRateLimitDirection_Inbound, + Mode: ratelimiter.RateLimitModeRateLimitMode_CustomFinality, IsEnabled: true, Capacity: types.NUMERIC(tc.customInboundLimiterCapacity), Rate: types.NUMERIC(tc.customInboundLimiterCapacity), @@ -413,14 +405,14 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest inboundCustomRateLimiterAddr, err := contracts.RawInstanceAddressFromString(inboundCustomRateLimiterRawAddr) require.NoError(t, err, "failed to parse inbound custom rate limiter address") - outboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployOutbound, env.Chain, contractops.DeployInput[core.RateLimiter]{ + outboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployOutbound, env.Chain, contractops.DeployInput[ratelimiter.RateLimiter]{ OwnerParty: types.PARTY(partyTokenPoolOwner), - Template: core.RateLimiter{ + Template: ratelimiter.RateLimiter{ PoolInstanceId: types.TEXT(poolInstanceId), PoolOwner: types.PARTY(partyTokenPoolOwner), RemoteChainSelector: types.NUMERIC(sourceChainSelector), - Direction: core.RateLimitDirectionRateLimitDirection_Outbound, - Mode: core.RateLimitModeRateLimitMode_DefaultFinality, + Direction: ratelimiter.RateLimitDirectionRateLimitDirection_Outbound, + Mode: ratelimiter.RateLimitModeRateLimitMode_DefaultFinality, IsEnabled: false, Capacity: types.NUMERIC("0"), Rate: types.NUMERIC("0"), @@ -454,7 +446,7 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest RemoteTokenAddress: types.TEXT(hex.EncodeToString(remoteTokenAddress)), InboundCCVs: []chainlinkapi.RawInstanceAddress{}, OutboundCCVs: []chainlinkapi.RawInstanceAddress{}, - FinalityConfig: core.FinalityConfig{ + FinalityConfig: ccipcodec.FinalityConfig{ BlockDepth: new(types.INT64(2000)), }, InboundRateLimiter: inboundRateLimiterAddr.Binding(), @@ -462,7 +454,7 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest OutboundRateLimiter: outboundRateLimiterAddr.Binding(), }, }, - TokenTransferFeeConfigs: map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig2{}, + TokenTransferFeeConfigs: map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig{}, Deps: lockreleasetokenpool.LockReleaseTokenPoolDeps{ TokenAdminRegistry: tokenAdminRegistryAddress.Binding(), RmnRemote: rmnRemoteAddress.Binding(), @@ -595,7 +587,7 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#" + ccipruntime.PackageName, ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouterFactory"}, + TemplateId: contracts.IdentifierFromBinding(ccipruntime.PerPartyRouterFactory{}), ContractId: perPartyRouterFactoryDisclosure.ContractId, Choice: "CreateRouter", ChoiceArgument: &apiv2.Value{Sum: &apiv2.Value_Record{Record: &apiv2.Record{Fields: []*apiv2.RecordField{ @@ -668,7 +660,7 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Create{Create: &apiv2.CreateCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-receiver", ModuleName: "CCIP.CCIPReceiver", EntityName: "CCIPReceiver"}, + TemplateId: contracts.IdentifierFromBinding(receiver.CCIPReceiver{}), CreateArguments: &apiv2.Record{Fields: []*apiv2.RecordField{ {Label: "instanceId", Value: &apiv2.Value{Sum: &apiv2.Value_Text{Text: "test-ccipreceiver"}}}, {Label: "owner", Value: &apiv2.Value{Sum: &apiv2.Value_Party{Party: partyReceiver}}}, @@ -707,13 +699,13 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest TokenTransfer: &receiver.TokenTransferInput{ TokenPoolCid: types.CONTRACT_ID(tokenPoolDisclosure.ContractId), TokenReceiverParty: types.PARTY(partyReceiver), - PoolExtraContext: tokenPoolDisclosure.ChoiceContext, + Context: tokenPoolDisclosure.ChoiceContext, }, CcvInputs: []receiver.CCVInput{ { CcvCid: types.CONTRACT_ID(ccvExecuteDisclosure.ContractId), VerifierResults: types.TEXT(verifierResultsHex), - CcvExtraContext: ccvExecuteDisclosure.ChoiceContext, + Context: ccvExecuteDisclosure.ChoiceContext, }, }, } @@ -725,7 +717,7 @@ func runLnRTokenPoolReceiveFlowTest(t *testing.T, tc lnrTokenPoolReceiveFlowTest CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-receiver", ModuleName: "CCIP.CCIPReceiver", EntityName: "CCIPReceiver"}, + TemplateId: contracts.IdentifierFromBinding(receiver.CCIPReceiver{}), ContractId: ccipReceiverCid, Choice: "Execute", ChoiceArgument: ledger.MapToValue(executeArgs), @@ -832,9 +824,7 @@ func encodeUint256Bytes(value uint64) []byte { } func findActiveRateLimiterByInstanceID(ctx context.Context, participant canton.Participant, instanceID string) (*apiv2.ActiveContract, error) { - rateLimiters, err := testhelpers.ListActiveContractsByTemplateId(ctx, participant, &apiv2.Identifier{ - PackageId: "#" + core.PackageName, ModuleName: "CCIP.RateLimiter", EntityName: "RateLimiter", - }) + rateLimiters, err := testhelpers.ListActiveContractsByTemplateId(ctx, participant, contracts.IdentifierFromBinding(ratelimiter.RateLimiter{})) if err != nil { return nil, err } diff --git a/integration-tests/ccip/ccip_send_test.go b/integration-tests/ccip/ccip_send_test.go index b9e942af1..c72646a3e 100644 --- a/integration-tests/ccip/ccip_send_test.go +++ b/integration-tests/ccip/ccip_send_test.go @@ -35,9 +35,13 @@ import ( "github.com/smartcontractkit/go-daml/pkg/service/ledger" "github.com/smartcontractkit/go-daml/pkg/types" + "github.com/smartcontractkit/chainlink-canton/bindings" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/clientapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" executorBinding "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/executor" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/sender" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" @@ -86,22 +90,12 @@ func TestCCIPSend(t *testing.T) { }) // Upload DARs - commonDar, err := contracts.GetDar(contracts.CCIPCommon, contracts.CurrentVersion) + runtimeDar, err := contracts.GetDar(contracts.CCIPRuntime, contracts.CurrentVersion) require.NoError(t, err) - offRampDar, err := contracts.GetDar(contracts.CCIPOffRamp, contracts.CurrentVersion) - require.NoError(t, err) - onRampDar, err := contracts.GetDar(contracts.CCIPOnRamp, contracts.CurrentVersion) - require.NoError(t, err) - feeQuoterDar, err := contracts.GetDar(contracts.CCIPFeeQuoter, contracts.CurrentVersion) - require.NoError(t, err) - tokenAdminRegistryDar, err := contracts.GetDar(contracts.CCIPTokenAdminRegistry, contracts.CurrentVersion) + coreDar, err := contracts.GetDar(contracts.CCIPCore, contracts.CurrentVersion) require.NoError(t, err) committeeVerifierDar, err := contracts.GetDar(contracts.CCIPCommitteeVerifier, contracts.CurrentVersion) require.NoError(t, err) - perPartyRouterDar, err := contracts.GetDar(contracts.CCIPPerPartyRouter, contracts.CurrentVersion) - require.NoError(t, err) - rmnDar, err := contracts.GetDar(contracts.CCIPRMN, contracts.CurrentVersion) - require.NoError(t, err) ccipSenderDar, err := contracts.GetDar(contracts.CCIPSender, contracts.CurrentVersion) require.NoError(t, err) ccipExecutorDar, err := contracts.GetDar(contracts.CCIPExecutor, contracts.CurrentVersion) @@ -109,7 +103,7 @@ func TestCCIPSend(t *testing.T) { ccipTestDar, err := contracts.GetDar(contracts.CCIPTest, contracts.CurrentVersion) require.NoError(t, err) - dars := [][]byte{commonDar, offRampDar, onRampDar, feeQuoterDar, tokenAdminRegistryDar, committeeVerifierDar, perPartyRouterDar, rmnDar, ccipSenderDar, ccipExecutorDar, ccipTestDar} + dars := [][]byte{runtimeDar, coreDar, committeeVerifierDar, ccipSenderDar, ccipExecutorDar, ccipTestDar} packageIds, err := testhelpers.UploadDARstoMultipleParticipants(t.Context(), dars, ccipParticipant, senderParticipant) require.NoError(t, err) t.Logf("Uploaded DARs to all participants: %v", packageIds) @@ -196,7 +190,7 @@ func TestCCIPSend(t *testing.T) { MaxCCVsPerMsg: 10, DynamicConfig: executorBinding.DynamicConfig{ FeeAggregator: nil, - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, CcvAllowlistEnabled: false, }, AllowedCCVs: nil, @@ -432,7 +426,7 @@ func TestCCIPSend(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#" + ccipruntime.PackageName, ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouterFactory"}, + TemplateId: contracts.IdentifierFromBinding(ccipruntime.PerPartyRouterFactory{}), ContractId: perPartyRouterFactoryDisclosure.ContractId, Choice: "CreateRouter", ChoiceArgument: ledger.MapToValue(ccipruntime.CreateRouter{ @@ -469,7 +463,7 @@ func TestCCIPSend(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Create{Create: &apiv2.CreateCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender"}, + TemplateId: contracts.IdentifierFromBinding(sender.CCIPSender{}), CreateArguments: &apiv2.Record{Fields: []*apiv2.RecordField{ {Label: "instanceId", Value: &apiv2.Value{Sum: &apiv2.Value_Text{Text: "test-ccipsender"}}}, {Label: "owner", Value: &apiv2.Value{Sum: &apiv2.Value_Party{Party: partySender}}}, @@ -484,13 +478,9 @@ func TestCCIPSend(t *testing.T) { t.Logf("Deployed CCIPSender: %s", ccipSenderCid) // Get disclosures for CCIPSender.Send - disclosedCCIPSender, err := testhelpers.GetDisclosedContractByTemplateId(t.Context(), senderParticipant, &apiv2.Identifier{ - PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender", - }) + disclosedCCIPSender, err := testhelpers.GetDisclosedContractByTemplateId(t.Context(), senderParticipant, contracts.IdentifierFromBinding(sender.CCIPSender{})) require.NoError(t, err) - disclosedRouter, err := testhelpers.GetDisclosedContractByTemplateId(t.Context(), senderParticipant, &apiv2.Identifier{ - PackageId: "#" + ccipruntime.PackageName, ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouter", - }) + disclosedRouter, err := testhelpers.GetDisclosedContractByTemplateId(t.Context(), senderParticipant, contracts.IdentifierFromBinding(ccipruntime.PerPartyRouter{})) require.NoError(t, err) // Prepare receiver address (destination party encoded as keccak256) @@ -598,21 +588,21 @@ func TestCCIPSend(t *testing.T) { Context: ccipSendDisclosure.ChoiceContext, RouterCid: types.CONTRACT_ID(routerCid), DestinationChainSelector: types.NUMERIC(strconv.FormatUint(remoteSelector, 10)), - Message: core.Canton2AnyMessage{ + Message: clientapi.Canton2AnyMessage{ Receiver: types.TEXT(receiverHex), Payload: types.TEXT(testPayloadHex), FeeToken: nativeInstrumentId, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: clientapi.ExtraArgs{ + V3: &clientapi.GenericExtraArgsV3{ GasLimit: 100_000, - Ccvs: []core.CCVExtraArg{ + Ccvs: []clientapi.CCVExtraArg{ { CcvAddress: ccvRawAddr, CcvArgs: types.TEXT(""), }, }, - Executor: core.ExecutorExtraArg{ - ExecutorWithAddress: &core.ExecutorWithAddress{ + Executor: clientapi.ExecutorExtraArg{ + ExecutorWithAddress: &clientapi.ExecutorWithAddress{ ExecutorAddress: execMcmsAddr, ExecutorArgs: types.TEXT(""), }, @@ -637,14 +627,14 @@ func TestCCIPSend(t *testing.T) { }, CcvSendInputs: []sender.CCVSendInput{ { - CcvAddress: ccvSendDisclosure.Address.Binding(), - CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), - CcvExtraContext: splice_api_token_metadata_v1.ChoiceContext{}, + CcvAddress: ccvSendDisclosure.Address.Binding(), + CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), + Context: splice_api_token_metadata_v1.ChoiceContext{}, }, }, ExecutorInput: &sender.ExecutorInput{ - ExecutorCid: types.CONTRACT_ID(executorSendDisclosure.ContractId), - ExecutorExtraContext: splice_api_token_metadata_v1.ChoiceContext{}, + ExecutorCid: types.CONTRACT_ID(executorSendDisclosure.ContractId), + Context: splice_api_token_metadata_v1.ChoiceContext{}, }, } @@ -688,7 +678,7 @@ func TestCCIPSend(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender"}, + TemplateId: contracts.IdentifierFromBinding(sender.CCIPSender{}), ContractId: ccipSenderCid, Choice: "Send", ChoiceArgument: ledger.MapToValue(sendArgs), @@ -710,32 +700,28 @@ func TestCCIPSend(t *testing.T) { } } - // Extract messageId from CCIPMessageSent to verify success - var returnedMessageId string - var returnedEncodedMessage string + // Extract CIPMessageSent event to verify success + eventTemplateId := events.CCIPMessageSent{}.GetTemplateID() + var ccipMessageSent *events.CCIPMessageSent for _, event := range res.GetTransaction().GetEvents() { - if e, ok := event.GetEvent().(*apiv2.Event_Created); ok { - if e.Created.GetTemplateId().GetEntityName() == "CCIPMessageSent" { - fields := e.Created.GetCreateArguments().GetFields() - if len(fields) >= 5 { - // fields[4] is the "event" field (CCIPMessageSentEvent) - // (ccipOwner, ccvOwners, sender, observers, event) - eventField := fields[4].GetValue().GetRecord() - if eventField != nil && len(eventField.Fields) >= 4 { - // eventField.Fields[2] is messageId, eventField.Fields[3] is encodedMessage - returnedMessageId = eventField.Fields[2].GetValue().GetText() - if len(eventField.Fields) >= 4 { - returnedEncodedMessage = eventField.Fields[3].GetValue().GetText() - } - } + if createdEvent := event.GetCreated(); createdEvent != nil { + if templateId := createdEvent.GetTemplateId(); templateId != nil { + gotTemplateId := fmt.Sprintf("#%s:%s:%s", createdEvent.GetPackageName(), templateId.GetModuleName(), templateId.GetEntityName()) + if gotTemplateId == eventTemplateId { + // Found CCIPMessageSent event + ccipMessageSent, err = bindings.UnmarshalCreatedEvent[events.CCIPMessageSent](createdEvent) + require.NoError(t, err) + break } - - break } } } - require.NotEmpty(t, returnedMessageId, "CCIPMessageSent should be created") - require.NotEmpty(t, returnedEncodedMessage, "CCIPMessageSent should contain encoded message") + require.NotNil(t, ccipMessageSent, "CCIPMessageSent event not found") + require.NotEmpty(t, ccipMessageSent.Event.MessageId, "CCIPMessageSent should be created") + require.NotEmpty(t, ccipMessageSent.Event.EncodedMessage, "CCIPMessageSent should contain encoded message") + + // Verify that the event contains the feeToken InstrumentId + require.Equal(t, nativeInstrumentId, ccipMessageSent.Event.FeeToken, "CCIPMessageSent should contain feeToken InstrumentId") senderBalanceAfter, err := testhelpers.GetHoldingsBalance(t.Context(), senderParticipant, &nativeInstrumentId) require.NoError(t, err) @@ -752,9 +738,9 @@ func TestCCIPSend(t *testing.T) { require.Zero(t, ccipOwnerDelta.Cmp(quotedFeeAmount), "ccipOwner should receive the full quoted fee (executor is also owned by ccipOwner in this test)") t.Logf("Send completed") - t.Logf(" Message ID: %s", returnedMessageId) + t.Logf(" Message ID: %s", ccipMessageSent.Event.MessageId) t.Logf(" Original payload: %s", string(testPayload)) - t.Logf(" Encoded message: %s", returnedEncodedMessage) + t.Logf(" Encoded message: %s", ccipMessageSent.Event.EncodedMessage) t.Logf("✅ Success") } diff --git a/integration-tests/ccip/ccip_send_with_token_bnm_test.go b/integration-tests/ccip/ccip_send_with_token_bnm_test.go index f7bedf6e0..0be4f8ede 100644 --- a/integration-tests/ccip/ccip_send_with_token_bnm_test.go +++ b/integration-tests/ccip/ccip_send_with_token_bnm_test.go @@ -36,11 +36,16 @@ import ( "github.com/smartcontractkit/go-daml/pkg/service/ledger" "github.com/smartcontractkit/go-daml/pkg/types" + "github.com/smartcontractkit/chainlink-canton/bindings" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/burnminttokenpool" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/clientapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" executorBinding "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/executor" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ratelimiter" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/sender" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/link" @@ -96,22 +101,12 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { }) // Upload DARs - commonDar, err := contracts.GetDar(contracts.CCIPCommon, contracts.CurrentVersion) + runtimeDar, err := contracts.GetDar(contracts.CCIPRuntime, contracts.CurrentVersion) require.NoError(t, err) - offRampDar, err := contracts.GetDar(contracts.CCIPOffRamp, contracts.CurrentVersion) - require.NoError(t, err) - onRampDar, err := contracts.GetDar(contracts.CCIPOnRamp, contracts.CurrentVersion) - require.NoError(t, err) - feeQuoterDar, err := contracts.GetDar(contracts.CCIPFeeQuoter, contracts.CurrentVersion) - require.NoError(t, err) - tokenAdminRegistryDar, err := contracts.GetDar(contracts.CCIPTokenAdminRegistry, contracts.CurrentVersion) + coreDat, err := contracts.GetDar(contracts.CCIPCore, contracts.CurrentVersion) require.NoError(t, err) committeeVerifierDar, err := contracts.GetDar(contracts.CCIPCommitteeVerifier, contracts.CurrentVersion) require.NoError(t, err) - perPartyRouterDar, err := contracts.GetDar(contracts.CCIPPerPartyRouter, contracts.CurrentVersion) - require.NoError(t, err) - rmnDar, err := contracts.GetDar(contracts.CCIPRMN, contracts.CurrentVersion) - require.NoError(t, err) ccipSenderDar, err := contracts.GetDar(contracts.CCIPSender, contracts.CurrentVersion) require.NoError(t, err) ccipExecutorDar, err := contracts.GetDar(contracts.CCIPExecutor, contracts.CurrentVersion) @@ -123,7 +118,7 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { ccipTestDar, err := contracts.GetDar(contracts.CCIPTest, contracts.CurrentVersion) require.NoError(t, err) - dars := [][]byte{commonDar, offRampDar, onRampDar, feeQuoterDar, tokenAdminRegistryDar, committeeVerifierDar, perPartyRouterDar, rmnDar, ccipSenderDar, ccipExecutorDar, tokenPoolDar, linkTokenDar, ccipTestDar} + dars := [][]byte{runtimeDar, coreDat, committeeVerifierDar, ccipSenderDar, ccipExecutorDar, tokenPoolDar, linkTokenDar, ccipTestDar} packageIds, err := testhelpers.UploadDARstoMultipleParticipants(t.Context(), dars, ccipParticipant, senderParticipant) require.NoError(t, err) t.Logf("Uploaded DARs to all participants: %v", packageIds) @@ -218,7 +213,7 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { MaxCCVsPerMsg: 10, DynamicConfig: executorBinding.DynamicConfig{ FeeAggregator: nil, - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, CcvAllowlistEnabled: false, }, AllowedCCVs: nil, @@ -381,15 +376,15 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { // Setup token pool for outbound token transfer in Send. poolInstanceID := "test-pool-send" - outboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployOutbound, env.Chain, contractops.DeployInput[core.RateLimiter]{ + outboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployOutbound, env.Chain, contractops.DeployInput[ratelimiter.RateLimiter]{ ParticipantIndex: 1, OwnerParty: types.PARTY(partySender), - Template: core.RateLimiter{ + Template: ratelimiter.RateLimiter{ PoolInstanceId: types.TEXT(poolInstanceID), PoolOwner: types.PARTY(partySender), RemoteChainSelector: types.NUMERIC(strconv.FormatUint(remoteSelector, 10)), - Direction: core.RateLimitDirectionRateLimitDirection_Outbound, - Mode: core.RateLimitModeRateLimitMode_DefaultFinality, + Direction: ratelimiter.RateLimitDirectionRateLimitDirection_Outbound, + Mode: ratelimiter.RateLimitModeRateLimitMode_DefaultFinality, IsEnabled: true, Capacity: types.NUMERIC("10000000000"), Rate: types.NUMERIC("10000000000"), @@ -425,7 +420,7 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { RemoteTokenAddress: types.TEXT(hex.EncodeToString(remoteTokenAddress)), InboundCCVs: []chainlinkapi.RawInstanceAddress{}, OutboundCCVs: []chainlinkapi.RawInstanceAddress{}, - FinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + FinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, InboundRateLimiter: outboundRateLimiterAddr.Binding(), InboundCustomBlockConfirmationsRateLimiter: outboundRateLimiterAddr.Binding(), OutboundRateLimiter: outboundRateLimiterAddr.Binding(), @@ -644,7 +639,7 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#" + ccipruntime.PackageName, ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouterFactory"}, + TemplateId: contracts.IdentifierFromBinding(ccipruntime.PerPartyRouterFactory{}), ContractId: perPartyRouterFactoryDisclosure.ContractId, Choice: "CreateRouter", ChoiceArgument: &apiv2.Value{Sum: &apiv2.Value_Record{Record: &apiv2.Record{Fields: []*apiv2.RecordField{ @@ -681,7 +676,7 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Create{Create: &apiv2.CreateCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender"}, + TemplateId: contracts.IdentifierFromBinding(sender.CCIPSender{}), CreateArguments: &apiv2.Record{Fields: []*apiv2.RecordField{ {Label: "instanceId", Value: &apiv2.Value{Sum: &apiv2.Value_Text{Text: "test-ccipsender"}}}, {Label: "owner", Value: &apiv2.Value{Sum: &apiv2.Value_Party{Party: partySender}}}, @@ -739,7 +734,7 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { var senderLinkHoldings []*apiv2.ActiveContract require.Eventually(t, func() bool { var listErr error - senderLinkHoldings, listErr = testhelpers.ListActiveContractsByTemplateId(t.Context(), senderParticipant, contracts.TemplateIDFromBinding(link.LinkHolding{}).ToLedgerIdentifier()) + senderLinkHoldings, listErr = testhelpers.ListActiveContractsByTemplateId(t.Context(), senderParticipant, contracts.IdentifierFromBinding(link.LinkHolding{})) if listErr != nil { return false } @@ -861,25 +856,25 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { Context: ccipSendDisclosure.ChoiceContext, RouterCid: types.CONTRACT_ID(routerCid), DestinationChainSelector: types.NUMERIC(strconv.FormatUint(remoteSelector, 10)), - Message: core.Canton2AnyMessage{ + Message: clientapi.Canton2AnyMessage{ Receiver: types.TEXT(receiverHex), Payload: types.TEXT(testPayloadHex), - TokenTransfer: &core.TokenTransfer{ + TokenTransfer: &clientapi.TokenTransfer{ Token: linkInstrumentId, Amount: types.NUMERIC(tokenTransferAmountDecimal), }, FeeToken: nativeInstrumentId, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: clientapi.ExtraArgs{ + V3: &clientapi.GenericExtraArgsV3{ GasLimit: 0, - Ccvs: []core.CCVExtraArg{ + Ccvs: []clientapi.CCVExtraArg{ { CcvAddress: committeeVerifierAddress.Binding(), CcvArgs: types.TEXT(""), }, }, - Executor: core.ExecutorExtraArg{ - ExecutorWithAddress: &core.ExecutorWithAddress{ + Executor: clientapi.ExecutorExtraArg{ + ExecutorWithAddress: &clientapi.ExecutorWithAddress{ ExecutorAddress: executorAddress.Binding(), ExecutorArgs: types.TEXT(""), }, @@ -904,19 +899,19 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { }, CcvSendInputs: []sender.CCVSendInput{ { - CcvAddress: ccvSendDisclosure.Address.Binding(), - CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), - CcvExtraContext: ccvSendDisclosure.ChoiceContext, + CcvAddress: ccvSendDisclosure.Address.Binding(), + CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), + Context: ccvSendDisclosure.ChoiceContext, }, }, TokenTransferInput: &sender.TokenTransferInput{ - SenderInputCids: senderHoldingCids, - TokenPoolCid: types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId), - PoolExtraContext: tokenPoolSendDisclosure.ChoiceContext, + SenderInputCids: senderHoldingCids, + TokenPoolCid: types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId), + Context: tokenPoolSendDisclosure.ChoiceContext, }, ExecutorInput: &sender.ExecutorInput{ - ExecutorCid: types.CONTRACT_ID(executorSendDisclosure.ContractId), - ExecutorExtraContext: executorSendDisclosure.ChoiceContext, + ExecutorCid: types.CONTRACT_ID(executorSendDisclosure.ContractId), + Context: executorSendDisclosure.ChoiceContext, }, } @@ -951,11 +946,11 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { sendArgs.Context = ccipSendDisclosure.ChoiceContext sendArgs.FeeTokenInput.FeeTokenConfigCid = types.CONTRACT_ID(ccipSendDisclosure.FeeTokenConfigCid) sendArgs.CcvSendInputs[0].CcvCid = types.CONTRACT_ID(ccvSendDisclosure.ContractId) - sendArgs.CcvSendInputs[0].CcvExtraContext = ccvSendDisclosure.ChoiceContext + sendArgs.CcvSendInputs[0].Context = ccvSendDisclosure.ChoiceContext sendArgs.TokenTransferInput.TokenPoolCid = types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId) - sendArgs.TokenTransferInput.PoolExtraContext = tokenPoolSendDisclosure.ChoiceContext + sendArgs.TokenTransferInput.Context = tokenPoolSendDisclosure.ChoiceContext sendArgs.ExecutorInput.ExecutorCid = types.CONTRACT_ID(executorSendDisclosure.ContractId) - sendArgs.ExecutorInput.ExecutorExtraContext = executorSendDisclosure.ChoiceContext + sendArgs.ExecutorInput.Context = executorSendDisclosure.ChoiceContext sendDisclosures = testhelpers.DeduplicateDisclosedContracts(slices.Concat( transferFactoryDisclosures, ccipSendDisclosure.DisclosedContracts, @@ -975,7 +970,7 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender"}, + TemplateId: contracts.IdentifierFromBinding(sender.CCIPSender{}), ContractId: ccipSenderCid, Choice: "Send", ChoiceArgument: ledger.MapToValue(sendArgs), @@ -987,36 +982,37 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { }) require.NoError(t, err) - // Extract messageId from CCIPMessageSent to verify success - var returnedMessageId string - var returnedEncodedMessage string + // Extract CIPMessageSent event to verify success + eventTemplateId := events.CCIPMessageSent{}.GetTemplateID() + var ccipMessageSent *events.CCIPMessageSent for _, event := range res.GetTransaction().GetEvents() { - if e, ok := event.GetEvent().(*apiv2.Event_Created); ok { - if e.Created.GetTemplateId().GetEntityName() == "CCIPMessageSent" { - fields := e.Created.GetCreateArguments().GetFields() - if len(fields) >= 5 { - eventField := fields[4].GetValue().GetRecord() - if eventField != nil { - for _, field := range eventField.Fields { - if field.GetLabel() == "messageId" { - returnedMessageId = field.GetValue().GetText() - } - if field.GetLabel() == "encodedMessage" { - returnedEncodedMessage = field.GetValue().GetText() - } - } - } + if createdEvent := event.GetCreated(); createdEvent != nil { + if templateId := createdEvent.GetTemplateId(); templateId != nil { + gotTemplateId := fmt.Sprintf("#%s:%s:%s", createdEvent.GetPackageName(), templateId.GetModuleName(), templateId.GetEntityName()) + if gotTemplateId == eventTemplateId { + // Found CCIPMessageSent event + ccipMessageSent, err = bindings.UnmarshalCreatedEvent[events.CCIPMessageSent](createdEvent) + require.NoError(t, err) + break } - - break } } } - require.NotEmpty(t, returnedMessageId, "CCIPMessageSent should be created") - require.NotEmpty(t, returnedEncodedMessage, "CCIPMessageSent should contain encoded message") + require.NotNil(t, ccipMessageSent, "CCIPMessageSent event not found") + require.NotEmpty(t, ccipMessageSent.Event.MessageId, "CCIPMessageSent should be created") + require.NotEmpty(t, ccipMessageSent.Event.EncodedMessage, "CCIPMessageSent should contain encoded message") + + // Verify that the event contains the feeToken InstrumentId + require.Equal(t, nativeInstrumentId, ccipMessageSent.Event.FeeToken, "CCIPMessageSent should contain feeToken InstrumentId") // Verify pool feeBps haircut: 10,000 smallest units with 5% feeBps => 9,500 bridged. - require.Equal(t, int64(9500), extractTokenTransferAmountFromEncodedMessageHex(t, returnedEncodedMessage), "encoded token amount should be net after 5% feeBps") + require.Equal(t, int64(9500), extractTokenTransferAmountFromEncodedMessageHex(t, ccipMessageSent.Event.EncodedMessage), "encoded token amount should be net after 5% feeBps") + // Verify that the event itself contains the original amount without fees + wantAmount, ok := new(big.Rat).SetString(tokenTransferAmountDecimal) + require.True(t, ok, "token transfer amount should parse as a decimal value") + gotAmount, ok := new(big.Rat).SetString(string(ccipMessageSent.Event.TokenAmountBeforeTokenPoolFees)) + require.True(t, ok, "token amount before token pool fees should parse as a decimal value") + require.Equal(t, 0, wantAmount.Cmp(gotAmount), "token amount before token pool fees should match original transfer amount") quotedFeeAmount, ok := new(big.Rat).SetString(feeStr) require.True(t, ok, "quoted fee should parse as a decimal value") @@ -1048,7 +1044,7 @@ func TestBnMTokenPool_FullSendFlow(t *testing.T) { }, 15*time.Second, 200*time.Millisecond, "sender LINK deduction should equal net token transfer amount after pool feeBps") t.Logf("Send completed") - t.Logf(" Message ID: %s", returnedMessageId) + t.Logf(" Message ID: %s", ccipMessageSent.Event.MessageId) t.Logf(" Original payload: %s", string(testPayload)) t.Logf("✅ Success") diff --git a/integration-tests/ccip/ccip_send_with_token_lnr_test.go b/integration-tests/ccip/ccip_send_with_token_lnr_test.go index 3375d2646..2744c4abc 100644 --- a/integration-tests/ccip/ccip_send_with_token_lnr_test.go +++ b/integration-tests/ccip/ccip_send_with_token_lnr_test.go @@ -35,11 +35,16 @@ import ( "github.com/smartcontractkit/go-daml/pkg/service/ledger" "github.com/smartcontractkit/go-daml/pkg/types" + "github.com/smartcontractkit/chainlink-canton/bindings" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipruntime" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/clientapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/committeeverifier" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/events" executorBinding "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/executor" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/lockreleasetokenpool" + "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ratelimiter" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/sender" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/chainlink/chainlinkapi" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/splice/splice_api_token_holding_v1" @@ -92,22 +97,12 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { }) // Upload DARs - commonDar, err := contracts.GetDar(contracts.CCIPCommon, contracts.CurrentVersion) + runtimeDar, err := contracts.GetDar(contracts.CCIPRuntime, contracts.CurrentVersion) require.NoError(t, err) - offRampDar, err := contracts.GetDar(contracts.CCIPOffRamp, contracts.CurrentVersion) - require.NoError(t, err) - onRampDar, err := contracts.GetDar(contracts.CCIPOnRamp, contracts.CurrentVersion) - require.NoError(t, err) - feeQuoterDar, err := contracts.GetDar(contracts.CCIPFeeQuoter, contracts.CurrentVersion) - require.NoError(t, err) - tokenAdminRegistryDar, err := contracts.GetDar(contracts.CCIPTokenAdminRegistry, contracts.CurrentVersion) + coreDar, err := contracts.GetDar(contracts.CCIPCore, contracts.CurrentVersion) require.NoError(t, err) committeeVerifierDar, err := contracts.GetDar(contracts.CCIPCommitteeVerifier, contracts.CurrentVersion) require.NoError(t, err) - perPartyRouterDar, err := contracts.GetDar(contracts.CCIPPerPartyRouter, contracts.CurrentVersion) - require.NoError(t, err) - rmnDar, err := contracts.GetDar(contracts.CCIPRMN, contracts.CurrentVersion) - require.NoError(t, err) ccipSenderDar, err := contracts.GetDar(contracts.CCIPSender, contracts.CurrentVersion) require.NoError(t, err) ccipExecutorDar, err := contracts.GetDar(contracts.CCIPExecutor, contracts.CurrentVersion) @@ -117,7 +112,7 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { ccipTestDar, err := contracts.GetDar(contracts.CCIPTest, contracts.CurrentVersion) require.NoError(t, err) - dars := [][]byte{commonDar, offRampDar, onRampDar, feeQuoterDar, tokenAdminRegistryDar, committeeVerifierDar, perPartyRouterDar, rmnDar, ccipSenderDar, ccipExecutorDar, lockReleaseTokenPoolDar, ccipTestDar} + dars := [][]byte{runtimeDar, coreDar, committeeVerifierDar, ccipSenderDar, ccipExecutorDar, lockReleaseTokenPoolDar, ccipTestDar} packageIds, err := testhelpers.UploadDARstoMultipleParticipants(t.Context(), dars, ccipParticipant, senderParticipant) require.NoError(t, err) t.Logf("Uploaded DARs to all participants: %v", packageIds) @@ -208,7 +203,7 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { MaxCCVsPerMsg: 10, DynamicConfig: executorBinding.DynamicConfig{ FeeAggregator: nil, - AllowedFinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + AllowedFinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, CcvAllowlistEnabled: false, }, AllowedCCVs: nil, @@ -357,15 +352,15 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { // Setup token pool for outbound token transfer in Send. poolInstanceID := "test-pool-send" - outboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployOutbound, env.Chain, contractops.DeployInput[core.RateLimiter]{ + outboundRateLimiterOut, err := cld_ops.ExecuteOperation(bundle, rate_limiter.DeployOutbound, env.Chain, contractops.DeployInput[ratelimiter.RateLimiter]{ ParticipantIndex: 1, OwnerParty: types.PARTY(partySender), - Template: core.RateLimiter{ + Template: ratelimiter.RateLimiter{ PoolInstanceId: types.TEXT(poolInstanceID), PoolOwner: types.PARTY(partySender), RemoteChainSelector: types.NUMERIC(strconv.FormatUint(remoteSelector, 10)), - Direction: core.RateLimitDirectionRateLimitDirection_Outbound, - Mode: core.RateLimitModeRateLimitMode_DefaultFinality, + Direction: ratelimiter.RateLimitDirectionRateLimitDirection_Outbound, + Mode: ratelimiter.RateLimitModeRateLimitMode_DefaultFinality, IsEnabled: true, Capacity: types.NUMERIC("10000000000"), Rate: types.NUMERIC("10000000000"), @@ -409,14 +404,14 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { RemoteTokenAddress: types.TEXT(hex.EncodeToString(remoteTokenAddress)), InboundCCVs: []chainlinkapi.RawInstanceAddress{}, OutboundCCVs: []chainlinkapi.RawInstanceAddress{}, - FinalityConfig: core.FinalityConfig{WaitForFinality: &types.UNIT{}}, + FinalityConfig: ccipcodec.FinalityConfig{WaitForFinality: &types.UNIT{}}, InboundRateLimiter: outboundRateLimiterAddr.Binding(), InboundCustomBlockConfirmationsRateLimiter: outboundRateLimiterAddr.Binding(), OutboundRateLimiter: outboundRateLimiterAddr.Binding(), }, }, // Set a custom token transfer fee config - TokenTransferFeeConfigs: map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig2{ + TokenTransferFeeConfigs: map[types.NUMERIC]lockreleasetokenpool.TokenTransferFeeConfig{ types.NUMERIC(strconv.FormatUint(remoteSelector, 10)): { IsEnabled: types.BOOL(true), DestGasOverhead: types.INT64(25_000), @@ -636,7 +631,7 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#" + ccipruntime.PackageName, ModuleName: "CCIP.PerPartyRouter", EntityName: "PerPartyRouterFactory"}, + TemplateId: contracts.IdentifierFromBinding(ccipruntime.PerPartyRouterFactory{}), ContractId: perPartyRouterFactoryDisclosure.ContractId, Choice: "CreateRouter", ChoiceArgument: &apiv2.Value{Sum: &apiv2.Value_Record{Record: &apiv2.Record{Fields: []*apiv2.RecordField{ @@ -673,7 +668,7 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Create{Create: &apiv2.CreateCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender"}, + TemplateId: contracts.IdentifierFromBinding(sender.CCIPSender{}), CreateArguments: &apiv2.Record{Fields: []*apiv2.RecordField{ {Label: "instanceId", Value: &apiv2.Value{Sum: &apiv2.Value_Text{Text: "test-ccipsender"}}}, {Label: "owner", Value: &apiv2.Value{Sum: &apiv2.Value_Party{Party: partySender}}}, @@ -808,25 +803,25 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { Context: ccipSendDisclosure.ChoiceContext, RouterCid: types.CONTRACT_ID(routerCid), DestinationChainSelector: types.NUMERIC(strconv.FormatUint(remoteSelector, 10)), - Message: core.Canton2AnyMessage{ + Message: clientapi.Canton2AnyMessage{ Receiver: types.TEXT(receiverHex), Payload: types.TEXT(testPayloadHex), - TokenTransfer: &core.TokenTransfer{ + TokenTransfer: &clientapi.TokenTransfer{ Token: nativeInstrumentId, Amount: types.NUMERIC(tokenTransferAmountDecimal), }, FeeToken: nativeInstrumentId, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: clientapi.ExtraArgs{ + V3: &clientapi.GenericExtraArgsV3{ GasLimit: 0, - Ccvs: []core.CCVExtraArg{ + Ccvs: []clientapi.CCVExtraArg{ { CcvAddress: committeeVerifierAddress.Binding(), CcvArgs: types.TEXT(""), }, }, - Executor: core.ExecutorExtraArg{ - ExecutorWithAddress: &core.ExecutorWithAddress{ + Executor: clientapi.ExecutorExtraArg{ + ExecutorWithAddress: &clientapi.ExecutorWithAddress{ ExecutorAddress: executorAddress.Binding(), ExecutorArgs: types.TEXT(""), }, @@ -851,19 +846,19 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { }, CcvSendInputs: []sender.CCVSendInput{ { - CcvAddress: ccvSendDisclosure.Address.Binding(), - CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), - CcvExtraContext: ccvSendDisclosure.ChoiceContext, + CcvAddress: ccvSendDisclosure.Address.Binding(), + CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), + Context: ccvSendDisclosure.ChoiceContext, }, }, TokenTransferInput: &sender.TokenTransferInput{ - SenderInputCids: []types.CONTRACT_ID{types.CONTRACT_ID(tokenTransferHoldingCid)}, - TokenPoolCid: types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId), - PoolExtraContext: tokenPoolSendDisclosure.ChoiceContext, + SenderInputCids: []types.CONTRACT_ID{types.CONTRACT_ID(tokenTransferHoldingCid)}, + TokenPoolCid: types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId), + Context: tokenPoolSendDisclosure.ChoiceContext, }, ExecutorInput: &sender.ExecutorInput{ - ExecutorCid: types.CONTRACT_ID(executorSendDisclosure.ContractId), - ExecutorExtraContext: executorSendDisclosure.ChoiceContext, + ExecutorCid: types.CONTRACT_ID(executorSendDisclosure.ContractId), + Context: executorSendDisclosure.ChoiceContext, }, } @@ -898,11 +893,11 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { sendArgs.Context = ccipSendDisclosure.ChoiceContext sendArgs.FeeTokenInput.FeeTokenConfigCid = types.CONTRACT_ID(ccipSendDisclosure.FeeTokenConfigCid) sendArgs.CcvSendInputs[0].CcvCid = types.CONTRACT_ID(ccvSendDisclosure.ContractId) - sendArgs.CcvSendInputs[0].CcvExtraContext = ccvSendDisclosure.ChoiceContext + sendArgs.CcvSendInputs[0].Context = ccvSendDisclosure.ChoiceContext sendArgs.TokenTransferInput.TokenPoolCid = types.CONTRACT_ID(tokenPoolSendDisclosure.ContractId) - sendArgs.TokenTransferInput.PoolExtraContext = tokenPoolSendDisclosure.ChoiceContext + sendArgs.TokenTransferInput.Context = tokenPoolSendDisclosure.ChoiceContext sendArgs.ExecutorInput.ExecutorCid = types.CONTRACT_ID(executorSendDisclosure.ContractId) - sendArgs.ExecutorInput.ExecutorExtraContext = executorSendDisclosure.ChoiceContext + sendArgs.ExecutorInput.Context = executorSendDisclosure.ChoiceContext sendDisclosures = testhelpers.DeduplicateDisclosedContracts(slices.Concat( transferFactoryDisclosures, ccipSendDisclosure.DisclosedContracts, @@ -923,7 +918,7 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender"}, + TemplateId: contracts.IdentifierFromBinding(sender.CCIPSender{}), ContractId: ccipSenderCid, Choice: "Send", ChoiceArgument: ledger.MapToValue(sendArgs), @@ -935,36 +930,37 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { }) require.NoError(t, err) - // Extract messageId from CCIPMessageSent to verify success - var returnedMessageId string - var returnedEncodedMessage string + // Extract CIPMessageSent event to verify success + eventTemplateId := events.CCIPMessageSent{}.GetTemplateID() + var ccipMessageSent *events.CCIPMessageSent for _, event := range res.GetTransaction().GetEvents() { - if e, ok := event.GetEvent().(*apiv2.Event_Created); ok { - if e.Created.GetTemplateId().GetEntityName() == "CCIPMessageSent" { - fields := e.Created.GetCreateArguments().GetFields() - if len(fields) >= 5 { - eventField := fields[4].GetValue().GetRecord() - if eventField != nil { - for _, field := range eventField.Fields { - if field.GetLabel() == "messageId" { - returnedMessageId = field.GetValue().GetText() - } - if field.GetLabel() == "encodedMessage" { - returnedEncodedMessage = field.GetValue().GetText() - } - } - } + if createdEvent := event.GetCreated(); createdEvent != nil { + if templateId := createdEvent.GetTemplateId(); templateId != nil { + gotTemplateId := fmt.Sprintf("#%s:%s:%s", createdEvent.GetPackageName(), templateId.GetModuleName(), templateId.GetEntityName()) + if gotTemplateId == eventTemplateId { + // Found CCIPMessageSent event + ccipMessageSent, err = bindings.UnmarshalCreatedEvent[events.CCIPMessageSent](createdEvent) + require.NoError(t, err) + break } - - break } } } - require.NotEmpty(t, returnedMessageId, "CCIPMessageSent should be created") - require.NotEmpty(t, returnedEncodedMessage, "CCIPMessageSent should contain encoded message") + require.NotNil(t, ccipMessageSent, "CCIPMessageSent event not found") + require.NotEmpty(t, ccipMessageSent.Event.MessageId, "CCIPMessageSent should be created") + require.NotEmpty(t, ccipMessageSent.Event.EncodedMessage, "CCIPMessageSent should contain encoded message") + + // Verify that the event contains the feeToken InstrumentId + require.Equal(t, nativeInstrumentId, ccipMessageSent.Event.FeeToken, "CCIPMessageSent should contain feeToken InstrumentId") // Verify pool feeBps haircut: 10,000 smallest units with 5% feeBps => 9,500 bridged. - require.Equal(t, int64(9500), extractTokenTransferAmountFromEncodedMessageHex(t, returnedEncodedMessage), "encoded token amount should be net after 5% feeBps") + require.Equal(t, int64(9500), extractTokenTransferAmountFromEncodedMessageHex(t, ccipMessageSent.Event.EncodedMessage), "encoded token amount should be net after 5% feeBps") + // Verify that the event itself contains the original amount without fees + wantAmount, ok := new(big.Rat).SetString(tokenTransferAmountDecimal) + require.True(t, ok, "token transfer amount should parse as a decimal value") + gotAmount, ok := new(big.Rat).SetString(string(ccipMessageSent.Event.TokenAmountBeforeTokenPoolFees)) + require.True(t, ok, "token amount before token pool fees should parse as a decimal value") + require.Equal(t, 0, wantAmount.Cmp(gotAmount), "token amount before token pool fees should match original transfer amount") // LnR LockOrBurn transfers gross to poolOwner; when poolOwner==sender, party Amulet total only drops by CCIP fee. require.Eventually(t, func() bool { @@ -978,7 +974,7 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { }, 15*time.Second, 200*time.Millisecond, "sender Amulet deduction should equal GetFee feeTokenAmount only") t.Logf("Send completed") - t.Logf(" Message ID: %s", returnedMessageId) + t.Logf(" Message ID: %s", ccipMessageSent.Event.MessageId) t.Logf(" Original payload: %s", string(testPayload)) t.Logf("✅ Success") @@ -988,10 +984,10 @@ func TestLnRTokenPool_FullSendFlow(t *testing.T) { // tokenTransfer.amount (uint256 big-endian) from the token-transfer payload. // It skips the fixed CCIP message prefix, short variable fields, and destination blob, // then reads the amount from bytes [1:33] of tokenTransfer (byte 0 is version/tag). -func extractTokenTransferAmountFromEncodedMessageHex(t *testing.T, encodedMessageHex string) int64 { +func extractTokenTransferAmountFromEncodedMessageHex(t *testing.T, encodedMessageHex types.TEXT) int64 { t.Helper() - b, err := hex.DecodeString(encodedMessageHex) + b, err := hex.DecodeString(string(encodedMessageHex)) require.NoError(t, err, "decode encodedMessage") i := 1 + 8 + 8 + 8 + 4 + 4 + 4 + 32 diff --git a/integration-tests/ccip/fee_quote_helpers_test.go b/integration-tests/ccip/fee_quote_helpers_test.go index b032b1c16..049e52c62 100644 --- a/integration-tests/ccip/fee_quote_helpers_test.go +++ b/integration-tests/ccip/fee_quote_helpers_test.go @@ -12,6 +12,7 @@ import ( "github.com/smartcontractkit/go-daml/pkg/types" "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/sender" + "github.com/smartcontractkit/chainlink-canton/contracts" ) // getFeeChoiceArgumentMap builds the GetFee choice argument from Send: same encoding as @@ -34,7 +35,7 @@ func quoteCCIPSenderFee( ccipSenderCid string, sendArgs sender.Send, disclosures []*apiv2.DisclosedContract, -) sender.GetFeeResult { +) sender.GetFeeResult2 { t.Helper() res, err := participant.LedgerServices.Command.SubmitAndWaitForTransaction(t.Context(), &apiv2.SubmitAndWaitForTransactionRequest{ @@ -42,7 +43,7 @@ func quoteCCIPSenderFee( CommandId: uuid.NewString(), Commands: []*apiv2.Command{{ Command: &apiv2.Command_Exercise{Exercise: &apiv2.ExerciseCommand{ - TemplateId: &apiv2.Identifier{PackageId: "#ccip-sender", ModuleName: "CCIP.CCIPSender", EntityName: "CCIPSender"}, + TemplateId: contracts.IdentifierFromBinding(sender.CCIPSender{}), ContractId: ccipSenderCid, Choice: "GetFee", ChoiceArgument: ledger.MapToValue(getFeeChoiceArgumentMap(sendArgs)), @@ -79,7 +80,7 @@ func quoteCCIPSenderFee( fields := resultRecord.GetFields() require.NotEmpty(t, fields, "GetFee should return fee fields") - quote := sender.GetFeeResult{ + quote := sender.GetFeeResult2{ FeeTokenAmount: types.NUMERIC(fields[0].GetValue().GetNumeric()), } if len(fields) > 1 { diff --git a/integration-tests/go.mod b/integration-tests/go.mod index 5dd137781..109c4bfa0 100644 --- a/integration-tests/go.mod +++ b/integration-tests/go.mod @@ -32,7 +32,7 @@ require ( github.com/smartcontractkit/chainlink-common v0.11.2-0.20260506120607-7f10be016c89 github.com/smartcontractkit/chainlink-deployments-framework v0.114.2 github.com/smartcontractkit/freeport v0.1.3-0.20250828155247-add56fa28aad - github.com/smartcontractkit/go-daml v0.0.0-20260630200614-6e739bf6e282 + github.com/smartcontractkit/go-daml v0.0.0-20260702101944-3a593d4e8e19 github.com/smartcontractkit/mcms v0.48.1-0.20260616002102-085d81f76b05 github.com/stretchr/testify v1.11.1 google.golang.org/protobuf v1.36.11 diff --git a/integration-tests/go.sum b/integration-tests/go.sum index 7817c066f..6048c6539 100644 --- a/integration-tests/go.sum +++ b/integration-tests/go.sum @@ -769,8 +769,8 @@ github.com/smartcontractkit/chainlink-tron/relayer/gotron-sdk v0.0.5-0.202510141 github.com/smartcontractkit/chainlink-tron/relayer/gotron-sdk v0.0.5-0.20251014120029-d73d15cc23f7/go.mod h1:ea1LESxlSSOgc2zZBqf1RTkXTMthHaspdqUHd7W4lF0= github.com/smartcontractkit/freeport v0.1.3-0.20250828155247-add56fa28aad h1:lgHxTHuzJIF3Vj6LSMOnjhqKgRqYW+0MV2SExtCYL1Q= github.com/smartcontractkit/freeport v0.1.3-0.20250828155247-add56fa28aad/go.mod h1:T4zH9R8R8lVWKfU7tUvYz2o2jMv1OpGCdpY2j2QZXzU= -github.com/smartcontractkit/go-daml v0.0.0-20260630200614-6e739bf6e282 h1:96Jd9XwZ2OaFrbR7lSYXIC/DzEbO5oQEmkXg86blj40= -github.com/smartcontractkit/go-daml v0.0.0-20260630200614-6e739bf6e282/go.mod h1:SqWfl3Bp9NleC9jhzFUaOGzOZeKfldpY4QOW6A6NSNM= +github.com/smartcontractkit/go-daml v0.0.0-20260702101944-3a593d4e8e19 h1:AMgphQyCCdvyA5P6xxPlRvHF7GCN/4KMMKkHon3U5K0= +github.com/smartcontractkit/go-daml v0.0.0-20260702101944-3a593d4e8e19/go.mod h1:SqWfl3Bp9NleC9jhzFUaOGzOZeKfldpY4QOW6A6NSNM= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7 h1:12ijqMM9tvYVEm+nR826WsrNi6zCKpwBhuApq127wHs= github.com/smartcontractkit/grpc-proxy v0.0.0-20240830132753-a7e17fec5ab7/go.mod h1:FX7/bVdoep147QQhsOPkYsPEXhGZjeYx6lBSaSXtZOA= github.com/smartcontractkit/libocr v0.0.0-20260304194147-a03701e2c02e h1:poXTj5cFVM6XfC4HICIDYkDVc/A6OYB0eeID0wU2JQE= diff --git a/integration-tests/mcms/ccip_factory_mcms_decparty_test.go b/integration-tests/mcms/ccip_factory_mcms_decparty_test.go index 8dd495bbf..addfdc37f 100644 --- a/integration-tests/mcms/ccip_factory_mcms_decparty_test.go +++ b/integration-tests/mcms/ccip_factory_mcms_decparty_test.go @@ -173,7 +173,6 @@ func TestCCIP_MCMSFactoryDeploy_DecentralizedParty(t *testing.T) { RmnRemote: chainlinkapi.RawInstanceAddress{Unpack: types.TEXT(rmnInstanceAddr)}, TokenAdminRegistry: chainlinkapi.RawInstanceAddress{Unpack: types.TEXT(tarInstanceAddr)}, FeeQuoter: chainlinkapi.RawInstanceAddress{Unpack: types.TEXT(fqInstanceAddr)}, - CcvRegistry: chainlinkapi.RawInstanceAddress{Unpack: types.TEXT(ccvInstanceAddr)}, MaxUSDCentsPerMsg: types.NUMERIC("100000"), } factoryCid, mcmsCid = mcmsFactoryDeployWithMCMSQueryParty(t, participant, mcmsEncoder, ccipOwner, decentralizedParty, mcmsCid, mcmsInstanceAddr, factoryCid, factoryInstanceAddr, chainID, sortedSigners, factoryEncoder, "DeployOnRampParams", onRampParams) @@ -359,7 +358,7 @@ func deployMCMSWithDecentralizedParty( DecentralizedPartyID: decentralizedParty, SynchronizerID: synchronizerID, Packages: []contractdeploy.PackageRef{{ - Name: string(contracts.MCMS), + Name: string(contracts.MCMSCore), Version: contracts.CurrentVersion, }}, TemplateModule: "MCMS.Main", @@ -440,17 +439,12 @@ func uploadCCIPMCMSFactoryDARs(t *testing.T, participants []canton.Participant) t.Helper() darPackages := []contracts.Package{ - contracts.MCMS, + contracts.MCMSCore, contracts.MCMSTest, - contracts.CCIPCommon, - contracts.CCIPRMN, - contracts.CCIPOffRamp, - contracts.CCIPOnRamp, - contracts.CCIPFeeQuoter, - contracts.CCIPTokenAdminRegistry, + contracts.CCIPRuntime, + contracts.CCIPCore, contracts.CCIPCommitteeVerifier, - contracts.CCIPPerPartyRouter, - contracts.CCIPPoolInterfaces, + contracts.CCIPExtensionAPI, contracts.CCIPLockReleaseTokenPool, contracts.CCIPExecutor, contracts.CCIPFactory, diff --git a/integration-tests/mcms/ccip_factory_mcms_test.go b/integration-tests/mcms/ccip_factory_mcms_test.go index 77f82128d..862763837 100644 --- a/integration-tests/mcms/ccip_factory_mcms_test.go +++ b/integration-tests/mcms/ccip_factory_mcms_test.go @@ -169,7 +169,6 @@ func TestCCIP_MCMSFactoryDeploy(t *testing.T) { RmnRemote: chainlinkapi.RawInstanceAddress{Unpack: types.TEXT(rmnInstanceAddr)}, TokenAdminRegistry: chainlinkapi.RawInstanceAddress{Unpack: types.TEXT(tarInstanceAddr)}, FeeQuoter: chainlinkapi.RawInstanceAddress{Unpack: types.TEXT(fqInstanceAddr)}, - CcvRegistry: chainlinkapi.RawInstanceAddress{Unpack: types.TEXT(ccvInstanceAddr)}, MaxUSDCentsPerMsg: types.NUMERIC("100000"), } factoryCid, mcmsCid = mcmsFactoryDeploy(t, participant, mcmsEncoder, ccipOwner, mcmsCid, mcmsInstanceAddr, factoryCid, factoryInstanceAddr, chainID, sortedSigners, factoryEncoder, "DeployOnRampParams", onRampParams) diff --git a/integration-tests/mcms/globalconfig_upgrade_test.go b/integration-tests/mcms/globalconfig_upgrade_test.go index 7c6845603..df7bb19e0 100644 --- a/integration-tests/mcms/globalconfig_upgrade_test.go +++ b/integration-tests/mcms/globalconfig_upgrade_test.go @@ -35,7 +35,7 @@ func TestGlobalConfig_UpgradeV1ToV2(t *testing.T) { // - V1 has NO MigrateToV2 choice at this point // =================================================================== - mcmsDar, err := contracts.GetDar(contracts.MCMS, contracts.CurrentVersion) + mcmsDar, err := contracts.GetDar(contracts.MCMSCore, contracts.CurrentVersion) require.NoError(t, err) gcV1Dar, err := contracts.GetDar(contracts.GlobalConfig, "1.0.0") require.NoError(t, err) diff --git a/integration-tests/mcms/mcms_integration_test.go b/integration-tests/mcms/mcms_integration_test.go index e18dd8e84..027da86d9 100644 --- a/integration-tests/mcms/mcms_integration_test.go +++ b/integration-tests/mcms/mcms_integration_test.go @@ -152,7 +152,7 @@ func TestMCMS_Execute(t *testing.T) { participant := env.Chain.Participants[0] randomUserParticipant := env.Chain.Participants[1] - mcmsDar, err := contracts.GetDar(contracts.MCMS, contracts.CurrentVersion) + mcmsDar, err := contracts.GetDar(contracts.MCMSCore, contracts.CurrentVersion) require.NoError(t, err) mcmsTestDar, err := contracts.GetDar(contracts.MCMSTest, contracts.CurrentVersion) diff --git a/integration-tests/mcms/shared_setup_test.go b/integration-tests/mcms/shared_setup_test.go index 7d597745c..2b439519d 100644 --- a/integration-tests/mcms/shared_setup_test.go +++ b/integration-tests/mcms/shared_setup_test.go @@ -79,7 +79,7 @@ func GetSharedEnvironment(t *testing.T) *SharedCantonEnvironment { participant := env.Chain.Participants[0] // Upload MCMS DAR - mcmsDar, err := contracts.GetDar(contracts.MCMS, contracts.CurrentVersion) + mcmsDar, err := contracts.GetDar(contracts.MCMSCore, contracts.CurrentVersion) if err != nil { errSharedEnv = err return @@ -131,7 +131,7 @@ func GetSharedTAREnvironment(t *testing.T) *SharedTAREnvironment { env := testhelpers.NewTestEnvironment(t, testhelpers.WithNumberOfParticipants(1)) participant := env.Chain.Participants[0] - mcmsDar, err := contracts.GetDar(contracts.MCMS, contracts.CurrentVersion) + mcmsDar, err := contracts.GetDar(contracts.MCMSCore, contracts.CurrentVersion) if err != nil { errSharedTAREnv = err @@ -145,14 +145,14 @@ func GetSharedTAREnvironment(t *testing.T) *SharedTAREnvironment { return } - commonDar, err := contracts.GetDar(contracts.CCIPCommon, contracts.CurrentVersion) + commonDar, err := contracts.GetDar(contracts.CCIPRuntime, contracts.CurrentVersion) if err != nil { errSharedTAREnv = err return } - tarDar, err := contracts.GetDar(contracts.CCIPTokenAdminRegistry, contracts.CurrentVersion) + tarDar, err := contracts.GetDar(contracts.CCIPCore, contracts.CurrentVersion) if err != nil { errSharedTAREnv = err @@ -205,17 +205,12 @@ func GetSharedCCIPMCMSEnvironment(t *testing.T) *SharedCCIPMCMSEnvironment { participant := env.Chain.Participants[0] darPackages := []contracts.Package{ - contracts.MCMS, + contracts.MCMSCore, contracts.MCMSTest, - contracts.CCIPCommon, - contracts.CCIPRMN, - contracts.CCIPOffRamp, - contracts.CCIPOnRamp, - contracts.CCIPFeeQuoter, - contracts.CCIPTokenAdminRegistry, + contracts.CCIPRuntime, + contracts.CCIPCore, contracts.CCIPCommitteeVerifier, - contracts.CCIPPerPartyRouter, - contracts.CCIPPoolInterfaces, + contracts.CCIPExtensionAPI, contracts.CCIPLockReleaseTokenPool, contracts.CCIPExecutor, contracts.CCIPFactory, @@ -278,17 +273,12 @@ func GetSharedCCIPMCMSTwoParticipantEnvironment(t *testing.T) *SharedCCIPMCMSTwo testhelpers.GrantCanActAs(t, participant, bootstrapParty) darPackages := []contracts.Package{ - contracts.MCMS, + contracts.MCMSCore, contracts.MCMSTest, - contracts.CCIPCommon, - contracts.CCIPRMN, - contracts.CCIPOffRamp, - contracts.CCIPOnRamp, - contracts.CCIPFeeQuoter, - contracts.CCIPTokenAdminRegistry, + contracts.CCIPRuntime, + contracts.CCIPCore, contracts.CCIPCommitteeVerifier, - contracts.CCIPPerPartyRouter, - contracts.CCIPPoolInterfaces, + contracts.CCIPExtensionAPI, contracts.CCIPLockReleaseTokenPool, contracts.CCIPExecutor, contracts.CCIPFactory, diff --git a/integration-tests/mcms/token_admin_registry_mcms_test.go b/integration-tests/mcms/token_admin_registry_mcms_test.go index d790ee304..f06234951 100644 --- a/integration-tests/mcms/token_admin_registry_mcms_test.go +++ b/integration-tests/mcms/token_admin_registry_mcms_test.go @@ -60,7 +60,7 @@ func TestSetPoolViaMCMS(t *testing.T) { tarContract := core.NewContract(fmt.Sprintf("#%s", core.PackageName), "CCIP.TokenAdminRegistry", "TokenAdminRegistry") // Build set_pool operation - poolReg := &core.PoolRegistration{ + poolReg := &core.PoolRegistration2{ PoolOwner: types.PARTY(ccipOwner), PoolInstanceId: types.TEXT("test-pool-001"), } @@ -155,7 +155,7 @@ func TestTokenAdminRegistry_ClearPoolViaMCMS(t *testing.T) { tokenConfigInstanceAddr := makeTokenConfigInstanceAddr(ccipOwner, testInstrumentId) // Set initial pool directly (not via MCMS) so we have something to clear - initialPool := &core.PoolRegistration{ + initialPool := &core.PoolRegistration2{ PoolOwner: types.PARTY(ccipOwner), PoolInstanceId: types.TEXT("initial-pool"), } @@ -316,7 +316,7 @@ func createTokenAdminRegistryEmpty( tarContract := core.TokenAdminRegistry{ InstanceId: types.TEXT(instanceID), - Owner: types.PARTY(owner), + CcipOwner: types.PARTY(owner), EntryCount: 0, } @@ -348,7 +348,7 @@ func exerciseSetPoolDirectly( tarCid string, tokenConfigCid string, instrumentId splice.InstrumentId, - pool *core.PoolRegistration, + pool *core.PoolRegistration2, ) string { t.Helper()