Skip to content

Commit

Permalink
Fix (#1612)
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan-Ethernal authored Jun 13, 2023
1 parent 10f0b3f commit d9b8aae
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions helper/predeployment/predeployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,24 +185,29 @@ func GenerateGenesisAccountFromFile(
return nil, fmt.Errorf("unable to create contract ABI, %w", err)
}

// Constructor arguments are passed in as an array of values.
// Structs are treated as sub-arrays with their corresponding values laid out
// in ABI encoding
parsedArguments, err := ParseArguments(constructorArgs)
if err != nil {
return nil, err
}
finalBytecode := artifact.Bytecode
constructorInfo := contractABI.Constructor

if constructorInfo != nil {
// Constructor arguments are passed in as an array of values.
// Structs are treated as sub-arrays with their corresponding values laid out
// in ABI encoding
parsedArguments, err := ParseArguments(constructorArgs)
if err != nil {
return nil, err
}

// Encode the constructor params
constructor, err := abi.Encode(
parsedArguments,
contractABI.Constructor.Inputs,
)
if err != nil {
return nil, fmt.Errorf("unable to encode constructor arguments, %w", err)
}
// Encode the constructor params
constructor, err := abi.Encode(
parsedArguments,
contractABI.Constructor.Inputs,
)
if err != nil {
return nil, fmt.Errorf("unable to encode constructor arguments, %w", err)
}

finalBytecode := append(artifact.Bytecode, constructor...)
finalBytecode = append(artifact.Bytecode, constructor...)
}

return getPredeployAccount(predeployAddress, finalBytecode, artifact.DeployedBytecode)
}

0 comments on commit d9b8aae

Please sign in to comment.