@@ -61,21 +61,29 @@ func (d DeployTPAndConfigure) Apply(e cldf.Environment, config DeployTPAndConfig
6161 SuiRPC : suiChain .URL ,
6262 }
6363
64+ fastMcmsPackageID := state [config .SuiChainSelector ].FastCurseMCMSPackageID
65+ if fastMcmsPackageID == "" {
66+ return cldf.ChangesetOutput {}, fmt .Errorf (
67+ "fast MCMS package not deployed for Sui chain %d; run DeploySuiChain first" ,
68+ config .SuiChainSelector ,
69+ )
70+ }
71+
6472 // Populate state information for each token pool type
6573 for _ , tokenPoolType := range config .TokenPoolTypes {
6674 switch tokenPoolType {
6775 case deployment .TokenPoolTypeBurnMint :
6876 config .BurnMintTpInput .CCIPPackageId = state [config .SuiChainSelector ].CCIPAddress
6977 config .BurnMintTpInput .MCMSAddress = state [config .SuiChainSelector ].MCMSPackageID
70- config .BurnMintTpInput .FastMcmsAddress = state [ config . SuiChainSelector ]. FastCurseMCMSPackageID
78+ config .BurnMintTpInput .FastMcmsAddress = fastMcmsPackageID
7179 // TODO: MCMSOwner address should come state
7280 config .BurnMintTpInput .MCMSOwnerAddress = deployerAddr
7381 config .BurnMintTpInput .CCIPObjectRefObjectId = state [config .SuiChainSelector ].CCIPObjectRef
7482 config .BurnMintTpInput .TokenPoolAdministrator = deployerAddr
7583 case deployment .TokenPoolTypeLockRelease :
7684 config .LockReleaseTPInput .CCIPPackageId = state [config .SuiChainSelector ].CCIPAddress
7785 config .LockReleaseTPInput .MCMSAddress = state [config .SuiChainSelector ].MCMSPackageID
78- config .LockReleaseTPInput .FastMcmsAddress = state [ config . SuiChainSelector ]. FastCurseMCMSPackageID
86+ config .LockReleaseTPInput .FastMcmsAddress = fastMcmsPackageID
7987 config .LockReleaseTPInput .MCMSOwnerAddress = deployerAddr
8088 config .LockReleaseTPInput .CCIPObjectRefObjectId = state [config .SuiChainSelector ].CCIPObjectRef
8189 config .LockReleaseTPInput .TokenPoolAdministrator = deployerAddr
@@ -91,7 +99,7 @@ func (d DeployTPAndConfigure) Apply(e cldf.Environment, config DeployTPAndConfig
9199 config .ManagedTPInput .CCIPPackageId = state [config .SuiChainSelector ].CCIPAddress
92100 config .ManagedTPInput .ManagedTokenPackageId = managedTokenState .PackageID
93101 config .ManagedTPInput .MCMSAddress = state [config .SuiChainSelector ].MCMSPackageID
94- config .ManagedTPInput .FastMcmsAddress = state [ config . SuiChainSelector ]. FastCurseMCMSPackageID
102+ config .ManagedTPInput .FastMcmsAddress = fastMcmsPackageID
95103 config .ManagedTPInput .MCMSOwnerAddress = deployerAddr
96104 config .ManagedTPInput .CCIPObjectRefObjectId = state [config .SuiChainSelector ].CCIPObjectRef
97105 config .ManagedTPInput .TokenPoolAdministrator = deployerAddr
@@ -207,5 +215,15 @@ func (d DeployTPAndConfigure) Apply(e cldf.Environment, config DeployTPAndConfig
207215
208216// VerifyPreconditions implements deployment.ChangeSetV2.
209217func (d DeployTPAndConfigure ) VerifyPreconditions (e cldf.Environment , config DeployTPAndConfigureConfig ) error {
218+ state , err := deployment .LoadOnchainStatesui (e )
219+ if err != nil {
220+ return err
221+ }
222+ if state [config .SuiChainSelector ].FastCurseMCMSPackageID == "" {
223+ return fmt .Errorf (
224+ "fast MCMS package not deployed for Sui chain %d; run DeploySuiChain first" ,
225+ config .SuiChainSelector ,
226+ )
227+ }
210228 return nil
211229}
0 commit comments