-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
626 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package lilypad | ||
|
||
import ( | ||
"github.com/lilypad-tech/lilypad/pkg/collectpowsubmission" | ||
"github.com/lilypad-tech/lilypad/pkg/options" | ||
optionsfactory "github.com/lilypad-tech/lilypad/pkg/options" | ||
"github.com/lilypad-tech/lilypad/pkg/system" | ||
"github.com/lilypad-tech/lilypad/pkg/web3" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func newCollectionPowSubmissionCmd() *cobra.Command { | ||
options := optionsfactory.NewCollectPowSubmissionOptions() | ||
|
||
powSignalCmd := &cobra.Command{ | ||
Use: "collection-pow-submission", | ||
Short: "Collect pow submission data to database.", | ||
Long: "Collect pow submission data to database.", | ||
Example: "", | ||
RunE: func(cmd *cobra.Command, _ []string) error { | ||
network, _ := cmd.Flags().GetString("network") | ||
|
||
options, err := optionsfactory.ProcessCollectPowSubmissionOptions(options, network) | ||
if err != nil { | ||
return err | ||
} | ||
return runCollectionPowSubmission(cmd, options) | ||
}, | ||
} | ||
|
||
optionsfactory.AddCollectPowSubmissionCliFlags(powSignalCmd, &options) | ||
|
||
return powSignalCmd | ||
} | ||
|
||
func runCollectionPowSubmission(cmd *cobra.Command, options options.CollectPowSubmissionOptions) error { | ||
commandCtx := system.NewCommandContext(cmd) | ||
defer commandCtx.Cleanup() | ||
|
||
web3SDK, err := web3.NewContractSDK(options.Web3) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
err = collectpowsubmission.StartCollectPowSubmission(commandCtx.Ctx, web3SDK, options.PGConnectionString, commandCtx.Cm) | ||
if err != nil { | ||
return err | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.