Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/go_modules/github.com/onflow/fl…
Browse files Browse the repository at this point in the history
…ow-evm-gateway-0.22.3
  • Loading branch information
chasefleming authored Jul 15, 2024
2 parents 61e8b92 + 214dce9 commit 21c25e2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
37 changes: 24 additions & 13 deletions internal/dependencymanager/dependencyinstaller.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,12 @@ func (di *DependencyInstaller) processDependency(dependency config.Dependency) e
}

func (di *DependencyInstaller) fetchDependencies(networkName string, address flowsdk.Address, assignedName, contractName string) error {
sourceString := fmt.Sprintf("%s://%s.%s", networkName, address.String(), contractName)

if _, exists := di.dependencies[sourceString]; exists {
return nil // Skip already processed dependencies
}

err := di.addDependency(config.Dependency{
Name: assignedName,
Source: config.Source{
Expand Down Expand Up @@ -502,24 +508,29 @@ func (di *DependencyInstaller) updateDependencyDeployment(contractName string) e
}

func (di *DependencyInstaller) updateDependencyAlias(contractName, aliasNetwork string) error {
var missingNetwork string
var missingNetworks []string

if aliasNetwork == config.TestnetNetwork.Name {
missingNetwork = config.MainnetNetwork.Name
} else {
missingNetwork = config.TestnetNetwork.Name
switch aliasNetwork {
case config.MainnetNetwork.Name:
missingNetworks = []string{config.TestnetNetwork.Name, config.PreviewnetNetwork.Name}
case config.TestnetNetwork.Name:
missingNetworks = []string{config.MainnetNetwork.Name, config.PreviewnetNetwork.Name}
case config.PreviewnetNetwork.Name:
missingNetworks = []string{config.MainnetNetwork.Name, config.TestnetNetwork.Name}
}

label := fmt.Sprintf("Enter an alias address for %s on %s if you have one, otherwise leave blank", contractName, missingNetwork)
raw := prompt.AddressPromptOrEmpty(label, "Invalid alias address")
for _, missingNetwork := range missingNetworks {
label := fmt.Sprintf("Enter an alias address for %s on %s if you have one, otherwise leave blank", contractName, missingNetwork)
raw := prompt.AddressPromptOrEmpty(label, "Invalid alias address")

if raw != "" {
contract, err := di.State.Contracts().ByName(contractName)
if err != nil {
return err
}
if raw != "" {
contract, err := di.State.Contracts().ByName(contractName)
if err != nil {
return err
}

contract.Aliases.Add(missingNetwork, flowsdk.HexToAddress(raw))
contract.Aliases.Add(missingNetwork, flowsdk.HexToAddress(raw))
}
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions internal/super/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ func startInteractiveSetup(

func installCoreContracts(logger output.Logger, state *flowkit.State, tempDir string) error {
// Prompt to ask which core contracts should be installed
sc := systemcontracts.SystemContractsForChain(flowGo.Mainnet)
sc := systemcontracts.SystemContractsForChain(flowGo.Previewnet)
promptMessage := "Select any core contracts you would like to install or skip to continue."

contractNames := make([]string, 0)
Expand All @@ -294,7 +294,7 @@ func installCoreContracts(logger output.Logger, state *flowkit.State, tempDir st
dependencies = append(dependencies, flowkitConfig.Dependency{
Name: contract.Name,
Source: flowkitConfig.Source{
NetworkName: flowkitConfig.MainnetNetwork.Name,
NetworkName: flowkitConfig.PreviewnetNetwork.Name,
Address: flowsdk.HexToAddress(contract.Address.String()),
ContractName: contract.Name,
},
Expand Down

0 comments on commit 21c25e2

Please sign in to comment.