diff --git a/bindings/generated/latest/ccip/burnminttokenpool/burnminttokenpool.go b/bindings/generated/latest/ccip/burnminttokenpool/burnminttokenpool.go index 26e1b7c5b..c5406ef01 100644 --- a/bindings/generated/latest/ccip/burnminttokenpool/burnminttokenpool.go +++ b/bindings/generated/latest/ccip/burnminttokenpool/burnminttokenpool.go @@ -29,7 +29,7 @@ var ( const ( PackageName = "ccip-burn-mint-token-pool" - PackageID = "9c8ec66a89b585f231375214a70bb9dc0d451bad3f00979b707765cab96a851c" + PackageID = "ccc1abc3a510b6752a9f5aea7b0f0ab2f75cc8636dd4caf65bb50fcc6f070445" SDKVersion = "3.4.11" ) diff --git a/bindings/generated/latest/ccip/ccipapi/ccipapi.go b/bindings/generated/latest/ccip/ccipapi/ccipapi.go index 08744fb8a..493bfa8cc 100644 --- a/bindings/generated/latest/ccip/ccipapi/ccipapi.go +++ b/bindings/generated/latest/ccip/ccipapi/ccipapi.go @@ -27,7 +27,7 @@ var ( const ( PackageName = "ccip-api" - PackageID = "e3ae65012ea33fa0c573e44fe53ee85ad51898963796f0c8babaeb0ae2ac38dd" + PackageID = "06ff038d96f9ce0cbfda991bb6bd82b400bdc6bc0b45424919135d46a22ba276" SDKVersion = "3.4.11" ) @@ -59,6 +59,19 @@ type IFeeQuoter interface { FeeQuoterGetTokenTransferFee(contractID string, args FeeQuoterGetTokenTransferFee) *model.ExerciseCommand } +// IGlobalConfig is a DAML interface +type IGlobalConfig 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 +} + // IRMNRemote is a DAML interface type IRMNRemote interface { @@ -148,6 +161,14 @@ type ITokenReceiveTicket interface { Archive(contractID string) *model.ExerciseCommand } +const ( + GlobalConfigContextKey = types.TEXT("global-config") + RmnRemoteContextKey = types.TEXT("rmn-remote") + FeeQuoterContextKey = types.TEXT("fee-quoter") + TokenConfigContextKey = types.TEXT("token-config") + TokenAdminRegistryContextKey = types.TEXT("token-admin-registry") +) + func argsToMap(args any) map[string]any { if args == nil { return map[string]any{} @@ -199,6 +220,94 @@ func (t *Consume) UnmarshalHex(data string) error { 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"` @@ -421,6 +530,123 @@ func (t *FeeQuoterPublicFetch) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } +// GlobalConfigView is a Record type +type GlobalConfigView struct { + CcipOwner types.PARTY `json:"ccipOwner"` +} + +// 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() + + 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) +} + +// GlobalConfigPublicFetch is a Record type +type GlobalConfigPublicFetch struct { + ExpectedAddress chainlinkapi.RawInstanceAddress `json:"expectedAddress"` + 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["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 @@ -1525,6 +1751,16 @@ func IFeeQuoterInterfaceIDWithPackageID(packageID string) string { return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.API.FeeQuoterV1", "FeeQuoter") } +// IGlobalConfigInterfaceID returns the interface ID for the IGlobalConfig interface using the package name +func IGlobalConfigInterfaceID() string { + return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.API.GlobalConfigV1", "GlobalConfig") +} + +// IGlobalConfigInterfaceIDWithPackageID returns the interface ID using the provided package ID instead of package name +func IGlobalConfigInterfaceIDWithPackageID(packageID string) string { + return fmt.Sprintf("%s:%s:%s", packageID, "CCIP.API.GlobalConfigV1", "GlobalConfig") +} + // IRMNRemoteInterfaceID returns the interface ID for the IRMNRemote interface using the package name func IRMNRemoteInterfaceID() string { return fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.API.RMNRemoteV1", "RMNRemote") diff --git a/bindings/generated/latest/ccip/ccipruntime/ccipruntime.go b/bindings/generated/latest/ccip/ccipruntime/ccipruntime.go index af512ae23..be6194942 100644 --- a/bindings/generated/latest/ccip/ccipruntime/ccipruntime.go +++ b/bindings/generated/latest/ccip/ccipruntime/ccipruntime.go @@ -8,7 +8,7 @@ import ( ccipapi "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipapi" ccipcodec "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/ccipcodec" - core "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/core" + client "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/client" 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" @@ -32,7 +32,7 @@ var ( const ( PackageName = "ccip-runtime" - PackageID = "6ae0552ae6495859f968e642d509b47d15cc779aa741def01680cd7787dc34cc" + PackageID = "ab0cd4de98515d775fa42d31f9051f3773ef44728670f174c657cf9bab7dcdf1" SDKVersion = "3.4.11" ) @@ -42,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) @@ -474,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"` @@ -483,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) @@ -512,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) } @@ -773,8 +773,8 @@ func (t *ExecuteFromRouterResult) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// ExecuteResult is a Record type -type ExecuteResult struct { +// 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"` @@ -783,8 +783,8 @@ type ExecuteResult struct { 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) @@ -812,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) } @@ -1088,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 @@ -1098,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 @@ -1128,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. @@ -1147,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 client.Canton2AnyMessage `json:"message"` CcvFeeQuotes []extensionapi.CrossChainVerifierFeeQuote `json:"ccvFeeQuotes"` TokenPoolFeeQuote *extensionapi.TokenPoolFeeQuote `json:"tokenPoolFeeQuote" hex:"optional"` ExecutorFeeQuote *extensionapi.ExecutorFeeQuote `json:"executorFeeQuote" hex:"optional"` @@ -1227,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 client.Canton2AnyMessage `json:"message"` CcvFeeQuotes []extensionapi.CrossChainVerifierFeeQuote `json:"ccvFeeQuotes"` TokenPoolFeeQuote *extensionapi.TokenPoolFeeQuote `json:"tokenPoolFeeQuote" hex:"optional"` ExecutorFeeQuote *extensionapi.ExecutorFeeQuote `json:"executorFeeQuote" hex:"optional"` @@ -1484,7 +1488,7 @@ func (t *GetRequiredCCVsForExecuteFromRouter) UnmarshalHex(data string) error { type GetRequiredCCVsForSend struct { Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` DestChainSelector types.NUMERIC `json:"destChainSelector"` - Message core.Canton2AnyMessage `json:"message"` + Message client.Canton2AnyMessage `json:"message"` PoolReportedCCVs []chainlinkapi.RawInstanceAddress `json:"poolReportedCCVs"` } @@ -1535,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 client.Canton2AnyMessage `json:"message"` PoolReportedCCVs []chainlinkapi.RawInstanceAddress `json:"poolReportedCCVs"` } @@ -1584,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 @@ -1593,6 +1598,8 @@ func (t GetSequenceNumber) ToMap() map[string]any { m["destChainSelector"] = t.DestChainSelector + m["context"] = model.NestedToDAMLValue(t.Context) + return m } @@ -2607,11 +2614,11 @@ func (t PerPartyRouter) GetRequiredCCVsForExecuteWithPackageID(contractID string } } -// 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.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2621,7 +2628,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.PerPartyRouter", "PerPartyRouter"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -2733,10 +2740,222 @@ func (t PerPartyRouter) MCMSReceiverEntrypointWithPackageID(contractID string, p } } +// 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 client.PerPartyRouterGetSequenceNumber) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterGetSequenceNumber) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterGetRequiredCCVsForSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterGetRequiredCCVsForSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterGetFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterGetFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterPrepareSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterPrepareSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterFinalizeFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterFinalizeFee) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterCCIPSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterCCIPSend) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterGetExecutionState) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterGetExecutionState) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterGetRequiredCCVsForExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterGetRequiredCCVsForExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterPrepareExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterPrepareExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.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 client.PerPartyRouterExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", PackageName, "CCIP.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 client.PerPartyRouterExecute) *model.ExerciseCommand { + return &model.ExerciseCommand{ + TemplateID: fmt.Sprintf("#%s:%s:%s", packageID, "CCIP.PerPartyRouter", "PerPartyRouter"), + ContractID: contractID, + Choice: "PerPartyRouter_Execute", + Arguments: argsToMap(args), + } +} + // Verify interface implementations for PerPartyRouter var _ api.IMCMSReceiver = (*PerPartyRouter)(nil) +var _ client.IPerPartyRouter = (*PerPartyRouter)(nil) + // PerPartyRouterDeps is a Record type type PerPartyRouterDeps struct { OnRamp chainlinkapi.RawInstanceAddress `json:"onRamp"` @@ -3103,7 +3322,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 client.Canton2AnyMessage `json:"message"` Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` } @@ -3144,15 +3363,15 @@ 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 client.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"` } // ToMap converts PrepareSendFromRouter to a map for DAML arguments diff --git a/bindings/generated/latest/ccip/client/client.go b/bindings/generated/latest/ccip/client/client.go new file mode 100644 index 000000000..3ee5a05a2 --- /dev/null +++ b/bindings/generated/latest/ccip/client/client.go @@ -0,0 +1,1258 @@ +package client + +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" + PackageID = "060799c1a8235eb8fd0ece4d81029f5f17418e20fe9cfb4fc3a144fcc68f1343" + SDKVersion = "3.4.11" +) + +type Template interface { + CreateCommand() *model.CreateCommand + GetTemplateID() string +} + +// 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} +} + +// 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"` +} + +// 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 + }() + + 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"` +} + +// 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) + + 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) +} + +// 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"` +} + +// 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 + + 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 { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + ExecutingMessageCid types.CONTRACT_ID `json:"executingMessageCid"` +} + +// ToMap converts PerPartyRouterExecute to a map for DAML arguments +func (t PerPartyRouterExecute) ToMap() map[string]any { + m := make(map[string]any) + + m["context"] = model.NestedToDAMLValue(t.Context) + + m["executingMessageCid"] = model.NestedToDAMLValue(t.ExecutingMessageCid) + + 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 { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + 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"` +} + +// ToMap converts PerPartyRouterGetFee to a map for DAML arguments +func (t PerPartyRouterGetFee) 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) + + 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, + } + } + + 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 { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + 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"` +} + +// ToMap converts PerPartyRouterGetRequiredCCVsForExecute to a map for DAML arguments +func (t PerPartyRouterGetRequiredCCVsForExecute) 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 { + 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 + }() + + 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 { + Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` + DestChainSelector types.NUMERIC `json:"destChainSelector"` + Message Canton2AnyMessage `json:"message"` + PoolReportedCCVs []chainlinkapi.RawInstanceAddress `json:"poolReportedCCVs"` +} + +// ToMap converts PerPartyRouterGetRequiredCCVsForSend to a map for DAML arguments +func (t PerPartyRouterGetRequiredCCVsForSend) 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) + + m["poolReportedCCVs"] = func() []any { + res := make([]any, 0, len(t.PoolReportedCCVs)) + for _, e := range t.PoolReportedCCVs { + res = append(res, model.NestedToDAMLValue(e)) + } + return res + }() + + 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 { + 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 ccipcodec.FinalityConfig `json:"receiverFinalityConfig"` + 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["context"] = model.NestedToDAMLValue(t.Context) + + 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["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) +} + +// 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 b9cddac15..fa70f9efa 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 = "10f88a8f09b3fcef50b60c63336fda0a91c85f3d0ed46d28a53fd3bd1f161726" + PackageID = "04454c0ae92aa3cf496cba62c2ce3859717af5b6ac85e8e542c9dce02e2b26e0" SDKVersion = "3.4.11" ) diff --git a/bindings/generated/latest/ccip/core/core.go b/bindings/generated/latest/ccip/core/core.go index 6a577454b..0f8690953 100644 --- a/bindings/generated/latest/ccip/core/core.go +++ b/bindings/generated/latest/ccip/core/core.go @@ -30,7 +30,7 @@ var ( const ( PackageName = "ccip-core" - PackageID = "d8984d71ab7c3f6d86a1706c38916406f9191f4be29d837f84d182ca3ab091fc" + PackageID = "04b2d4108ff457730f8ca8fdafe5f7ad9de26670143e56fc1e2f32896426391c" SDKVersion = "3.4.11" ) @@ -40,12 +40,7 @@ type Template interface { } const ( - TokenConfigKey = types.TEXT("token-config") - TokenAdminRegistryKey = types.TEXT("token-admin-registry") - RmnRemoteContextKey = types.TEXT("rmn-remote") - GlobalCurseSubject = types.TEXT("01000000000000000000000000000001") - FeeQuoterKey = types.TEXT("fee-quoter") - GlobalConfigKey = types.TEXT("global-config") + GlobalCurseSubject = types.TEXT("01000000000000000000000000000001") ) func argsToMap(args any) map[string]any { @@ -1052,45 +1047,6 @@ func (t *BuildMessage) UnmarshalHex(data string) error { 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) -} - // CCVFee is a Record type type CCVFee struct { CcvInstanceId types.TEXT `json:"ccvInstanceId"` @@ -1234,64 +1190,6 @@ 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) -} - // ConsumeReceiveTicket is a Record type type ConsumeReceiveTicket struct { TokenConfigCid types.CONTRACT_ID `json:"tokenConfigCid"` @@ -1619,8 +1517,8 @@ func (t *CurseParams) UnmarshalHex(data string) error { return hexCodec.Unmarshal(data, t) } -// DestChainConfig is a Record type -type DestChainConfig struct { +// DestChainConfig2 is a Record type +type DestChainConfig2 struct { IsEnabled types.BOOL `json:"isEnabled"` AddressBytesLength types.INT64 `json:"addressBytesLength"` TokenReceiverAllowed types.BOOL `json:"tokenReceiverAllowed"` @@ -1633,8 +1531,8 @@ type DestChainConfig struct { TokenNetworkFeeUSDCents types.NUMERIC `json:"tokenNetworkFeeUSDCents"` } -// ToMap converts DestChainConfig to a map for DAML arguments -func (t DestChainConfig) 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["isEnabled"] = bool(t.IsEnabled) @@ -1682,24 +1580,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) } @@ -2342,75 +2240,6 @@ func (e *ExecutionMode) UnmarshalHex(data string) error { var _ types.ENUM = ExecutionMode("") -// 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"` @@ -2453,132 +2282,6 @@ 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"` @@ -3609,60 +3312,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"` @@ -4184,7 +3833,7 @@ 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"` + DestChainConfigs map[types.NUMERIC]DestChainConfig2 `json:"destChainConfigs"` SourceChainConfigs map[types.NUMERIC]SourceChainConfig `json:"sourceChainConfigs"` } @@ -4336,11 +3985,11 @@ func (t GlobalConfig) ApplySourceChainConfigUpdatesWithPackageID(contractID stri } } -// Archive exercises the Archive choice on this GlobalConfig contract via the IMCMSReceiver interface +// Archive exercises the Archive choice on this GlobalConfig contract via the IGlobalConfig 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.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -4350,7 +3999,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.GlobalConfig", "GlobalConfig"), ContractID: contractID, Choice: "Archive", Arguments: map[string]any{}, @@ -4420,10 +4069,54 @@ func (t GlobalConfig) MCMSReceiverEntrypointWithPackageID(contractID string, pac } } +// GlobalConfigPublicFetch exercises the GlobalConfig_PublicFetch choice on this GlobalConfig contract via the IGlobalConfig 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.GlobalConfig", "GlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_PublicFetch", + Arguments: argsToMap(args), + } +} + +// 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.GlobalConfig", "GlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_PublicFetch", + Arguments: argsToMap(args), + } +} + +// GlobalConfigGetDestChainConfig exercises the GlobalConfig_GetDestChainConfig choice on this GlobalConfig contract via the IGlobalConfig 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.GlobalConfig", "GlobalConfig"), + 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.GlobalConfig", "GlobalConfig"), + ContractID: contractID, + Choice: "GlobalConfig_GetDestChainConfig", + Arguments: argsToMap(args), + } +} + // Verify interface implementations for GlobalConfig var _ api.IMCMSReceiver = (*GlobalConfig)(nil) +var _ ccipapi.IGlobalConfig = (*GlobalConfig)(nil) + // InboundPoolVerification is a Record type type InboundPoolVerification struct { PoolInstanceId types.TEXT `json:"poolInstanceId"` @@ -8548,45 +8241,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"` diff --git a/bindings/generated/latest/ccip/events/events.go b/bindings/generated/latest/ccip/events/events.go index 19b43c169..6a133673b 100644 --- a/bindings/generated/latest/ccip/events/events.go +++ b/bindings/generated/latest/ccip/events/events.go @@ -27,7 +27,7 @@ var ( const ( PackageName = "ccip-events" - PackageID = "913db734345ee2af4bb51dfdef611f7bbb6ebbbbd805695d6c3b139943b98f37" + PackageID = "482f553192f01815d6b6d998d1fc8aa196c5672d8f005ec1bfba1e027600220f" SDKVersion = "3.4.11" ) diff --git a/bindings/generated/latest/ccip/executor/executor.go b/bindings/generated/latest/ccip/executor/executor.go index aeccd3c15..5c28db71b 100644 --- a/bindings/generated/latest/ccip/executor/executor.go +++ b/bindings/generated/latest/ccip/executor/executor.go @@ -28,7 +28,7 @@ var ( const ( PackageName = "ccip-executor" - PackageID = "a04a80a3c7661fc3ad39c91596977d1f4a97c0be1dc98122486582cd169d1b2c" + PackageID = "58a2b970de8eba1d34688d87dc74d0b4540cc8264fa4658e00a97ba538f206c2" SDKVersion = "3.4.11" ) diff --git a/bindings/generated/latest/ccip/extensionapi/extensionapi.go b/bindings/generated/latest/ccip/extensionapi/extensionapi.go index 7c33ad9ae..e0288532a 100644 --- a/bindings/generated/latest/ccip/extensionapi/extensionapi.go +++ b/bindings/generated/latest/ccip/extensionapi/extensionapi.go @@ -26,7 +26,7 @@ var ( const ( PackageName = "ccip-extension-api" - PackageID = "f0b51e3a5db3c23eb262e0468129a803e1ccf67c061d8f659c74c401571a8b97" + PackageID = "2c0feef9c9619ba9a84941f479c9e79c2878fd407d8ba22f9e2b8787a8c2c47e" SDKVersion = "3.4.11" ) diff --git a/bindings/generated/latest/ccip/factory/factory.go b/bindings/generated/latest/ccip/factory/factory.go index fa32fd060..4cd8cb25b 100644 --- a/bindings/generated/latest/ccip/factory/factory.go +++ b/bindings/generated/latest/ccip/factory/factory.go @@ -36,7 +36,7 @@ var ( const ( PackageName = "ccip-factory" - PackageID = "8ff80a23931bedbe7df6c2eedbfaced86ba863662013497492421deb1ff60915" + PackageID = "222f9c07c97f2472489082e255e5276cc39e89e5223c99e05c7b31ab82c52212" SDKVersion = "3.4.11" ) diff --git a/bindings/generated/latest/ccip/lockreleasetokenpool/lockreleasetokenpool.go b/bindings/generated/latest/ccip/lockreleasetokenpool/lockreleasetokenpool.go index 5f11d6d12..4b87ef729 100644 --- a/bindings/generated/latest/ccip/lockreleasetokenpool/lockreleasetokenpool.go +++ b/bindings/generated/latest/ccip/lockreleasetokenpool/lockreleasetokenpool.go @@ -29,7 +29,7 @@ var ( const ( PackageName = "ccip-lock-release-token-pool" - PackageID = "81572662696b33951e021d0a30f9183a05285f611e783fcbc9c45e9955b3d989" + PackageID = "0c34e52ea1f526ad558e4d2208bed5d57df5e009d88c6a0a2012e27dbba774ea" SDKVersion = "3.4.11" ) diff --git a/bindings/generated/latest/ccip/ratelimiter/ratelimiter.go b/bindings/generated/latest/ccip/ratelimiter/ratelimiter.go index fae84820d..1a8511968 100644 --- a/bindings/generated/latest/ccip/ratelimiter/ratelimiter.go +++ b/bindings/generated/latest/ccip/ratelimiter/ratelimiter.go @@ -24,7 +24,7 @@ var ( const ( PackageName = "ccip-rate-limiter" - PackageID = "3a75ba8d563e4ca2e7f560c60d9a4ebed8a85cf2ecbb95de1121076f8e2b4dad" + PackageID = "cf163092a8c62f4692e9026cb1d4769e158ba507787783938d85b74e16cfe28a" SDKVersion = "3.4.11" ) @@ -34,7 +34,7 @@ type Template interface { } const ( - RateLimiterKey = types.TEXT("rate-limiter") + RateLimiterContextKey = types.TEXT("rate-limiter") ) func argsToMap(args any) map[string]any { diff --git a/bindings/generated/latest/ccip/receiver/receiver.go b/bindings/generated/latest/ccip/receiver/receiver.go index bbb049793..fd34364cc 100644 --- a/bindings/generated/latest/ccip/receiver/receiver.go +++ b/bindings/generated/latest/ccip/receiver/receiver.go @@ -27,7 +27,7 @@ var ( const ( PackageName = "ccip-receiver" - PackageID = "701991b9431dd1b1fa0bab3753f305cd3b925ce28951d1a32fc2f4a13017d0d7" + PackageID = "70a6a6636f8739d0a94c557b423adb0f7e4a2ffc6746efb83615f55c976ab575" SDKVersion = "3.4.11" ) diff --git a/bindings/generated/latest/ccip/sender/sender.go b/bindings/generated/latest/ccip/sender/sender.go index 6bad332e8..c34ac67bf 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" + client "github.com/smartcontractkit/chainlink-canton/bindings/generated/latest/ccip/client" 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 = "9fb2f3119616d1dbab6ab6977cc0a31b1d34dde2e5d280539ca5322693735424" + PackageID = "371868370afcb24a74556cc5371d8e9f0eeba76d9eef9632522eb4960a0b408e" 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, @@ -342,10 +342,10 @@ 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"` + Message client.Canton2AnyMessage `json:"message"` Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` RouterCid types.CONTRACT_ID `json:"routerCid"` CcvSendInputs []CCVSendInput `json:"ccvSendInputs"` @@ -353,8 +353,8 @@ type GetFee2 struct { ExecutorInput *ExecutorInput `json:"executorInput" hex:"optional"` } -// 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 @@ -400,36 +400,36 @@ func (t GetFee2) ToMap() map[string]any { 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,7 +464,7 @@ 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"` + Message client.Canton2AnyMessage `json:"message"` Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` RouterCid types.CONTRACT_ID `json:"routerCid"` TokenPoolCid *types.CONTRACT_ID `json:"tokenPoolCid" hex:"optional"` @@ -522,7 +522,7 @@ 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"` + Message client.Canton2AnyMessage `json:"message"` Context splice_api_token_metadata_v1.ChoiceContext `json:"context"` RouterCid types.CONTRACT_ID `json:"routerCid"` FeeTokenInput FeeTokenInput `json:"feeTokenInput"` @@ -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 index 4ac48d499..1ab06f69b 100644 --- a/bindings/generated/latest/ccip/tickets/tickets.go +++ b/bindings/generated/latest/ccip/tickets/tickets.go @@ -28,7 +28,7 @@ var ( const ( PackageName = "ccip-tickets" - PackageID = "0fdec3d34bfa43ef48e9439840ba3b13b6ffecca7a209b29135452944b841e3c" + PackageID = "2c97c9a0b352e788b3ec762d70a023fd17782968dc3b39da495a9e5115009585" SDKVersion = "3.4.11" ) diff --git a/ccip/devenv/impl.go b/ccip/devenv/impl.go index d8d491875..a8a8b67cb 100644 --- a/ccip/devenv/impl.go +++ b/ccip/devenv/impl.go @@ -45,6 +45,7 @@ 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/client" "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" @@ -1267,15 +1268,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: client.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: client.ExtraArgs{ + V3: &client.GenericExtraArgsV3{ GasLimit: types.INT64(opts.ExecutionGasLimit), - Executor: core.ExecutorExtraArg{ - ExecutorUseDefault: &core.ExecutorUseDefault{}, + Executor: client.ExecutorExtraArg{ + ExecutorUseDefault: &client.ExecutorUseDefault{}, }, }, }, @@ -1311,7 +1312,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 = &client.TokenTransfer{ Token: splice_api_token_holding_v1.InstrumentId{ Admin: types.PARTY(outgoingMessage.TokenTransfer.Token.Admin), Id: types.TEXT(outgoingMessage.TokenTransfer.Token.Id), @@ -1356,7 +1357,7 @@ func (c *Chain) SendMessage(ctx context.Context, dest uint64, fields cciptestint CcvCid: types.CONTRACT_ID(ccvSendDisclosure.ContractId), CcvExtraContext: 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, client.CCVExtraArg{ CcvAddress: ccvSendDisclosure.Address.Binding(), CcvArgs: "", }) diff --git a/contracts/ccip/api/daml/CCIP/API/FeeQuoterV1.daml b/contracts/ccip/api/daml/CCIP/API/FeeQuoterV1.daml index a623d1318..ba03412d0 100644 --- a/contracts/ccip/api/daml/CCIP/API/FeeQuoterV1.daml +++ b/contracts/ccip/api/daml/CCIP/API/FeeQuoterV1.daml @@ -5,6 +5,9 @@ import qualified Splice.Api.Token.HoldingV1 import qualified Chainlink.InstanceAddress +feeQuoterContextKey : Text +feeQuoterContextKey = "fee-quoter" + interface FeeQuoter where viewtype FeeQuoterView diff --git a/contracts/ccip/api/daml/CCIP/API/GlobalConfigV1.daml b/contracts/ccip/api/daml/CCIP/API/GlobalConfigV1.daml new file mode 100644 index 000000000..c1e46a599 --- /dev/null +++ b/contracts/ccip/api/daml/CCIP/API/GlobalConfigV1.daml @@ -0,0 +1,51 @@ +module CCIP.API.GlobalConfigV1 where + +import DA.Crypto.Text (BytesHex) + +import qualified Splice.Api.Token.MetadataV1 + +import qualified Chainlink.InstanceAddress + +globalConfigContextKey : Text +globalConfigContextKey = "global-config" + +interface GlobalConfig where + viewtype GlobalConfigView + + globalConfig_publicFetchImpl : ContractId GlobalConfig -> GlobalConfig_PublicFetch -> Update GlobalConfigView + globalConfig_getDestChainConfigImpl : ContractId GlobalConfig -> GlobalConfig_GetDestChainConfig -> Update (Optional DestChainConfig) + + nonconsuming choice GlobalConfig_PublicFetch : GlobalConfigView + with + expectedAddress : Chainlink.InstanceAddress.RawInstanceAddress + 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 + +data GlobalConfigView = GlobalConfigView + with + ccipOwner : Party + 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) \ No newline at end of file diff --git a/contracts/ccip/api/daml/CCIP/API/RMNRemoteV1.daml b/contracts/ccip/api/daml/CCIP/API/RMNRemoteV1.daml index 400243c5e..b2d77cc98 100644 --- a/contracts/ccip/api/daml/CCIP/API/RMNRemoteV1.daml +++ b/contracts/ccip/api/daml/CCIP/API/RMNRemoteV1.daml @@ -6,6 +6,9 @@ import qualified Splice.Api.Token.MetadataV1 import qualified Chainlink.InstanceAddress +rmnRemoteContextKey : Text +rmnRemoteContextKey = "rmn-remote" + interface RMNRemote where viewtype RMNRemoteView diff --git a/contracts/ccip/api/daml/CCIP/API/TokenAdminRegistryV1.daml b/contracts/ccip/api/daml/CCIP/API/TokenAdminRegistryV1.daml index 854d7861d..8e8e8116b 100644 --- a/contracts/ccip/api/daml/CCIP/API/TokenAdminRegistryV1.daml +++ b/contracts/ccip/api/daml/CCIP/API/TokenAdminRegistryV1.daml @@ -11,6 +11,12 @@ import qualified Chainlink.InstanceAddress import qualified CCIP.API.ExecutingMessageV1 import qualified CCIP.API.SendingMessageV1 +tokenAdminRegistryContextKey : Text +tokenAdminRegistryContextKey = "token-admin-registry" + +tokenConfigContextKey : Text +tokenConfigContextKey = "token-config" + interface TokenAdminRegistry where viewtype TokenAdminRegistryView diff --git a/contracts/ccip/client/daml.yaml b/contracts/ccip/client/daml.yaml new file mode 100644 index 000000000..92ebb5d0a --- /dev/null +++ b/contracts/ccip/client/daml.yaml @@ -0,0 +1,21 @@ +sdk-version: 3.4.11 +name: ccip-client +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 + - ../events/.daml/dist/ccip-events-2.0.0.dar + - ../tickets/.daml/dist/ccip-tickets-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/daml/CCIP/ClientV1.daml b/contracts/ccip/client/daml/CCIP/ClientV1.daml new file mode 100644 index 000000000..96d73775d --- /dev/null +++ b/contracts/ccip/client/daml/CCIP/ClientV1.daml @@ -0,0 +1,236 @@ +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.API.ExecutingMessageV1 +import qualified CCIP.API.SendingMessageV1 +import qualified CCIP.API.TokenAdminRegistryV1 +import qualified CCIP.EventsV1.Events +import qualified CCIP.FinalityConfig +import qualified CCIP.Interfaces.CrossChainVerifier +import qualified CCIP.Interfaces.Executor +import qualified CCIP.Interfaces.TokenPool +import qualified CCIP.MessageCodecV1 +import qualified CCIP.Tickets + +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.API.SendingMessageV1.SendingMessage) + perPartyRouter_finalizeFeeImpl : ContractId PerPartyRouter -> PerPartyRouter_FinalizeFee -> Update (ContractId CCIP.API.SendingMessageV1.SendingMessage) + perPartyRouter_ccipSendImpl : ContractId PerPartyRouter -> PerPartyRouter_CCIPSend -> Update CCIPSendResult + + perPartyRouter_getExecutionStateImpl : ContractId PerPartyRouter -> PerPartyRouter_GetExecutionState -> Update CCIP.API.ExecutingMessageV1.MessageExecutionState + perPartyRouter_getRequiredCCVsForExecuteImpl : ContractId PerPartyRouter -> PerPartyRouter_GetRequiredCCVsForExecute -> Update [Chainlink.InstanceAddress.RawInstanceAddress] + perPartyRouter_prepareExecuteImpl : ContractId PerPartyRouter -> PerPartyRouter_PrepareExecute -> Update (ContractId CCIP.API.ExecutingMessageV1.ExecutingMessage) + 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 + context : Splice.Api.Token.MetadataV1.ChoiceContext + destChainSelector : Numeric 0 + message : Canton2AnyMessage + poolReportedCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + controller (view this).owner + do perPartyRouter_getRequiredCCVsForSendImpl this self arg + + nonconsuming choice PerPartyRouter_GetFee : GetFeeResult + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + destChainSelector : Numeric 0 + message : Canton2AnyMessage + ccvFeeQuotes : [CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierFeeQuote] + tokenPoolFeeQuote : Optional CCIP.Interfaces.TokenPool.TokenPoolFeeQuote + executorFeeQuote : Optional CCIP.Interfaces.Executor.ExecutorFeeQuote + controller (view this).owner + do perPartyRouter_getFeeImpl this self arg + + nonconsuming choice PerPartyRouter_PrepareSend : ContractId CCIP.API.SendingMessageV1.SendingMessage + 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.API.SendingMessageV1.SendingMessage + with + sendingMessageCid : ContractId CCIP.API.SendingMessageV1.SendingMessage + 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.API.SendingMessageV1.SendingMessage + feeTokenHoldingCids : [ContractId Splice.Api.Token.HoldingV1.Holding] + feeTokenConfigCid : ContractId CCIP.API.TokenAdminRegistryV1.TokenConfig + 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.API.ExecutingMessageV1.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 + context : Splice.Api.Token.MetadataV1.ChoiceContext + message : CCIP.MessageCodecV1.MessageV1 + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalThreshold : Int + tokenPoolRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + controller (view this).owner + do perPartyRouter_getRequiredCCVsForExecuteImpl this self arg + + nonconsuming choice PerPartyRouter_PrepareExecute : ContractId CCIP.API.ExecutingMessageV1.ExecutingMessage + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + encodedMessage : BytesHex + receiverParty : Party + tokenReceiverParty : Optional Party + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalThreshold : Int + receiverFinalityConfig : CCIP.FinalityConfig.FinalityConfig + caller : Party + controller (view this).owner + do perPartyRouter_prepareExecuteImpl this self arg + + nonconsuming choice PerPartyRouter_Execute : ExecuteResult + with + context : Splice.Api.Token.MetadataV1.ChoiceContext + executingMessageCid : ContractId CCIP.API.ExecutingMessageV1.ExecutingMessage + 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 + deriving (Eq, Show) + +data CCIPSendResult = CCIPSendResult + with + router : ContractId PerPartyRouter + ccipMessageSent : ContractId CCIP.EventsV1.Events.CCIPMessageSent + messageId : BytesHex + feeChangeCids : [ContractId Splice.Api.Token.HoldingV1.Holding] + pendingFeeInstructions : [ContractId Splice.Api.Token.TransferInstructionV1.TransferInstruction] + deriving (Eq, Show) + +data ExecuteResult = ExecuteResult + with + router : ContractId PerPartyRouter + tokenReceiveTicket : Optional (ContractId CCIP.Tickets.TokenReceiveTicket) + executionStateChanged : ContractId CCIP.EventsV1.Events.ExecutionStateChanged + messageId : BytesHex + message : CCIP.MessageCodecV1.MessageV1 + state : CCIP.API.ExecutingMessageV1.MessageExecutionState + deriving (Eq, Show) + +data PerPartyRouterView = PerPartyRouterView + with + ccipOwner : Party + owner : Party + +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/core/daml.yaml b/contracts/ccip/core/daml.yaml index fe844e5f1..c9b27be64 100644 --- a/contracts/ccip/core/daml.yaml +++ b/contracts/ccip/core/daml.yaml @@ -12,7 +12,6 @@ data-dependencies: - ../../dependencies/splice/splice-api-token-transfer-instruction-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 - - ../utils/.daml/dist/ccip-utils-2.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 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/FeeQuoter.daml b/contracts/ccip/core/daml/CCIP/FeeQuoter.daml index bc93efeab..d6ec1cff4 100644 --- a/contracts/ccip/core/daml/CCIP/FeeQuoter.daml +++ b/contracts/ccip/core/daml/CCIP/FeeQuoter.daml @@ -16,7 +16,6 @@ import Splice.Api.Token.MetadataV1 (ChoiceContext) import qualified Chainlink.InstanceAddress import qualified CCIP.API.FeeQuoterV1 -import qualified CCIP.Utils.Context import CCIP.Math qualified import qualified CCIP.SendingMessageV1 @@ -40,11 +39,6 @@ import CCIP.FeeQuoterTypes ( ApplyFeeQuoterDestChainConfigUpdatesParams(..), ) -feeQuoterKey : Text -feeQuoterKey = "fee-quoter" - -lookupFeeQuoterCid : ChoiceContext -> Update (ContractId FeeQuoter) -lookupFeeQuoterCid ctx = CCIP.Utils.Context.getFromContextU ctx feeQuoterKey rawInstanceAddress : FeeQuoter -> Chainlink.InstanceAddress.RawInstanceAddress rawInstanceAddress feeQuoter = Chainlink.InstanceAddress.make feeQuoter.instanceId feeQuoter.owner diff --git a/contracts/ccip/core/daml/CCIP/GlobalConfig.daml b/contracts/ccip/core/daml/CCIP/GlobalConfig.daml index e2c04b6d7..2f019e04e 100644 --- a/contracts/ccip/core/daml/CCIP/GlobalConfig.daml +++ b/contracts/ccip/core/daml/CCIP/GlobalConfig.daml @@ -8,9 +8,15 @@ 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 MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) +import MCMS.Crypto (assertValidHex) + +import qualified Chainlink.InstanceAddress + +import qualified CCIP.API.GlobalConfigV1 -import qualified CCIP.Utils.Context import CCIP.GlobalConfigTypes ( DestChainConfig(..), DestChainConfigArgs(..), @@ -21,16 +27,6 @@ import CCIP.GlobalConfigTypes ( validateDefaultAndMandatedCCVs, ) import CCIP.GlobalConfigCodecGen (decodeApplyDestChainConfigUpdatesParamsAt, decodeApplySourceChainConfigUpdatesParamsAt) -import Chainlink.InstanceAddress (assertValidInstanceId) - -import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) -import MCMS.Crypto (assertValidHex) - -globalConfigKey : Text -globalConfigKey = "global-config" - -lookupGlobalConfigCid : ChoiceContext -> Update (ContractId GlobalConfig) -lookupGlobalConfigCid ctx = CCIP.Utils.Context.getFromContextU ctx globalConfigKey template GlobalConfig with @@ -44,11 +40,40 @@ 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.API.GlobalConfigV1.GlobalConfig for GlobalConfig where + view = CCIP.API.GlobalConfigV1.GlobalConfigView with + ccipOwner + + globalConfig_publicFetchImpl self arg = do + Chainlink.InstanceAddress.assertEqual "GlobalConfig: expectedAddress mismatch" instanceId ccipOwner arg.expectedAddress + pure CCIP.API.GlobalConfigV1.GlobalConfigView with + ccipOwner + + 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.API.GlobalConfigV1.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 + ) + nonconsuming choice GetDestChainConfig : Optional DestChainConfig with destChainSelector : Numeric 0 diff --git a/contracts/ccip/core/daml/CCIP/RMNRemote.daml b/contracts/ccip/core/daml/CCIP/RMNRemote.daml index c5afc1ae7..c38166c5c 100644 --- a/contracts/ccip/core/daml/CCIP/RMNRemote.daml +++ b/contracts/ccip/core/daml/CCIP/RMNRemote.daml @@ -15,7 +15,6 @@ import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) import qualified Chainlink.InstanceAddress import qualified CCIP.API.RMNRemoteV1 -import qualified CCIP.Utils.Context import CCIP.NumericHex qualified as NumericHex import CCIP.RMNRemoteCodecGen ( @@ -59,11 +58,6 @@ removeCustomObservers : [Party] -> [Party] -> [Party] removeCustomObservers current removals = filter (`notElem` removals) current -rmnRemoteContextKey : Text -rmnRemoteContextKey = "rmn-remote" - -lookupRmnRemoteCid : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (ContractId RMNRemote) -lookupRmnRemoteCid ctx = CCIP.Utils.Context.getFromContextU ctx rmnRemoteContextKey -- | RMN contract providing curse capability for emergency stops. -- Separate rmnOwner party allows independent control from ccipOwner. diff --git a/contracts/ccip/core/daml/CCIP/TokenAdminRegistry.daml b/contracts/ccip/core/daml/CCIP/TokenAdminRegistry.daml index e79197a40..3e76016d3 100644 --- a/contracts/ccip/core/daml/CCIP/TokenAdminRegistry.daml +++ b/contracts/ccip/core/daml/CCIP/TokenAdminRegistry.daml @@ -11,7 +11,6 @@ import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 import qualified CCIP.API.TokenAdminRegistryV1 -import qualified CCIP.Utils.Context import qualified CCIP.ExecutingMessageV1 import qualified CCIP.MessageCodecV1 @@ -39,24 +38,6 @@ import CCIP.TokenAdminRegistryTypes ( TransferAdminParams(..), ) -tokenAdminRegistryKey : Text -tokenAdminRegistryKey = "token-admin-registry" - -tokenConfigKey : Text -tokenConfigKey = "token-config" - -lookupTokenAdminRegistryCid : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (ContractId TokenAdminRegistry) -lookupTokenAdminRegistryCid ctx = - CCIP.Utils.Context.getFromContextU ctx tokenAdminRegistryKey - -lookupTokenConfigCid : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (ContractId TokenConfig) -lookupTokenConfigCid ctx = - CCIP.Utils.Context.getFromContextU ctx tokenConfigKey - -lookupOptionalTokenConfigCid : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (Optional (ContractId TokenConfig)) -lookupOptionalTokenConfigCid ctx = - CCIP.Utils.Context.lookupFromContextU ctx tokenConfigKey - tokenConfigInstanceId : Splice.Api.Token.HoldingV1.InstrumentId -> Text tokenConfigInstanceId = CCIP.MessageCodecV1.encodeInstrumentId diff --git a/contracts/ccip/extension-api/daml/CCIP/Interfaces/TokenPool.daml b/contracts/ccip/extension-api/daml/CCIP/Interfaces/TokenPool.daml index 1d0414854..6b4e47124 100644 --- a/contracts/ccip/extension-api/daml/CCIP/Interfaces/TokenPool.daml +++ b/contracts/ccip/extension-api/daml/CCIP/Interfaces/TokenPool.daml @@ -9,6 +9,7 @@ import qualified Splice.Api.Token.TransferInstructionV1 import Chainlink.InstanceAddress (RawInstanceAddress) import qualified CCIP.API.ExecutingMessageV1 +import qualified CCIP.API.FeeQuoterV1 import qualified CCIP.API.RMNRemoteV1 import qualified CCIP.API.SendingMessageV1 import qualified CCIP.API.TokenAdminRegistryV1 @@ -101,7 +102,7 @@ interface ITokenPool where tokenConfigCid : ContractId CCIP.API.TokenAdminRegistryV1.TokenConfig extraContext : Splice.Api.Token.MetadataV1.ChoiceContext sendingMessageCid : ContractId CCIP.API.SendingMessageV1.SendingMessage - feeQuoterCid : ContractId () + feeQuoterCid : ContractId CCIP.API.FeeQuoterV1.FeeQuoter tokenInstrumentId : Splice.Api.Token.HoldingV1.InstrumentId caller : Party controller caller @@ -110,7 +111,7 @@ interface ITokenPool where -- Quote-only fee path for outbound token transfers. nonconsuming choice TokenPool_GetFee : TokenPoolFeeQuote with - feeQuoterCid : ContractId () + feeQuoterCid : ContractId CCIP.API.FeeQuoterV1.FeeQuoter destChainSelector : Numeric 0 tokenInstrumentId : Splice.Api.Token.HoldingV1.InstrumentId caller : Party diff --git a/contracts/ccip/factory/daml.yaml b/contracts/ccip/factory/daml.yaml index 7c4e84b0f..da577470a 100644 --- a/contracts/ccip/factory/daml.yaml +++ b/contracts/ccip/factory/daml.yaml @@ -16,6 +16,7 @@ data-dependencies: - ../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/.daml/dist/ccip-client-2.0.0.dar dependencies: - daml-prim - daml-stdlib diff --git a/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPool.daml b/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPool.daml index c659fc51d..557fe82d9 100644 --- a/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPool.daml +++ b/contracts/ccip/pools/burn-mint-token-pool/daml/CCIP/BurnMintTokenPool.daml @@ -384,14 +384,14 @@ template BurnMintTokenPool tokenConfigCid = arg.tokenConfigCid extraContext = arg.extraContext sendingMessageCid = arg.sendingMessageCid - feeQuoterCid = coerceContractId arg.feeQuoterCid + feeQuoterCid = arg.feeQuoterCid tokenInstrumentId = arg.tokenInstrumentId caller = arg.caller tokenPool_getFeeImpl self arg = do exercise (fromInterfaceContractId @BurnMintTokenPool self) GetFee with - feeQuoterCid = coerceContractId arg.feeQuoterCid + feeQuoterCid = arg.feeQuoterCid destChainSelector = arg.destChainSelector tokenInstrumentId = arg.tokenInstrumentId caller = arg.caller @@ -817,7 +817,7 @@ template BurnMintTokenPool let expectedRateLimiter = if useCustomFinalityRateLimiter then remoteChainCfg.inboundCustomBlockConfirmationsRateLimiter else remoteChainCfg.inboundRateLimiter - rateLimiterCid <- CCIP.RateLimiterV1.lookupRateLimiterCid extraContext + rateLimiterCid <- CCIP.Utils.Context.getFromContextU extraContext CCIP.RateLimiterV1.rateLimiterContextKey rateLimiter <- fetch rateLimiterCid assertRateLimiter "ReleaseFromTicket: rateLimiter" @@ -1081,7 +1081,7 @@ template BurnMintTokenPool let amountAfterFeeBps = amountNumeric0 - feeAmount let expectedRateLimiter = remoteChainCfg.outboundRateLimiter - rateLimiterCid <- CCIP.RateLimiterV1.lookupRateLimiterCid extraContext + rateLimiterCid <- CCIP.Utils.Context.getFromContextU extraContext CCIP.RateLimiterV1.rateLimiterContextKey rateLimiter <- fetch rateLimiterCid assertRateLimiter "LockOrBurn: rateLimiter" diff --git a/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPool.daml b/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPool.daml index 817473db0..98012763a 100644 --- a/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPool.daml +++ b/contracts/ccip/pools/lock-release-token-pool/daml/CCIP/LockReleaseTokenPool.daml @@ -321,7 +321,7 @@ template LockReleaseTokenPool caller = arg.caller tokenPool_verifyOutboundCCVsImpl self arg = do - coerceContractId <$> exercise (fromInterfaceContractId @LockReleaseTokenPool self) VerifyOutboundCCVs + exercise (fromInterfaceContractId @LockReleaseTokenPool self) VerifyOutboundCCVs with tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid @@ -353,20 +353,20 @@ template LockReleaseTokenPool caller = arg.caller tokenPool_calculateFeeImpl self arg = do - coerceContractId <$> exercise (fromInterfaceContractId @LockReleaseTokenPool self) CalculateFee + exercise (fromInterfaceContractId @LockReleaseTokenPool self) CalculateFee with tokenAdminRegistryCid = arg.tokenAdminRegistryCid tokenConfigCid = arg.tokenConfigCid extraContext = arg.extraContext sendingMessageCid = arg.sendingMessageCid - feeQuoterCid = coerceContractId arg.feeQuoterCid + feeQuoterCid = arg.feeQuoterCid tokenInstrumentId = arg.tokenInstrumentId caller = arg.caller tokenPool_getFeeImpl self arg = do exercise (fromInterfaceContractId @LockReleaseTokenPool self) GetFee with - feeQuoterCid = coerceContractId arg.feeQuoterCid + feeQuoterCid = arg.feeQuoterCid destChainSelector = arg.destChainSelector tokenInstrumentId = arg.tokenInstrumentId caller = arg.caller @@ -792,7 +792,7 @@ template LockReleaseTokenPool let expectedRateLimiter = if useCustomFinalityRateLimiter then remoteChainCfg.inboundCustomBlockConfirmationsRateLimiter else remoteChainCfg.inboundRateLimiter - rateLimiterCid <- CCIP.RateLimiterV1.lookupRateLimiterCid extraContext + rateLimiterCid <- CCIP.Utils.Context.getFromContextU extraContext CCIP.RateLimiterV1.rateLimiterContextKey rateLimiter <- fetch rateLimiterCid assertRateLimiter "ReleaseFromTicket: rateLimiter" @@ -826,7 +826,7 @@ template LockReleaseTokenPool caller = poolOwner -- Get inputs from extraContext - tokenPoolHoldings <- lookupTokenPoolHoldings extraContext + tokenPoolHoldings <- CCIP.Utils.Context.getFromContextU extraContext tokenPoolHoldingsContextKey _ <- sumCheckedHoldingAmounts "ReleaseFromTicket: tokenPoolHoldings" poolOwner @@ -943,8 +943,7 @@ template LockReleaseTokenPool -- 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.API.SendingMessageV1.SendingMessage + nonconsuming choice CalculateFee : ContractId CCIP.API.SendingMessageV1.SendingMessage with tokenAdminRegistryCid : ContractId CCIP.API.TokenAdminRegistryV1.TokenAdminRegistry tokenConfigCid : ContractId CCIP.API.TokenAdminRegistryV1.TokenConfig @@ -1109,7 +1108,7 @@ template LockReleaseTokenPool let amountAfterFeeBps = amountNumeric0 - calculateFeeFromBps amountNumeric0 tokenFeeBps let expectedRateLimiter = remoteChainCfg.outboundRateLimiter - rateLimiterCid <- CCIP.RateLimiterV1.lookupRateLimiterCid extraContext + rateLimiterCid <- CCIP.Utils.Context.getFromContextU extraContext CCIP.RateLimiterV1.rateLimiterContextKey rateLimiter <- fetch rateLimiterCid assertRateLimiter "LockOrBurn: rateLimiter" @@ -1123,7 +1122,7 @@ template LockReleaseTokenPool requested = amountAfterFeeBps -- Get inputs from extraContext - tokenPoolHoldings <- lookupTokenPoolHoldings extraContext + tokenPoolHoldings <- CCIP.Utils.Context.getFromContextU extraContext tokenPoolHoldingsContextKey _ <- sumCheckedHoldingAmounts "LockOrBurn: existing tokenPoolHoldings" poolOwner diff --git a/contracts/ccip/rate-limiter/daml.yaml b/contracts/ccip/rate-limiter/daml.yaml index af22dd6a9..5b10d7633 100644 --- a/contracts/ccip/rate-limiter/daml.yaml +++ b/contracts/ccip/rate-limiter/daml.yaml @@ -6,9 +6,7 @@ build-options: - "-Wno-crypto-text-is-alpha" - "-Werror=unused-dependency" data-dependencies: - - ../../dependencies/splice/splice-api-token-metadata-v1-1.0.0.dar - ../../chainlink/api/.daml/dist/chainlink-api-2.0.0.dar - - ../utils/.daml/dist/ccip-utils-2.0.0.dar - ../../mcms/api/.daml/dist/mcms-api-1.0.0.dar dependencies: - daml-prim diff --git a/contracts/ccip/rate-limiter/daml/CCIP/RateLimiterV1.daml b/contracts/ccip/rate-limiter/daml/CCIP/RateLimiterV1.daml index 8acbec984..dd9eff261 100644 --- a/contracts/ccip/rate-limiter/daml/CCIP/RateLimiterV1.daml +++ b/contracts/ccip/rate-limiter/daml/CCIP/RateLimiterV1.daml @@ -4,10 +4,6 @@ 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.Utils.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.Utils.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 89a0d51db..99283c47d 100644 --- a/contracts/ccip/receiver/daml.yaml +++ b/contracts/ccip/receiver/daml.yaml @@ -15,11 +15,10 @@ data-dependencies: - ../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 -dependencies: - - daml-prim - - daml-stdlib + - ../client/.daml/dist/ccip-client-2.0.0.dar - ../../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 +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/receiver/daml/CCIP/CCIPReceiver.daml b/contracts/ccip/receiver/daml/CCIP/CCIPReceiver.daml index 0d23e937d..55ef7ee2a 100644 --- a/contracts/ccip/receiver/daml/CCIP/CCIPReceiver.daml +++ b/contracts/ccip/receiver/daml/CCIP/CCIPReceiver.daml @@ -14,14 +14,16 @@ import DA.Optional (fromSomeNote) import Splice.Api.Token.MetadataV1 (ChoiceContext) +import qualified Chainlink.InstanceAddress + +import qualified CCIP.API.RMNRemoteV1 +import qualified CCIP.API.TokenAdminRegistryV1 +import qualified CCIP.ClientV1 import qualified CCIP.FinalityConfig import qualified CCIP.Interfaces.CrossChainVerifier import qualified CCIP.Interfaces.TokenPool import qualified CCIP.MessageCodecV1 -import qualified CCIP.PerPartyRouter -import qualified CCIP.RMNRemote -import Chainlink.InstanceAddress (RawInstanceAddress, assertValidInstanceId) -import qualified CCIP.TokenAdminRegistry +import qualified CCIP.Utils.Context -- | Per-CCV verification input. Pairs a verifier contract (via interface) -- with the attestation data and per-CCV extra context. @@ -48,25 +50,25 @@ 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 where signatory owner -- Ensure that requiredCCVs are unique - ensure assertValidInstanceId instanceId + ensure Chainlink.InstanceAddress.assertValidInstanceId instanceId && unique requiredCCVs && CCIP.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) controller owner @@ -92,7 +94,7 @@ template CCIPReceiver direction = CCIP.Interfaces.TokenPool.Inbound caller = owner - exercise routerCid CCIP.PerPartyRouter.GetRequiredCCVsForExecute with + exercise routerCid CCIP.ClientV1.PerPartyRouter_GetRequiredCCVsForExecute with context = context message = message receiverRequiredCCVs = requiredCCVs @@ -103,7 +105,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) @@ -117,7 +119,7 @@ template CCIPReceiver context : ChoiceContext -- CCIP contract IDs - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter + routerCid : ContractId CCIP.ClientV1.PerPartyRouter -- The encoded CCIP message (hex-encoded bytes) encodedMessage : BytesHex @@ -131,11 +133,11 @@ template CCIPReceiver controller owner do -- Extract CIDs from context using typed accessors for pool/CCV calls. - rmnRemoteCid <- CCIP.RMNRemote.lookupRmnRemoteCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context + rmnRemoteCid : ContractId CCIP.API.RMNRemoteV1.RMNRemote <- CCIP.Utils.Context.getFromContextU context CCIP.API.RMNRemoteV1.rmnRemoteContextKey + tokenAdminRegistryCid : ContractId CCIP.API.TokenAdminRegistryV1.TokenAdminRegistry <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey -- PrepareExecute: decode, validate, create ExecutingMessageV1 - emCid <- coerceContractId <$> exercise routerCid CCIP.PerPartyRouter.PrepareExecute with + emCid <- coerceContractId <$> exercise routerCid CCIP.ClientV1.PerPartyRouter_PrepareExecute with context = context encodedMessage = encodedMessage receiverParty = owner @@ -150,39 +152,39 @@ template CCIPReceiver emCid <- case tokenTransfer of None -> pure emCid Some tt -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context + tokenConfigCid <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenConfigContextKey coerceContractId <$> exercise tt.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_VerifyInboundMessage with - tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid - tokenConfigCid = coerceContractId tokenConfigCid + tokenAdminRegistryCid = tokenAdminRegistryCid + tokenConfigCid = tokenConfigCid extraContext = tt.poolExtraContext - executingMessageCid = coerceContractId emCid + executingMessageCid = emCid caller = owner -- CCV verification: thread executingMessageCid through each CCV emCid <- foldlA (\cid input -> coerceContractId <$> exercise input.ccvCid CCIP.Interfaces.CrossChainVerifier.CrossChainVerifier_VerifyMessage with - rmnRemoteCid = coerceContractId rmnRemoteCid + rmnRemoteCid = rmnRemoteCid extraContext = input.ccvExtraContext - executingMessageCid = coerceContractId cid + 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, coerceContractId <$> result.tokenReceiveTicket) of (Some tt, Some ticketCid) -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context + tokenConfigCid <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenConfigContextKey releaseResult <- exercise tt.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_ReleaseFromTicket with - tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid - tokenConfigCid = coerceContractId tokenConfigCid - rmnRemoteCid = coerceContractId rmnRemoteCid + tokenAdminRegistryCid = tokenAdminRegistryCid + tokenConfigCid = tokenConfigCid + rmnRemoteCid = rmnRemoteCid extraContext = tt.poolExtraContext tokenReceiveTicketCid = ticketCid caller = owner @@ -204,7 +206,7 @@ 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 diff --git a/contracts/ccip/runtime/daml.yaml b/contracts/ccip/runtime/daml.yaml index 903de6869..ba97de1ef 100644 --- a/contracts/ccip/runtime/daml.yaml +++ b/contracts/ccip/runtime/daml.yaml @@ -19,6 +19,7 @@ data-dependencies: - ../codec/.daml/dist/ccip-codec-2.0.0.dar - ../extension-api/.daml/dist/ccip-extension-api-2.0.0.dar - ../events/.daml/dist/ccip-events-2.0.0.dar + - ../client/.daml/dist/ccip-client-2.0.0.dar dependencies: - daml-prim - daml-stdlib diff --git a/contracts/ccip/runtime/daml/CCIP/OffRamp.daml b/contracts/ccip/runtime/daml/CCIP/OffRamp.daml index 0af5a50b9..f2bf06acb 100644 --- a/contracts/ccip/runtime/daml/CCIP/OffRamp.daml +++ b/contracts/ccip/runtime/daml/CCIP/OffRamp.daml @@ -14,7 +14,6 @@ import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) import Chainlink.InstanceAddress (assertValidInstanceId) import Chainlink.InstanceAddress qualified as RawInstanceAddress -import qualified CCIP.Utils.Context import qualified CCIP.EventsV1.Events import qualified CCIP.ExecutingMessageV1 import qualified CCIP.FinalityConfig @@ -28,11 +27,8 @@ import qualified CCIP.TokenAdminRegistry import CCIP.OffRampTypes (OffRampDeps(..), SetDepsParams(..)) import CCIP.OffRampCodecGen (decodeSetDepsParamsAt) -offRampKey : Text -offRampKey = "off-ramp" - -lookupOffRampCid : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (ContractId OffRamp) -lookupOffRampCid ctx = CCIP.Utils.Context.getFromContextU ctx offRampKey +offRampContextKey : Text +offRampContextKey = "off-ramp" rawInstanceAddress : OffRamp -> RawInstanceAddress.RawInstanceAddress rawInstanceAddress offRamp = RawInstanceAddress.make offRamp.instanceId offRamp.ccipOwner diff --git a/contracts/ccip/runtime/daml/CCIP/OnRamp.daml b/contracts/ccip/runtime/daml/CCIP/OnRamp.daml index a58ef415c..4120b749d 100644 --- a/contracts/ccip/runtime/daml/CCIP/OnRamp.daml +++ b/contracts/ccip/runtime/daml/CCIP/OnRamp.daml @@ -16,11 +16,10 @@ import Chainlink.InstanceAddress qualified as RawInstanceAddress import Chainlink.InstanceAddress (assertValidInstanceId) import qualified CCIP.Interfaces.CrossChainVerifier -import qualified CCIP.Utils.Context import qualified CCIP.EventsV1.Events import qualified CCIP.EventsV1.Receipts +import qualified CCIP.ClientV1 -import qualified CCIP.Client import qualified CCIP.FeeQuoter import qualified CCIP.GlobalConfig import qualified CCIP.Interfaces.Executor @@ -69,19 +68,16 @@ noExecutionAddressBytes : BytesHex noExecutionAddressBytes = "eba517d200000000000000000000000000000000000000000000000000000000" -onRampKey : Text -onRampKey = "on-ramp" - -lookupOnRampCid : Splice.Api.Token.MetadataV1.ChoiceContext -> Update (ContractId OnRamp) -lookupOnRampCid ctx = CCIP.Utils.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.ClientV1.Canton2AnyMessage + -> CCIP.ClientV1.GenericExtraArgsV3 -> [RawInstanceAddress.RawInstanceAddress] -> [RawInstanceAddress.RawInstanceAddress] computeRequiredCCVsForSend destConfig message extraArgs senderRequestedCCVs = @@ -102,15 +98,15 @@ computeRequiredCCVsForSend destConfig message extraArgs senderRequestedCCVs = in dedup (resolvedSenderRequiredCCVs ++ destConfig.laneMandatedCCVs) validateExecutorFeeQuote - : CCIP.Client.ExecutorExtraArg + : CCIP.ClientV1.ExecutorExtraArg -> Optional RawInstanceAddress.RawInstanceAddress -> Optional CCIP.Interfaces.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 _) -> @@ -277,7 +273,7 @@ template OnRamp with globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage + message : CCIP.ClientV1.Canton2AnyMessage poolReportedCCVs : [RawInstanceAddress.RawInstanceAddress] controller ccipOwner do @@ -293,7 +289,7 @@ template OnRamp 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.CCVCodec.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs @@ -321,7 +317,7 @@ template OnRamp nonconsuming choice PrepareSendFromRouter : ContractId CCIP.SendingMessageV1.SendingMessageV1 with destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage + message : CCIP.ClientV1.Canton2AnyMessage routerPartyOwner : Party routerInstanceId : Text @@ -372,7 +368,7 @@ 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.CCVCodec.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs assertMsg "onramp: gas limit exceeds uint32" (extraArgs.gasLimit <= 4294967295) @@ -384,10 +380,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 @@ -434,11 +430,11 @@ template OnRamp None -> (None, noExecutionAddressBytes, Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor) let (resolvedRequiredExecutor, resolvedExecutorAddress, executionMode) = case extraArgs.executor of - CCIP.Client.Executor_UseDefault _ -> + CCIP.ClientV1.Executor_UseDefault _ -> resolveDefault - CCIP.Client.Executor_NoExecutor -> + CCIP.ClientV1.Executor_NoExecutor -> (None, noExecutionAddressBytes, Some CCIP.SendingMessageV1.ExecutionMode_NoExecutor) - CCIP.Client.Executor_WithAddress executorAddress _ -> + CCIP.ClientV1.Executor_WithAddress executorAddress _ -> ( Some executorAddress , RawInstanceAddress.toInstanceAddress executorAddress , Some CCIP.SendingMessageV1.ExecutionMode_Executor @@ -504,24 +500,24 @@ template OnRamp globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage + message : CCIP.ClientV1.Canton2AnyMessage ccvFeeQuotes : [CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierFeeQuote] tokenPoolFeeQuote : Optional CCIP.Interfaces.TokenPool.TokenPoolFeeQuote executorFeeQuote : Optional CCIP.Interfaces.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.CCVCodec.assertMaxCCVListLength "onramp: sender CCVs" senderRequestedCCVs CCIP.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 @@ -531,13 +527,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 diff --git a/contracts/ccip/runtime/daml/CCIP/PerPartyRouter.daml b/contracts/ccip/runtime/daml/CCIP/PerPartyRouter.daml index 8fa955c86..f81c2a6b5 100644 --- a/contracts/ccip/runtime/daml/CCIP/PerPartyRouter.daml +++ b/contracts/ccip/runtime/daml/CCIP/PerPartyRouter.daml @@ -15,33 +15,40 @@ 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.API.ExecutingMessageV1 +import qualified CCIP.API.FeeQuoterV1 +import qualified CCIP.API.GlobalConfigV1 +import qualified CCIP.API.RMNRemoteV1 +import qualified CCIP.API.TokenAdminRegistryV1 + +import qualified CCIP.ClientV1 import qualified CCIP.Utils.Context -import qualified CCIP.Client +import qualified CCIP.Interfaces.CrossChainVerifier + import qualified CCIP.ExecutingMessageV1 import qualified CCIP.EventsV1.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 qualified CCIP.RMNRemote -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.CCVCodec -import MCMS.MCMSReceiver (MCMSReceiver(..), MCMSReceiverView(..)) + import CCIP.PerPartyRouterTypes (PerPartyRouterDeps(..), SetDepsParams(..), AddCustomObserversParams(..), RemoveCustomObserversParams(..)) import CCIP.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 @@ -176,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 @@ -296,33 +303,126 @@ 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 + context = arg.context + destChainSelector = arg.destChainSelector + message = arg.message + poolReportedCCVs = arg.poolReportedCCVs + + perPartyRouter_getFeeImpl self arg = do + result <- exercise (fromInterfaceContractId @PerPartyRouter self) GetFee with + context = arg.context + destChainSelector = arg.destChainSelector + message = arg.message + ccvFeeQuotes = arg.ccvFeeQuotes + tokenPoolFeeQuote = arg.tokenPoolFeeQuote + executorFeeQuote = arg.executorFeeQuote + pure CCIP.ClientV1.GetFeeResult with + feeTokenAmount = result.feeTokenAmount + + 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 = result.ccipMessageSent + messageId = result.messageId + feeChangeCids = result.feeChangeCids + pendingFeeInstructions = result.pendingFeeInstructions + + 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 + pure CCIP.ClientV1.ExecuteResult with + router = coerceContractId result.router + tokenReceiveTicket = result.tokenReceiveTicket + executionStateChanged = result.executionStateChanged + messageId = result.messageId + message = result.message + state = result.state nonconsuming choice GetFee : CCIP.OnRamp.GetFeeFromRouterResult with context : Splice.Api.Token.MetadataV1.ChoiceContext destChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage - ccvFeeQuotes : [ICCV.CrossChainVerifierFeeQuote] + message : CCIP.ClientV1.Canton2AnyMessage + ccvFeeQuotes : [CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierFeeQuote] tokenPoolFeeQuote : Optional CCIP.Interfaces.TokenPool.TokenPoolFeeQuote executorFeeQuote : Optional CCIP.Interfaces.Executor.ExecutorFeeQuote controller partyOwner do CCIP.CCVCodec.assertMaxCCVListLength "router: CCV fee quotes" ccvFeeQuotes - onRampCid <- CCIP.OnRamp.lookupOnRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - feeQuoterCid <- CCIP.FeeQuoter.lookupFeeQuoterCid context + onRampCid : ContractId CCIP.OnRamp.OnRamp <- CCIP.Utils.Context.getFromContextU context CCIP.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.globalConfigContextKey + feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter <- CCIP.Utils.Context.getFromContextU context CCIP.API.FeeQuoterV1.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" + Chainlink.InstanceAddress.assertEqual "router: feequoter mismatch" feeQuoter.instanceId feeQuoter.owner deps.feeQuoter exercise onRampCid CCIP.OnRamp.GetFeeFromRouter with @@ -372,34 +472,34 @@ template PerPartyRouter nonconsuming choice PrepareSend : ContractId CCIP.SendingMessageV1.SendingMessageV1 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.RMNRemote.lookupRmnRemoteCid context + onRampCid : ContractId CCIP.OnRamp.OnRamp <- CCIP.Utils.Context.getFromContextU context CCIP.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.globalConfigContextKey + tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey + feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter <- CCIP.Utils.Context.getFromContextU context CCIP.API.FeeQuoterV1.feeQuoterContextKey + rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote <- CCIP.Utils.Context.getFromContextU context CCIP.API.RMNRemoteV1.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" + Chainlink.InstanceAddress.assertEqual "router: tokenadminregistry mismatch" tokenAdminRegistry.instanceId tokenAdminRegistry.ccipOwner deps.tokenAdminRegistry feeQuoter <- fetch feeQuoterCid - RawInstanceAddress.assertEqual "router: feequoter mismatch" + Chainlink.InstanceAddress.assertEqual "router: feequoter mismatch" feeQuoter.instanceId feeQuoter.owner 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 @@ -423,26 +523,26 @@ template PerPartyRouter 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.OnRamp.OnRamp <- CCIP.Utils.Context.getFromContextU context CCIP.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.globalConfigContextKey + feeQuoterCid : ContractId CCIP.FeeQuoter.FeeQuoter <- CCIP.Utils.Context.getFromContextU context CCIP.API.FeeQuoterV1.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" + Chainlink.InstanceAddress.assertEqual "router: feequoter mismatch" feeQuoter.instanceId feeQuoter.owner 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) @@ -476,26 +576,26 @@ template PerPartyRouter feeTokenExtraArgs : Splice.Api.Token.MetadataV1.ExtraArgs 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.RMNRemote.lookupRmnRemoteCid context + onRampCid : ContractId CCIP.OnRamp.OnRamp <- CCIP.Utils.Context.getFromContextU context CCIP.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.globalConfigContextKey + tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey + tokenConfigCid : Optional (ContractId CCIP.TokenAdminRegistry.TokenConfig) <- CCIP.Utils.Context.lookupFromContextU context CCIP.API.TokenAdminRegistryV1.tokenConfigContextKey + rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote <- CCIP.Utils.Context.getFromContextU context CCIP.API.RMNRemoteV1.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" + 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 @@ -682,32 +782,32 @@ template PerPartyRouter 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 caller : Party controller partyOwner do - offRampCid <- CCIP.OffRamp.lookupOffRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context - rmnRemoteCid <- CCIP.RMNRemote.lookupRmnRemoteCid context + offRampCid : ContractId CCIP.OffRamp.OffRamp <- CCIP.Utils.Context.getFromContextU context CCIP.OffRamp.offRampContextKey + globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.globalConfigContextKey + tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey + rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote <- CCIP.Utils.Context.getFromContextU context CCIP.API.RMNRemoteV1.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" + 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) @@ -742,26 +842,26 @@ template PerPartyRouter 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.RMNRemote.lookupRmnRemoteCid context + offRampCid : ContractId CCIP.OffRamp.OffRamp <- CCIP.Utils.Context.getFromContextU context CCIP.OffRamp.offRampContextKey + globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.globalConfigContextKey + tokenAdminRegistryCid : ContractId CCIP.TokenAdminRegistry.TokenAdminRegistry <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey + tokenConfigCid : Optional (ContractId CCIP.TokenAdminRegistry.TokenConfig) <- CCIP.Utils.Context.lookupFromContextU context CCIP.API.TokenAdminRegistryV1.tokenConfigContextKey + rmnRemoteCid : ContractId CCIP.RMNRemote.RMNRemote <- CCIP.Utils.Context.getFromContextU context CCIP.API.RMNRemoteV1.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" + 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 @@ -809,6 +909,7 @@ template PerPartyRouter nonconsuming choice GetExecutionState : CCIP.API.ExecutingMessageV1.MessageExecutionState with messageHash : BytesHex + context : Splice.Api.Token.MetadataV1.ChoiceContext caller : Party controller caller do @@ -823,28 +924,29 @@ template PerPartyRouter 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] controller partyOwner do - onRampCid <- CCIP.OnRamp.lookupOnRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context + onRampCid : ContractId CCIP.OnRamp.OnRamp <- CCIP.Utils.Context.getFromContextU context CCIP.OnRamp.onRampContextKey + globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.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 @@ -854,25 +956,25 @@ template PerPartyRouter 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] + receiverRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] + receiverOptionalCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] receiverOptionalThreshold : Int - tokenPoolRequiredCCVs : [RawInstanceAddress] + tokenPoolRequiredCCVs : [Chainlink.InstanceAddress.RawInstanceAddress] controller partyOwner do - offRampCid <- CCIP.OffRamp.lookupOffRampCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context + offRampCid : ContractId CCIP.OffRamp.OffRamp <- CCIP.Utils.Context.getFromContextU context CCIP.OffRamp.offRampContextKey + globalConfigCid : ContractId CCIP.GlobalConfig.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.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 diff --git a/contracts/ccip/sender/daml.yaml b/contracts/ccip/sender/daml.yaml index 8a4bede04..2f5a946dd 100644 --- a/contracts/ccip/sender/daml.yaml +++ b/contracts/ccip/sender/daml.yaml @@ -15,11 +15,10 @@ data-dependencies: - ../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 -dependencies: - - daml-prim - - daml-stdlib + - ../client/.daml/dist/ccip-client-2.0.0.dar - ../../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 +dependencies: + - daml-prim + - daml-stdlib diff --git a/contracts/ccip/sender/daml/CCIP/CCIPSender.daml b/contracts/ccip/sender/daml/CCIP/CCIPSender.daml index 690c73e46..fb4cf8119 100644 --- a/contracts/ccip/sender/daml/CCIP/CCIPSender.daml +++ b/contracts/ccip/sender/daml/CCIP/CCIPSender.daml @@ -12,35 +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.FeeQuoter -import qualified CCIP.FinalityConfig -import qualified CCIP.GlobalConfig -import qualified CCIP.Math -import CCIP.Interfaces.CrossChainVerifier qualified as ICCV +import qualified Chainlink.InstanceAddress + +import qualified CCIP.API.FeeQuoterV1 +import qualified CCIP.API.GlobalConfigV1 +import qualified CCIP.API.RMNRemoteV1 +import qualified CCIP.API.TokenAdminRegistryV1 +import qualified CCIP.ClientV1 +import qualified CCIP.Interfaces.CrossChainVerifier import qualified CCIP.Interfaces.Executor import qualified CCIP.Interfaces.TokenPool -import qualified CCIP.PerPartyRouter -import qualified CCIP.RMNRemote -import qualified CCIP.SendingMessageV1 -import qualified CCIP.TokenAdminRegistry +import qualified CCIP.FinalityConfig +import qualified CCIP.Math import qualified CCIP.Uint256 +import qualified CCIP.Utils.Context -import Chainlink.InstanceAddress (assertValidInstanceId) -import Chainlink.InstanceAddress qualified as RawInstanceAddress 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 + ccvAddress : Chainlink.InstanceAddress.RawInstanceAddress + ccvCid : ContractId CCIP.Interfaces.CrossChainVerifier.ICrossChainVerifier ccvExtraContext : 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.API.TokenAdminRegistryV1.TokenConfig feeTokenTransferFactory : ContractId Splice.Api.Token.TransferInstructionV1.TransferFactory feeTokenExtraArgs : Splice.Api.Token.MetadataV1.ExtraArgs deriving (Eq, Show) @@ -68,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 @@ -78,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" @@ -92,11 +91,11 @@ assertExactCCVSet requiredCCVs providedCCVs = do (all ((`elem` requiredCCVs)) providedCCVs) validateCCVFeeQuote - : RawInstanceAddress.RawInstanceAddress - -> ICCV.CrossChainVerifierFeeQuote + : Chainlink.InstanceAddress.RawInstanceAddress + -> CCIP.Interfaces.CrossChainVerifier.CrossChainVerifierFeeQuote -> Update () validateCCVFeeQuote expectedCCV quote = - RawInstanceAddress.assertEqual + Chainlink.InstanceAddress.assertEqual "sender: GetFee CCV quote address mismatch" quote.ccvInstanceId quote.ccvOwner @@ -108,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 context : Splice.Api.Token.MetadataV1.ChoiceContext - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter + routerCid : ContractId CCIP.ClientV1.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 [] @@ -141,7 +140,7 @@ template CCIPSender direction = CCIP.Interfaces.TokenPool.Outbound caller = owner - exercise routerCid CCIP.PerPartyRouter.GetRequiredCCVsForSend with + exercise routerCid CCIP.ClientV1.PerPartyRouter_GetRequiredCCVsForSend with context = context destChainSelector = destinationChainSelector message = message @@ -150,21 +149,22 @@ template CCIPSender nonconsuming choice GetFee : GetFeeResult with destinationChainSelector : Numeric 0 - message : CCIP.Client.Canton2AnyMessage + message : CCIP.ClientV1.Canton2AnyMessage context : Splice.Api.Token.MetadataV1.ChoiceContext - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter + routerCid : ContractId CCIP.ClientV1.PerPartyRouter ccvSendInputs : [CCVSendInput] tokenTransferInput : Optional TokenTransferInput executorInput : Optional ExecutorInput controller owner do - feeQuoterCid <- CCIP.FeeQuoter.lookupFeeQuoterCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context + feeQuoterCid : ContractId CCIP.API.FeeQuoterV1.FeeQuoter <- CCIP.Utils.Context.getFromContextU context CCIP.API.FeeQuoterV1.feeQuoterContextKey + globalConfigCid : ContractId CCIP.API.GlobalConfigV1.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.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.API.GlobalConfigV1.GlobalConfig_GetDestChainConfig with destChainSelector = destinationChainSelector + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner destConfig <- case destConfigOpt of None -> abort "sender: unknown destination chain" @@ -182,7 +182,7 @@ template CCIPSender assertExactCCVSet requiredCCVs providedCCVs quotedCCVFees <- foldlA (\fees input -> do - q <- exercise input.ccvCid ICCV.CrossChainVerifier_GetFee with + q <- exercise input.ccvCid CCIP.Interfaces.CrossChainVerifier.CrossChainVerifier_GetFee with destChainSelector = destinationChainSelector context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = owner @@ -204,11 +204,11 @@ template CCIPSender 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" @@ -222,10 +222,10 @@ template CCIPSender destChainSelector = destinationChainSelector requiredCCVs = requiredCCVs 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 @@ -234,11 +234,11 @@ template CCIPSender destChainSelector = destinationChainSelector requiredCCVs = requiredCCVs 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 @@ -257,35 +257,35 @@ template CCIPSender feeTokenAmount = CCIP.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 + message : CCIP.ClientV1.Canton2AnyMessage context : Splice.Api.Token.MetadataV1.ChoiceContext - routerCid : ContractId CCIP.PerPartyRouter.PerPartyRouter + routerCid : ContractId CCIP.ClientV1.PerPartyRouter feeTokenInput : FeeTokenInput ccvSendInputs : [CCVSendInput] tokenTransferInput : Optional TokenTransferInput executorInput : Optional ExecutorInput controller owner do - feeQuoterCid <- CCIP.FeeQuoter.lookupFeeQuoterCid context - globalConfigCid <- CCIP.GlobalConfig.lookupGlobalConfigCid context - rmnRemoteCid <- CCIP.RMNRemote.lookupRmnRemoteCid context - tokenAdminRegistryCid <- CCIP.TokenAdminRegistry.lookupTokenAdminRegistryCid context + feeQuoterCid : ContractId CCIP.API.FeeQuoterV1.FeeQuoter <- CCIP.Utils.Context.getFromContextU context CCIP.API.FeeQuoterV1.feeQuoterContextKey + globalConfigCid : ContractId CCIP.API.GlobalConfigV1.GlobalConfig <- CCIP.Utils.Context.getFromContextU context CCIP.API.GlobalConfigV1.globalConfigContextKey + rmnRemoteCid : ContractId CCIP.API.RMNRemoteV1.RMNRemote <- CCIP.Utils.Context.getFromContextU context CCIP.API.RMNRemoteV1.rmnRemoteContextKey + tokenAdminRegistryCid : ContractId CCIP.API.TokenAdminRegistryV1.TokenAdminRegistry <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.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.API.GlobalConfigV1.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 : ContractId CCIP.SendingMessageV1.SendingMessageV1 <- - exercise routerCid CCIP.PerPartyRouter.PrepareSend with + smCid <- exercise routerCid CCIP.ClientV1.PerPartyRouter_PrepareSend with destinationChainSelector = destinationChainSelector message = message context @@ -298,23 +298,21 @@ template CCIPSender Some tt -> case tokenTransferInput of None -> abort "sender: tokenTransferInput required for token transfer" Some tokenTransferInput -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context - newCid <- exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_VerifyOutboundCCVs with - tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid - tokenConfigCid = coerceContractId tokenConfigCid + tokenConfigCid <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenConfigContextKey + exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_VerifyOutboundCCVs with + tokenAdminRegistryCid = tokenAdminRegistryCid + tokenConfigCid = tokenConfigCid extraContext = tokenTransferInput.poolExtraContext - sendingMessageCid = coerceContractId smCid + sendingMessageCid = smCid amount = tt.amount caller = owner - pure (coerceContractId newCid: ContractId CCIP.SendingMessageV1.SendingMessageV1) smCid <- foldlA (\cid input -> do - newCid <- exercise input.ccvCid - ICCV.CrossChainVerifier_CalculateFee with - sendingMessageCid = coerceContractId cid + exercise input.ccvCid + CCIP.Interfaces.CrossChainVerifier.CrossChainVerifier_CalculateFee with + sendingMessageCid = cid extraContext = input.ccvExtraContext caller = owner - pure (coerceContractId newCid : ContractId CCIP.SendingMessageV1.SendingMessageV1) ) smCid ccvSendInputs smCid <- case (message.tokenTransfer, tokenTransferInput) of @@ -324,23 +322,22 @@ template CCIPSender (Some _, None) -> abort "sender: tokenTransferInput required for token transfer" (Some tt, Some tokenTransferInput) -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context - newCid <- exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_CalculateFee with - tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid - tokenConfigCid = coerceContractId tokenConfigCid + tokenConfigCid <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenConfigContextKey + exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_CalculateFee with + tokenAdminRegistryCid = tokenAdminRegistryCid + tokenConfigCid = tokenConfigCid extraContext = tokenTransferInput.poolExtraContext - sendingMessageCid = coerceContractId smCid - feeQuoterCid = coerceContractId feeQuoterCid + sendingMessageCid = smCid + feeQuoterCid = feeQuoterCid tokenInstrumentId = tt.token caller = owner - pure (coerceContractId newCid : ContractId CCIP.SendingMessageV1.SendingMessageV1) 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" @@ -350,30 +347,28 @@ template CCIPSender case executorInput of None -> abort "sender: executorInput required for default executor mode" Some executorInput -> do - newCid <- exercise executorInput.executorCid + exercise executorInput.executorCid CCIP.Interfaces.Executor.Executor_CalculateFee with expectedExecutor = expectedExecutor - sendingMessageCid = coerceContractId smCid + sendingMessageCid = smCid executorArgs = executorArgs extraContext = executorInput.executorExtraContext caller = owner - pure (coerceContractId newCid : ContractId CCIP.SendingMessageV1.SendingMessageV1) - 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 - newCid <- exercise executorInput.executorCid + exercise executorInput.executorCid CCIP.Interfaces.Executor.Executor_CalculateFee with expectedExecutor = expectedExecutor - sendingMessageCid = coerceContractId smCid + sendingMessageCid = smCid executorArgs = executorArgs extraContext = executorInput.executorExtraContext caller = owner - pure (coerceContractId newCid : ContractId CCIP.SendingMessageV1.SendingMessageV1) - smCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 <- coerceContractId <$> exercise routerCid CCIP.PerPartyRouter.FinalizeFee with + smCid <- coerceContractId <$> exercise routerCid CCIP.ClientV1.PerPartyRouter_FinalizeFee with context - sendingMessageCid = coerceContractId smCid + sendingMessageCid = smCid smCid <- case (message.tokenTransfer, tokenTransferInput) of (None, None) -> pure smCid @@ -382,31 +377,30 @@ template CCIPSender (Some _, None) -> abort "sender: tokenTransferInput required for token transfer" (Some tt, Some tokenTransferInput) -> do - tokenConfigCid <- CCIP.TokenAdminRegistry.lookupTokenConfigCid context + tokenConfigCid <- CCIP.Utils.Context.getFromContextU context CCIP.API.TokenAdminRegistryV1.tokenConfigContextKey lockResult <- exercise tokenTransferInput.tokenPoolCid CCIP.Interfaces.TokenPool.TokenPool_LockOrBurn with - tokenAdminRegistryCid = coerceContractId tokenAdminRegistryCid - tokenConfigCid = coerceContractId tokenConfigCid - rmnRemoteCid = coerceContractId rmnRemoteCid + tokenAdminRegistryCid = tokenAdminRegistryCid + tokenConfigCid = tokenConfigCid + rmnRemoteCid = rmnRemoteCid extraContext = tokenTransferInput.poolExtraContext - sendingMessageCid = coerceContractId smCid + sendingMessageCid = smCid senderInputCids = tokenTransferInput.senderInputCids amount = tt.amount caller = owner pure (coerceContractId lockResult.sendingMessageCid) - smCid : ContractId CCIP.SendingMessageV1.SendingMessageV1 <- foldlA (\cid input -> do + smCid <- foldlA (\cid input -> do verifierArgs <- lookupVerifierArgs extraArgs.ccvs input.ccvAddress - newCid <- exercise input.ccvCid - ICCV.CrossChainVerifier_ForwardToVerifier with + exercise input.ccvCid + CCIP.Interfaces.CrossChainVerifier.CrossChainVerifier_ForwardToVerifier with rmnRemoteCid = coerceContractId rmnRemoteCid extraContext = input.ccvExtraContext sendingMessageCid = coerceContractId cid verifierArgs = verifierArgs caller = owner - pure (coerceContractId newCid) ) (smCid) ccvSendInputs - exercise routerCid CCIP.PerPartyRouter.CCIPSend with + exercise routerCid CCIP.ClientV1.PerPartyRouter_CCIPSend with context sendingMessageCid = coerceContractId smCid feeTokenHoldingCids = feeTokenInput.senderInputCids diff --git a/contracts/ccip/test/daml.yaml b/contracts/ccip/test/daml.yaml index 1a217a062..e4bb9303a 100644 --- a/contracts/ccip/test/daml.yaml +++ b/contracts/ccip/test/daml.yaml @@ -17,6 +17,7 @@ data-dependencies: - ../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/.daml/dist/ccip-client-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 9121d870c..2e57219bf 100644 --- a/contracts/ccip/test/daml/BurnMintTokenPoolTest.daml +++ b/contracts/ccip/test/daml/BurnMintTokenPoolTest.daml @@ -56,7 +56,7 @@ messageFinality n = unsafeDecodeRequestedFinality (rawFinalityConfig n) mkPoolContext : ContractId CCIP.RateLimiterV1.RateLimiter -> ContractId BurnMintV1.BurnMintFactory -> MetadataV1.ChoiceContext mkPoolContext rateLimiterCid burnMintFactoryCid = MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RateLimiterV1.rateLimiterKey, CCIP.Utils.Context.toAnyValue rateLimiterCid) + [ (CCIP.RateLimiterV1.rateLimiterContextKey, CCIP.Utils.Context.toAnyValue rateLimiterCid) , (BurnMintTokenPool.burnMintFactoryContextKey, CCIP.Utils.Context.toAnyValue burnMintFactoryCid) ] @@ -1487,7 +1487,7 @@ testBurnMintPoolRejectsMissingBurnMintFactory = script do rmnRemoteCid = toInterfaceContractId rmnRemoteCid extraContext = MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RateLimiterV1.rateLimiterKey, CCIP.Utils.Context.toAnyValue outboundRateLimiterCid) + [ (CCIP.RateLimiterV1.rateLimiterContextKey, CCIP.Utils.Context.toAnyValue outboundRateLimiterCid) ] sendingMessageCid = toInterfaceContractId sendingMessageCid senderInputCids = [senderHoldingCid] diff --git a/contracts/ccip/test/daml/CCIPSenderGetFee.daml b/contracts/ccip/test/daml/CCIPSenderGetFee.daml index c5142380f..f41de3e14 100644 --- a/contracts/ccip/test/daml/CCIPSenderGetFee.daml +++ b/contracts/ccip/test/daml/CCIPSenderGetFee.daml @@ -5,7 +5,7 @@ import Daml.Script import DA.Optional (fromSome) import qualified DA.TextMap as TextMap -import qualified CCIP.Client +import qualified CCIP.ClientV1 import qualified CCIP.CCIPSender import Chainlink.InstanceAddress qualified as RawInstanceAddress import qualified CommitteeVerifier.DummyCommitteeVerifier @@ -37,10 +37,10 @@ mkCCVSendInput ccvAddress verifierCid = 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 = "" ] @@ -87,7 +87,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 +106,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 +132,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 e0ffde3e0..069f15489 100644 --- a/contracts/ccip/test/daml/CCVMaxBounds.daml +++ b/contracts/ccip/test/daml/CCVMaxBounds.daml @@ -9,7 +9,14 @@ import DA.Optional import DA.Set qualified as Set import qualified DA.TextMap as TextMap -import qualified CCIP.Client +import Chainlink.InstanceAddress qualified as RawInstanceAddress + +import qualified CCIP.API.FeeQuoterV1 +import qualified CCIP.API.GlobalConfigV1 +import qualified CCIP.API.RMNRemoteV1 +import qualified CCIP.API.TokenAdminRegistryV1 + +import qualified CCIP.ClientV1 import qualified CCIP.ExecutingMessageV1 import qualified CCIP.FeeQuoter import qualified CCIP.FinalityConfig @@ -26,7 +33,6 @@ 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 @@ -40,9 +46,9 @@ mkRawCCVs : Text -> Party -> Int -> [RawInstanceAddress.RawInstanceAddress] mkRawCCVs prefix owner count = [ RawInstanceAddress.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 + [ CCIP.ClientV1.CCVExtraArg with ccvAddress = RawInstanceAddress.make (prefix <> show i) owner ccvArgs = "" | i <- [0..(count - 1)] @@ -59,11 +65,11 @@ mkFeeQuotes prefix owner count = | 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 = "" @@ -86,28 +92,28 @@ outboundContext : OutboundFixture -> MetadataV1.ChoiceContext outboundContext f = MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId f.rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId f.tokenAdminRegistry) + , (CCIP.API.FeeQuoterV1.feeQuoterContextKey, MetadataV1.AV_ContractId $ coerceContractId f.feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) + , (CCIP.OnRamp.onRampContextKey, 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 @@ -406,10 +412,10 @@ executeContext : ExecuteFixture -> MetadataV1.ChoiceContext executeContext f = MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId f.rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId f.tokenAdminRegistry) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) + , (CCIP.OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId f.offRamp) ] setupExecuteFixture : Text -> [RawInstanceAddress.RawInstanceAddress] -> Script ExecuteFixture diff --git a/contracts/ccip/test/daml/ExecutorExpectedExecutorTest.daml b/contracts/ccip/test/daml/ExecutorExpectedExecutorTest.daml index 2c33c34ba..87e042087 100644 --- a/contracts/ccip/test/daml/ExecutorExpectedExecutorTest.daml +++ b/contracts/ccip/test/daml/ExecutorExpectedExecutorTest.daml @@ -8,8 +8,11 @@ import DA.Optional (fromSome) import DA.Set qualified as Set import qualified DA.TextMap as TextMap +import qualified CCIP.API.FeeQuoterV1 +import qualified CCIP.API.GlobalConfigV1 + import qualified CCIP.CCIPSender -import qualified CCIP.Client +import qualified CCIP.ClientV1 import qualified CCIP.Executor import qualified CCIP.ExecutorTypes as CCIP.Executor import qualified CCIP.FeeQuoter @@ -50,22 +53,22 @@ feeContext : FeeFixture -> MetadataV1.ChoiceContext feeContext f = 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.API.FeeQuoterV1.feeQuoterContextKey, MetadataV1.AV_ContractId $ coerceContractId f.feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId f.globalConfig) + , (CCIP.OnRamp.onRampContextKey, 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 @@ -290,9 +293,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 +320,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) @@ -343,7 +346,7 @@ testRouterGetFeeRejectsMismatchedExecutorQuote = script do 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) @@ -367,7 +370,7 @@ testRouterGetFeeRequiresExplicitExecutorQuote = script do 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 e9b49af4d..6139ff36c 100644 --- a/contracts/ccip/test/daml/FeeQuoter.daml +++ b/contracts/ccip/test/daml/FeeQuoter.daml @@ -18,7 +18,7 @@ import Chainlink.InstanceAddress qualified as RawInstanceAddress import qualified CCIP.API.SendingMessageV1 import qualified CCIP.EventsV1.Receipts -import CCIP.Client qualified as Client +import CCIP.ClientV1 import CCIP.FeeQuoter import CCIP.FinalityConfig qualified as FinalityCodec import CCIP.GlobalConfig qualified as GlobalConfig @@ -1274,15 +1274,15 @@ testCalculateFeeResult_CCVRoundingMatchesFinalizeFee = script do 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 = diff --git a/contracts/ccip/test/daml/LockReleaseTokenPoolTest.daml b/contracts/ccip/test/daml/LockReleaseTokenPoolTest.daml index a0fb1882d..7e04d4cc5 100644 --- a/contracts/ccip/test/daml/LockReleaseTokenPoolTest.daml +++ b/contracts/ccip/test/daml/LockReleaseTokenPoolTest.daml @@ -81,7 +81,7 @@ mkPoolContext rateLimiterCid burnMintFactoryCid tokenPoolHoldings preapprovals = _ -> [(LockReleaseTokenPool.transferFactoryExtraArgsContextValuesContextKey, MetadataV1.AV_Map preapprovalMap)] in MetadataV1.ChoiceContext with values = TextMap.fromList ( - [ (CCIP.RateLimiterV1.rateLimiterKey, CCIP.Utils.Context.toAnyValue rateLimiterCid) + [ (CCIP.RateLimiterV1.rateLimiterContextKey, CCIP.Utils.Context.toAnyValue rateLimiterCid) , (LockReleaseTokenPool.transferFactoryContextKey, CCIP.Utils.Context.toAnyValue burnMintFactoryCid) , (LockReleaseTokenPool.tokenPoolHoldingsContextKey, CCIP.Utils.Context.toAnyValue tokenPoolHoldings) ] ++ extraArgsContextEntry) diff --git a/contracts/ccip/test/daml/OffRampExecute.daml b/contracts/ccip/test/daml/OffRampExecute.daml index 8994faf7c..d6fbd355f 100644 --- a/contracts/ccip/test/daml/OffRampExecute.daml +++ b/contracts/ccip/test/daml/OffRampExecute.daml @@ -14,6 +14,9 @@ import Splice.Api.Token.HoldingV1 qualified as HoldingV1 import Splice.Api.Token.MetadataV1 qualified as MetadataV1 import qualified CCIP.API.ExecutingMessageV1 +import qualified CCIP.API.GlobalConfigV1 +import qualified CCIP.API.RMNRemoteV1 +import qualified CCIP.API.TokenAdminRegistryV1 import qualified CCIP.CCVCodec @@ -216,10 +219,10 @@ testExecuteWithCCVVerification = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -244,10 +247,10 @@ testExecuteWithCCVVerification = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Verify SUCCESS @@ -405,11 +408,11 @@ testExecuteTokenOnlyIgnoresReceiverCCVs = script do exerciseCmd router PerPartyRouter.Execute with context = MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.TokenAdminRegistryV1.tokenConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenConfigCid) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp) ] executingMessageCid = executingMessageCid @@ -655,10 +658,10 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -683,10 +686,10 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Add CCV2 verification @@ -704,10 +707,10 @@ testExecuteWithDefaultCCVs_EmptyReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Verify SUCCESS @@ -835,10 +838,10 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -869,10 +872,10 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Add CCV2 verification @@ -888,10 +891,10 @@ testExecuteWithDefaultCCVs_SentinelUseDefaultCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Verify SUCCESS @@ -1021,10 +1024,10 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1038,10 +1041,10 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1071,10 +1074,10 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Add CCV3 verification @@ -1089,10 +1092,10 @@ testExecuteWithDefaultCCVs_OptionalReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid -- Verify SUCCESS @@ -1206,10 +1209,10 @@ testExecuteMessageOnlyRequiresReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1224,10 +1227,10 @@ testExecuteMessageOnlyRequiresReceiverCCVs = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid debug "testExecuteMessageOnlyRequiresReceiverCCVs: PASSED" @@ -1330,10 +1333,10 @@ testPrepareExecuteAllowsSafeFinalityConfig = script do _ <- 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1457,10 +1460,10 @@ testExecuteFailsMissingCCV = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1474,10 +1477,10 @@ testExecuteFailsMissingCCV = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid debug ("Execute fails with missing CCV: PASSED") @@ -1592,10 +1595,10 @@ testExecuteWrongReceiver = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver -- Providing receiver, but message.receiver is otherParty tokenReceiverParty = None @@ -1711,10 +1714,10 @@ testExecuteAllowsMultipleOnRamps = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -1735,10 +1738,10 @@ testExecuteAllowsMultipleOnRamps = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid executeResult.state === CCIP.API.ExecutingMessageV1.SUCCESS @@ -1846,10 +1849,10 @@ testExecuteRejectsUnconfiguredOnRamp = script do 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.RMNRemote.rmnRemoteContextKey, 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)] + values = TextMap.fromList [(CCIP.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (OffRamp.offRampContextKey, 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 e7e382648..12abe6245 100644 --- a/contracts/ccip/test/daml/PerPartyRouter.daml +++ b/contracts/ccip/test/daml/PerPartyRouter.daml @@ -17,8 +17,12 @@ import qualified Splice.Api.Token.MetadataV1 import qualified Splice.Api.Token.TransferInstructionV1 import qualified CCIP.API.ExecutingMessageV1 +import qualified CCIP.API.FeeQuoterV1 +import qualified CCIP.API.GlobalConfigV1 +import qualified CCIP.API.RMNRemoteV1 +import qualified CCIP.API.TokenAdminRegistryV1 -import qualified CCIP.Client +import qualified CCIP.ClientV1 import qualified CCIP.FinalityConfig import qualified CCIP.FeeQuoter import qualified CCIP.GlobalConfig @@ -94,11 +98,11 @@ 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 = "" @@ -106,12 +110,12 @@ extraArgsWithDefaultExecutor : Int -> ContractId CCIP.Interfaces.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 = "" @@ -121,12 +125,12 @@ extraArgsWithExecutor -> RawInstanceAddress.RawInstanceAddress -> ContractId CCIP.Interfaces.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 = "" @@ -367,14 +371,14 @@ testCCIPSendAllFeePayouts = script do exerciseCmd router CCIP.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.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 @@ -413,9 +417,9 @@ testCCIPSendAllFeePayouts = script do exerciseCmd router CCIP.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.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid @@ -452,10 +456,10 @@ testCCIPSendAllFeePayouts = script do exerciseCmd router CCIP.PerPartyRouter.CCIPSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid feeTokenHoldingCids = [toInterfaceContractId userHolding] @@ -470,10 +474,10 @@ testCCIPSendAllFeePayouts = script do exerciseCmd router CCIP.PerPartyRouter.CCIPSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid feeTokenHoldingCids = [toInterfaceContractId userHolding] @@ -690,13 +694,13 @@ testCCIPSend = script do sendingMessageCid <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do coerceContractId <$> exerciseCmd router CCIP.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.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 @@ -721,9 +725,9 @@ testCCIPSend = script do exerciseCmd router CCIP.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.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp) ] sendingMessageCid = sendingMessageCid @@ -733,10 +737,10 @@ testCCIPSend = script do 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 context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] sendingMessageCid = sendingMessageCid feeTokenHoldingCids = [] feeTokenConfigCid = feeTokenConfig @@ -760,13 +764,13 @@ testCCIPSend = script do sendingMessageCid2 <- submit (actAs user <> actAs ccipOwner <> disclose disclosedOnRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedFeeQuoter <> disclose disclosedRmnRemote) do coerceContractId <$> exerciseCmd newRouter CCIP.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.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 @@ -791,19 +795,19 @@ testCCIPSend = script do exerciseCmd newRouter CCIP.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.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.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 context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.OnRamp.onRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId onRamp)] sendingMessageCid = sendingMessageCid2 feeTokenHoldingCids = [] feeTokenConfigCid = feeTokenConfig @@ -937,10 +941,10 @@ testCCIPExecute = script do executingMessageCid <- submit (actAs receiver <> actAs ccipOwner <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do exerciseCmd router CCIP.PerPartyRouter.PrepareExecute with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] encodedMessage = encodedMessage receiverParty = receiver tokenReceiverParty = None @@ -962,10 +966,10 @@ testCCIPExecute = script do executeResult <- submit (actAs receiver <> actAs ccipOwner <> disclose disclosedOffRamp <> disclose disclosedGlobalConfig <> disclose disclosedTokenAdminRegistry <> disclose disclosedRmnRemote) do exerciseCmd router CCIP.PerPartyRouter.Execute with context = Splice.Api.Token.MetadataV1.ChoiceContext with - values = TextMap.fromList [(CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote), + (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry), + (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig), + (CCIP.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp)] executingMessageCid = executingMessageCid executeResult.state === CCIP.API.ExecutingMessageV1.SUCCESS @@ -1130,18 +1134,18 @@ testPrepareSendExtraArgs = script do let receiver = "b8a3d7a9c797b5bd47f8c5efd96dadecf15ddd3c" let context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.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 context destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = receiver payload = "01" tokenTransfer = None @@ -1157,18 +1161,18 @@ testPrepareSendExtraArgs = script do exerciseCmd router CCIP.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 + [CCIP.ClientV1.CCVExtraArg with ccvAddress = RawInstanceAddress.make "custom-ccv" user ccvArgs = ""] - executor = CCIP.Client.Executor_NoExecutor + executor = CCIP.ClientV1.Executor_NoExecutor tokenReceiver = "" tokenArgs = "" @@ -1177,10 +1181,10 @@ testPrepareSendExtraArgs = script do -- 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 @@ -1215,15 +1219,15 @@ testPrepareSendExtraArgs = script do exerciseCmd router CCIP.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 = "" @@ -1231,7 +1235,7 @@ testPrepareSendExtraArgs = script do exerciseCmd router CCIP.PerPartyRouter.PrepareSend with context destinationChainSelector = destChainSelector - message = CCIP.Client.Canton2AnyMessage with + message = CCIP.ClientV1.Canton2AnyMessage with receiver = "12345678" payload = "" tokenTransfer = None @@ -1370,14 +1374,14 @@ testPrepareSendRejectsOversizedPayload = script do exerciseCmd router CCIP.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.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 @@ -1445,24 +1449,28 @@ testGetExecutionStateUsesActiveAndArchivedMessages = script do activeState <- submit arbitraryCallerSubmission do exerciseCmd router CCIP.PerPartyRouter.GetExecutionState with messageHash = activeMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = arbitraryCaller activeState === CCIP.API.ExecutingMessageV1.SUCCESS newerArchiveState <- submit arbitraryCallerSubmission do exerciseCmd router CCIP.PerPartyRouter.GetExecutionState with messageHash = newerMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = arbitraryCaller newerArchiveState === CCIP.API.ExecutingMessageV1.SUCCESS olderArchiveState <- submit arbitraryCallerSubmission do exerciseCmd router CCIP.PerPartyRouter.GetExecutionState with messageHash = olderMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = arbitraryCaller olderArchiveState === CCIP.API.ExecutingMessageV1.SUCCESS missingState <- submit arbitraryCallerSubmission do exerciseCmd router CCIP.PerPartyRouter.GetExecutionState with messageHash = missingMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = arbitraryCaller missingState === CCIP.API.ExecutingMessageV1.UNTOUCHED @@ -1580,10 +1588,10 @@ testExecuteRollsOverExecutedMessages = script do exerciseCmd router CCIP.PerPartyRouter.PrepareExecute with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) ] encodedMessage = encodedMessage receiverParty = receiver @@ -1605,10 +1613,10 @@ testExecuteRollsOverExecutedMessages = script do exerciseCmd router CCIP.PerPartyRouter.Execute with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) ] executingMessageCid = executingMessageCid @@ -1642,18 +1650,21 @@ testExecuteRollsOverExecutedMessages = script do activeState <- submit receiver do exerciseCmd executeResult.router CCIP.PerPartyRouter.GetExecutionState with messageHash = executeResult.messageId + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = receiver activeState === CCIP.API.ExecutingMessageV1.SUCCESS seededState <- submit receiver do exerciseCmd executeResult.router CCIP.PerPartyRouter.GetExecutionState with messageHash = sampleSeededMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = receiver seededState === CCIP.API.ExecutingMessageV1.SUCCESS olderArchiveState <- submit receiver do exerciseCmd executeResult.router CCIP.PerPartyRouter.GetExecutionState with messageHash = olderArchivedMessage + context = Splice.Api.Token.MetadataV1.emptyChoiceContext caller = receiver olderArchiveState === CCIP.API.ExecutingMessageV1.SUCCESS @@ -1661,10 +1672,10 @@ testExecuteRollsOverExecutedMessages = script do exerciseCmd executeResult.router CCIP.PerPartyRouter.PrepareExecute with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.OffRamp.offRampContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId offRamp) ] encodedMessage = encodedMessage receiverParty = receiver @@ -1805,29 +1816,29 @@ testPrepareSendRejectsDuplicateSenderRequiredCCVs = script do exerciseCmd router CCIP.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.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 + [ CCIP.ClientV1.CCVExtraArg with ccvAddress = RawInstanceAddress.make "sender-ccv" ccipOwner ccvArgs = "" - , CCIP.Client.CCVExtraArg with + , CCIP.ClientV1.CCVExtraArg with ccvAddress = RawInstanceAddress.make "sender-ccv" ccipOwner ccvArgs = "" ] - executor = CCIP.Client.Executor_NoExecutor + executor = CCIP.ClientV1.Executor_NoExecutor tokenReceiver = "" tokenArgs = "" @@ -1961,14 +1972,14 @@ testPrepareSendRejectsSequenceNumberOverflow = script do exerciseCmd router CCIP.PerPartyRouter.PrepareSend with context = Splice.Api.Token.MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId rmnRemote) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId tokenAdminRegistry) + , (CCIP.API.FeeQuoterV1.feeQuoterContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId feeQuoter) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, Splice.Api.Token.MetadataV1.AV_ContractId $ coerceContractId globalConfig) + , (CCIP.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/ReceiveRequiredCCVs.daml b/contracts/ccip/test/daml/ReceiveRequiredCCVs.daml index c70d5891f..3e705683a 100644 --- a/contracts/ccip/test/daml/ReceiveRequiredCCVs.daml +++ b/contracts/ccip/test/daml/ReceiveRequiredCCVs.daml @@ -9,6 +9,10 @@ import DA.Optional (fromSome) import DA.Set qualified as Set import qualified DA.TextMap as TextMap +import qualified CCIP.API.GlobalConfigV1 +import qualified CCIP.API.RMNRemoteV1 +import qualified CCIP.API.TokenAdminRegistryV1 + import qualified CCIP.CCIPReceiver import qualified CCIP.FinalityConfig import qualified CCIP.GlobalConfig @@ -55,10 +59,10 @@ mkContext mkContext rmnRemoteCid tokenAdminRegistryCid globalConfigCid offRampCid = MetadataV1.ChoiceContext with values = TextMap.fromList - [ (CCIP.RMNRemote.rmnRemoteContextKey, 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.API.RMNRemoteV1.rmnRemoteContextKey, MetadataV1.AV_ContractId (coerceContractId rmnRemoteCid)) + , (CCIP.API.TokenAdminRegistryV1.tokenAdminRegistryContextKey, MetadataV1.AV_ContractId (coerceContractId tokenAdminRegistryCid)) + , (CCIP.API.GlobalConfigV1.globalConfigContextKey, MetadataV1.AV_ContractId (coerceContractId globalConfigCid)) + , (CCIP.OffRamp.offRampContextKey, MetadataV1.AV_ContractId (coerceContractId offRampCid)) ] testReceiverGetRequiredCCVsMatchesPrepareExecute : Script () @@ -175,7 +179,7 @@ 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 @@ -310,7 +314,7 @@ 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 diff --git a/contracts/contracts.go b/contracts/contracts.go index f887087b0..90109f486 100644 --- a/contracts/contracts.go +++ b/contracts/contracts.go @@ -32,6 +32,7 @@ const ( CCIPTickets = Package("ccip-tickets") CCIPEvents = Package("ccip-events") CCIPRateLimiter = Package("ccip-rate-limiter") + CCIPClient = Package("ccip-client") CCIPUtils = Package("ccip-utils") CCIPCore = Package("ccip-core") CCIPExtensionAPI = Package("ccip-extension-api") @@ -46,7 +47,6 @@ const ( CCIPFactory = Package("ccip-factory") CCIPTest = Package("ccip-test") - CCIPClient = CCIPCore CCIPCommon = CCIPCore CCIPFeeQuoter = CCIPCore CCIPTokenAdminRegistry = CCIPCore @@ -84,6 +84,7 @@ var Versions map[Package][]string = map[Package][]string{ CCIPTickets: []string{CurrentVersion}, CCIPEvents: []string{CurrentVersion}, CCIPRateLimiter: []string{CurrentVersion}, + CCIPClient: []string{CurrentVersion}, CCIPUtils: []string{CurrentVersion}, CCIPCore: []string{"2.0.0", CurrentVersion}, CCIPExtensionAPI: []string{"2.0.0", CurrentVersion}, @@ -153,6 +154,7 @@ var OutputDirs = map[Package][]string{ CCIPTickets: []string{"ccip", "tickets"}, CCIPEvents: []string{"ccip", "events"}, CCIPRateLimiter: []string{"ccip", "ratelimiter"}, + CCIPClient: []string{"ccip", "client"}, 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 index ad306da9f..848702925 100644 Binary files a/contracts/dars/current/ccip-api-current.dar 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 4fd916544..811bdafa4 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-current.dar b/contracts/dars/current/ccip-client-current.dar new file mode 100644 index 000000000..5af62dfce Binary files /dev/null and b/contracts/dars/current/ccip-client-current.dar differ diff --git a/contracts/dars/current/ccip-committee-verifier-current.dar b/contracts/dars/current/ccip-committee-verifier-current.dar index 308318239..4c140e1a8 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 ee3b1dfa3..455af503d 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 index 8ed77a930..bcd794547 100644 Binary files a/contracts/dars/current/ccip-events-current.dar 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 235513f48..faaa7f1af 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 a6dd29338..2f5dd7518 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 34781c882..3dbb45884 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 5b93bd00f..829bc95a8 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 index 643908d74..b6260aa86 100644 Binary files a/contracts/dars/current/ccip-rate-limiter-current.dar 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 eeb74f060..7a427a9d1 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 3cfbeda3d..007ebf305 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 028029d6f..08711ef14 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 117d74363..439d6d17c 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 index 329f5b6d5..546016124 100644 Binary files a/contracts/dars/current/ccip-tickets-current.dar and b/contracts/dars/current/ccip-tickets-current.dar differ diff --git a/contracts/multi-package.yaml b/contracts/multi-package.yaml index ab7de6af6..89ab2088a 100644 --- a/contracts/multi-package.yaml +++ b/contracts/multi-package.yaml @@ -12,6 +12,7 @@ packages: - mcms/test/globalconfig-v1-upgraded - ccip/api + - ccip/client - ccip/codec - ccip/core - ccip/extension-api diff --git a/eds/internal/api/ccip/ccip.go b/eds/internal/api/ccip/ccip.go index f02304854..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.RmnRemoteContextKey): { + 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.RmnRemoteContextKey): { + 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 5ba5d62f3..3470f0a1f 100644 --- a/eds/internal/api/ccip/ccip_test.go +++ b/eds/internal/api/ccip/ccip_test.go @@ -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()), @@ -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", @@ -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", @@ -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", diff --git a/eds/internal/api/ccip/parse.go b/eds/internal/api/ccip/parse.go index 70878d6a2..15489ca40 100644 --- a/eds/internal/api/ccip/parse.go +++ b/eds/internal/api/ccip/parse.go @@ -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) diff --git a/eds/internal/api/ccip/parse_test.go b/eds/internal/api/ccip/parse_test.go index a14e4c885..08e04127a 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, diff --git a/eds/internal/api/tokenpool/tokenpool.go b/eds/internal/api/tokenpool/tokenpool.go index e48f716bb..2b2eb770b 100644 --- a/eds/internal/api/tokenpool/tokenpool.go +++ b/eds/internal/api/tokenpool/tokenpool.go @@ -230,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(ratelimiter.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)}, }} @@ -343,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(ratelimiter.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 @@ -536,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(ratelimiter.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)}, }} @@ -646,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(ratelimiter.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/examples/cli/cmd/canton.go b/examples/cli/cmd/canton.go index 468307715..8bd7bb9d8 100644 --- a/examples/cli/cmd/canton.go +++ b/examples/cli/cmd/canton.go @@ -21,7 +21,7 @@ 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/client" "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" @@ -759,7 +759,7 @@ func cantonSend( var ( executorInput *sender.ExecutorInput executorDisclosures []*apiv2.DisclosedContract - executorExtraArg core.ExecutorExtraArg + executorExtraArg client.ExecutorExtraArg ) switch executorMode { case "default": @@ -776,25 +776,25 @@ func cantonSend( ExecutorExtraContext: splice_api_token_metadata_v1.ChoiceContext{}, } executorDisclosures = execDisc.DisclosedContracts - executorExtraArg = core.ExecutorExtraArg{ - ExecutorUseDefault: &core.ExecutorUseDefault{ExecutorArgs: ""}, + executorExtraArg = client.ExecutorExtraArg{ + ExecutorUseDefault: &client.ExecutorUseDefault{ExecutorArgs: ""}, } case "none": // No executor — message will not be auto-executed on the destination. executorInput = nil executorDisclosures = nil - executorExtraArg = core.ExecutorExtraArg{ + executorExtraArg = client.ExecutorExtraArg{ ExecutorNoExecutor: &types.UNIT{}, } } // --- Build sendArgs --- - canton2Any := core.Canton2AnyMessage{ + canton2Any := client.Canton2AnyMessage{ Receiver: types.TEXT(msg.Receiver), Payload: types.TEXT(msg.Payload), FeeToken: *feeTokenInstrumentId, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: client.ExtraArgs{ + V3: &client.GenericExtraArgsV3{ GasLimit: types.INT64(msg.GasLimit), Ccvs: nil, Executor: executorExtraArg, @@ -804,7 +804,7 @@ func cantonSend( }, } if withToken { - canton2Any.TokenTransfer = &core.TokenTransfer{ + canton2Any.TokenTransfer = &client.TokenTransfer{ Token: *linkInstrumentId, Amount: types.NUMERIC(msg.TokenTransfer.Amount), } diff --git a/integration-tests/ccip/ccip_send_test.go b/integration-tests/ccip/ccip_send_test.go index abb1afbd7..8e69e0fd5 100644 --- a/integration-tests/ccip/ccip_send_test.go +++ b/integration-tests/ccip/ccip_send_test.go @@ -37,6 +37,7 @@ import ( "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/client" "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" @@ -599,21 +600,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: client.Canton2AnyMessage{ Receiver: types.TEXT(receiverHex), Payload: types.TEXT(testPayloadHex), FeeToken: nativeInstrumentId, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: client.ExtraArgs{ + V3: &client.GenericExtraArgsV3{ GasLimit: 100_000, - Ccvs: []core.CCVExtraArg{ + Ccvs: []client.CCVExtraArg{ { CcvAddress: ccvRawAddr, CcvArgs: types.TEXT(""), }, }, - Executor: core.ExecutorExtraArg{ - ExecutorWithAddress: &core.ExecutorWithAddress{ + Executor: client.ExecutorExtraArg{ + ExecutorWithAddress: &client.ExecutorWithAddress{ ExecutorAddress: execMcmsAddr, ExecutorArgs: types.TEXT(""), }, 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 ce9a694a3..ced59a234 100644 --- a/integration-tests/ccip/ccip_send_with_token_bnm_test.go +++ b/integration-tests/ccip/ccip_send_with_token_bnm_test.go @@ -39,6 +39,7 @@ import ( "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/client" "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" @@ -863,25 +864,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: client.Canton2AnyMessage{ Receiver: types.TEXT(receiverHex), Payload: types.TEXT(testPayloadHex), - TokenTransfer: &core.TokenTransfer{ + TokenTransfer: &client.TokenTransfer{ Token: linkInstrumentId, Amount: types.NUMERIC(tokenTransferAmountDecimal), }, FeeToken: nativeInstrumentId, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: client.ExtraArgs{ + V3: &client.GenericExtraArgsV3{ GasLimit: 0, - Ccvs: []core.CCVExtraArg{ + Ccvs: []client.CCVExtraArg{ { CcvAddress: committeeVerifierAddress.Binding(), CcvArgs: types.TEXT(""), }, }, - Executor: core.ExecutorExtraArg{ - ExecutorWithAddress: &core.ExecutorWithAddress{ + Executor: client.ExecutorExtraArg{ + ExecutorWithAddress: &client.ExecutorWithAddress{ ExecutorAddress: executorAddress.Binding(), ExecutorArgs: types.TEXT(""), }, 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 a86066230..281feb11e 100644 --- a/integration-tests/ccip/ccip_send_with_token_lnr_test.go +++ b/integration-tests/ccip/ccip_send_with_token_lnr_test.go @@ -37,6 +37,7 @@ import ( "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/client" "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" @@ -810,25 +811,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: client.Canton2AnyMessage{ Receiver: types.TEXT(receiverHex), Payload: types.TEXT(testPayloadHex), - TokenTransfer: &core.TokenTransfer{ + TokenTransfer: &client.TokenTransfer{ Token: nativeInstrumentId, Amount: types.NUMERIC(tokenTransferAmountDecimal), }, FeeToken: nativeInstrumentId, - ExtraArgs: core.ExtraArgs{ - V3: &core.GenericExtraArgsV3{ + ExtraArgs: client.ExtraArgs{ + V3: &client.GenericExtraArgsV3{ GasLimit: 0, - Ccvs: []core.CCVExtraArg{ + Ccvs: []client.CCVExtraArg{ { CcvAddress: committeeVerifierAddress.Binding(), CcvArgs: types.TEXT(""), }, }, - Executor: core.ExecutorExtraArg{ - ExecutorWithAddress: &core.ExecutorWithAddress{ + Executor: client.ExecutorExtraArg{ + ExecutorWithAddress: &client.ExecutorWithAddress{ ExecutorAddress: executorAddress.Binding(), ExecutorArgs: types.TEXT(""), }, diff --git a/integration-tests/ccip/fee_quote_helpers_test.go b/integration-tests/ccip/fee_quote_helpers_test.go index b032b1c16..0e6e1398b 100644 --- a/integration-tests/ccip/fee_quote_helpers_test.go +++ b/integration-tests/ccip/fee_quote_helpers_test.go @@ -34,7 +34,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{ @@ -79,7 +79,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 {