Skip to content

Commit

Permalink
Merge pull request #1719 from onflow/supun/clean-up
Browse files Browse the repository at this point in the history
Remove unused function
  • Loading branch information
SupunS authored Aug 30, 2024
2 parents 716b706 + a21e9f7 commit 3297571
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions internal/migrate/migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,8 @@
package migrate

import (
"fmt"

"github.com/cenkalti/backoff/v4"
"github.com/onflow/cadence"
"github.com/onflow/flow-go-sdk"
"github.com/onflow/flowkit/v2"
"github.com/onflow/flowkit/v2/project"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -58,38 +53,6 @@ func MigrationContractStagingAddress(network string) flow.Address {
return flow.HexToAddress(migrationContractStagingAddress[network])
}

// replaceImportsIfExists replaces imports in the given contract file with the actual contract code
func replaceImportsIfExists(state *flowkit.State, flow flowkit.Services, location string) ([]byte, error) {
code, err := state.ReadFile(location)
if err != nil {
return nil, fmt.Errorf("error loading contract file: %w", err)
}

contracts, err := state.DeploymentContractsByNetwork(flow.Network())
if err != nil {
return nil, err
}

importReplacer := project.NewImportReplacer(
contracts,
state.AliasesForNetwork(flow.Network()),
)

program, err := project.NewProgram(code, []cadence.Value{}, location)
if err != nil {
return nil, err
}

if program.HasImports() {
program, err = importReplacer.Replace(program)
if err != nil {
return nil, err
}
}

return program.Code(), nil
}

func withRetry(operation func() error) error {
return backoff.Retry(
operation,
Expand Down

0 comments on commit 3297571

Please sign in to comment.