Skip to content

Commit

Permalink
respect hardhat deploy paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Malcador committed May 14, 2021
1 parent 77c65e0 commit e1ad496
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions hardhat/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type HardhatConfig struct {
Networks map[string]providers.NetworkConfig `json:"networks"`
Solidity HardhatSolidity `json:"solidity"`
ConfigType string `json:"-"`
Paths providers.Paths `json:"paths"`
}

type HardhatSolidity struct {
Expand Down Expand Up @@ -121,6 +122,7 @@ func (dp *DeploymentProvider) GetConfig(configName string, projectDir string) (*
"solc": hardhatConfig.Solidity.Compilers[0],
},
ConfigType: hardhatConfig.ConfigType,
Paths: hardhatConfig.Paths,
}, nil
}

Expand Down
15 changes: 14 additions & 1 deletion providers/deployment_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ type Config struct {
Solc map[string]Optimizer `json:"solc"`
Compilers map[string]Compiler `json:"compilers"`
ConfigType string `json:"-"`
Paths Paths `json:"paths"`
}

type OZProjectData struct {
Expand All @@ -52,7 +53,11 @@ func (c *Config) AbsoluteBuildDirectoryPath() string {
}

if c.ConfigType == BuidlerConfigFile || c.ConfigType == HardhatConfigFile || c.ConfigType == HardhatConfigFileTs {
c.BuildDirectory = filepath.Join(".", "deployments")
if c.Paths.Deployments != "" {
c.BuildDirectory = c.Paths.Deployments
} else {
c.BuildDirectory = filepath.Join(".", "deployments")
}
}

switch c.BuildDirectory[0] {
Expand All @@ -63,6 +68,14 @@ func (c *Config) AbsoluteBuildDirectoryPath() string {
}
}

type Paths struct {
Sources string `json:"sources,omitempty"`
Tests string `json:"tests,omitempty"`
Cache string `json:"cache,omitempty"`
Artifacts string `json:"artifacts,omitempty"`
Deployments string `json:"deployments,omitempty"`
}

type NetworkConfig struct {
Host string `json:"host"`
Port int `json:"port"`
Expand Down

0 comments on commit e1ad496

Please sign in to comment.