Skip to content

Commit

Permalink
Add from-owner flag to generate Coreum transactions form contract own…
Browse files Browse the repository at this point in the history
…er. (#174)
  • Loading branch information
dzmitryhil authored Mar 4, 2024
1 parent d498e91 commit 0b38bad
Show file tree
Hide file tree
Showing 8 changed files with 378 additions and 67 deletions.
6 changes: 6 additions & 0 deletions relayer/client/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ type ContractClient interface {
config coreum.InstantiationConfig,
) (sdk.AccAddress, error)
GetContractConfig(ctx context.Context) (coreum.ContractConfig, error)
GetContractOwnership(ctx context.Context) (coreum.ContractOwnership, error)
RecoverTickets(
ctx context.Context,
sender sdk.AccAddress,
Expand Down Expand Up @@ -326,6 +327,11 @@ func (b *BridgeClient) GetContractConfig(ctx context.Context) (coreum.ContractCo
return b.contractClient.GetContractConfig(ctx)
}

// GetContractOwnership returns contract ownership.
func (b *BridgeClient) GetContractOwnership(ctx context.Context) (coreum.ContractOwnership, error) {
return b.contractClient.GetContractOwnership(ctx)
}

// RecoverTickets recovers tickets allocation.
func (b *BridgeClient) RecoverTickets(
ctx context.Context,
Expand Down
14 changes: 3 additions & 11 deletions relayer/cmd/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ const (
FlagMetricsListenAddr = "metrics-listen-addr"
// FlagProhibitedXRPLRecipient the prohibited XRPL recipient.
FlagProhibitedXRPLRecipient = "prohibited-xrpl-recipient"
// FlagFromOwner from owner flag.
FlagFromOwner = "from-owner"
)

// BridgeClient is bridge client used to interact with the chains and contract.
Expand All @@ -110,6 +112,7 @@ type BridgeClient interface {
cfg bridgeclient.BootstrappingConfig,
) (sdk.AccAddress, error)
GetContractConfig(ctx context.Context) (coreum.ContractConfig, error)
GetContractOwnership(ctx context.Context) (coreum.ContractOwnership, error)
RecoverTickets(
ctx context.Context,
ownerAddress sdk.AccAddress,
Expand Down Expand Up @@ -612,7 +615,6 @@ func GetHomeRunnerConfig(cmd *cobra.Command) (runner.Config, error) {
return runner.Config{}, err
}

cfg.Coreum.GenerateOnly = isGenerateOnly(cmd)
return cfg, nil
}

Expand Down Expand Up @@ -642,16 +644,6 @@ func getRelayerHome(cmd *cobra.Command) (string, error) {
return cmd.Flags().GetString(FlagHome)
}

func isGenerateOnly(cmd *cobra.Command) bool {
flagSet := cmd.Flags()
if flagSet.Changed(flags.FlagGenerateOnly) {
genOnly, _ := flagSet.GetBool(flags.FlagGenerateOnly)
return genOnly
}

return false
}

func addCoreumChainIDFlag(cmd *cobra.Command) *string {
return cmd.PersistentFlags().String(FlagCoreumChainID, string(runner.DefaultCoreumChainID), "Default coreum chain ID")
}
Expand Down
15 changes: 15 additions & 0 deletions relayer/cmd/cli/cli_mocks_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0b38bad

Please sign in to comment.