Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions deployment/changesets/cs_deploy_tp_and_configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,29 @@ func (d DeployTPAndConfigure) Apply(e cldf.Environment, config DeployTPAndConfig
SuiRPC: suiChain.URL,
}

fastMcmsPackageID := state[config.SuiChainSelector].FastCurseMCMSPackageID
if fastMcmsPackageID == "" {
return cldf.ChangesetOutput{}, fmt.Errorf(
"fast MCMS package not deployed for Sui chain %d; run DeploySuiChain first",
config.SuiChainSelector,
)
}

// Populate state information for each token pool type
for _, tokenPoolType := range config.TokenPoolTypes {
switch tokenPoolType {
case deployment.TokenPoolTypeBurnMint:
config.BurnMintTpInput.CCIPPackageId = state[config.SuiChainSelector].CCIPAddress
config.BurnMintTpInput.MCMSAddress = state[config.SuiChainSelector].MCMSPackageID
config.BurnMintTpInput.FastMcmsAddress = fastMcmsPackageID
// TODO: MCMSOwner address should come state
config.BurnMintTpInput.MCMSOwnerAddress = deployerAddr
config.BurnMintTpInput.CCIPObjectRefObjectId = state[config.SuiChainSelector].CCIPObjectRef
config.BurnMintTpInput.TokenPoolAdministrator = deployerAddr
case deployment.TokenPoolTypeLockRelease:
config.LockReleaseTPInput.CCIPPackageId = state[config.SuiChainSelector].CCIPAddress
config.LockReleaseTPInput.MCMSAddress = state[config.SuiChainSelector].MCMSPackageID
config.LockReleaseTPInput.FastMcmsAddress = fastMcmsPackageID
config.LockReleaseTPInput.MCMSOwnerAddress = deployerAddr
config.LockReleaseTPInput.CCIPObjectRefObjectId = state[config.SuiChainSelector].CCIPObjectRef
config.LockReleaseTPInput.TokenPoolAdministrator = deployerAddr
Expand All @@ -89,6 +99,7 @@ func (d DeployTPAndConfigure) Apply(e cldf.Environment, config DeployTPAndConfig
config.ManagedTPInput.CCIPPackageId = state[config.SuiChainSelector].CCIPAddress
config.ManagedTPInput.ManagedTokenPackageId = managedTokenState.PackageID
config.ManagedTPInput.MCMSAddress = state[config.SuiChainSelector].MCMSPackageID
config.ManagedTPInput.FastMcmsAddress = fastMcmsPackageID
config.ManagedTPInput.MCMSOwnerAddress = deployerAddr
config.ManagedTPInput.CCIPObjectRefObjectId = state[config.SuiChainSelector].CCIPObjectRef
config.ManagedTPInput.TokenPoolAdministrator = deployerAddr
Expand Down Expand Up @@ -204,5 +215,15 @@ func (d DeployTPAndConfigure) Apply(e cldf.Environment, config DeployTPAndConfig

// VerifyPreconditions implements deployment.ChangeSetV2.
func (d DeployTPAndConfigure) VerifyPreconditions(e cldf.Environment, config DeployTPAndConfigureConfig) error {
state, err := deployment.LoadOnchainStatesui(e)
if err != nil {
return err
}
if state[config.SuiChainSelector].FastCurseMCMSPackageID == "" {
return fmt.Errorf(
"fast MCMS package not deployed for Sui chain %d; run DeploySuiChain first",
config.SuiChainSelector,
)
}
return nil
}
Comment on lines 217 to 229
Loading