-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: implement paymaster * fix: fix proto file * fix: fix e2e tests * fix: fix the e2e test and add log * fix: fix e2e test case * feat: add unit tests * fix: fix the comments * fix some corner cases * fix comments * fix comments * update query api * fix the comment * fix comments * add more unit tests * fix the test cases and rebase code * fix the lint errors * fix lint errors * generate swagger * update buf version * fix e2e tests * register new message * fix comments * update swagger * delete unused code * update swagger file * resolve confilcts and comments
- Loading branch information
Showing
30 changed files
with
4,699 additions
and
621 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
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package cli | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
|
||
sdkmath "cosmossdk.io/math" | ||
"github.com/cosmos/cosmos-sdk/client" | ||
"github.com/cosmos/cosmos-sdk/client/flags" | ||
"github.com/cosmos/cosmos-sdk/client/tx" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/spf13/cobra" | ||
|
||
"github.com/bnb-chain/greenfield/x/storage/types" | ||
) | ||
|
||
var _ = strconv.Itoa(0) | ||
|
||
func CmdSetBucketFlowRateLimit() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "set-bucket-flow-rate-limit [bucket-name] [payment-account] [bucket-owner] [flow-rate-limit]", | ||
Short: "set flow rate limit for a bucket", | ||
Args: cobra.ExactArgs(4), | ||
RunE: func(cmd *cobra.Command, args []string) (err error) { | ||
argBucketName := args[0] | ||
argPaymentAcc := args[1] | ||
paymentAcc, err := sdk.AccAddressFromHexUnsafe(argPaymentAcc) | ||
if err != nil { | ||
return err | ||
} | ||
argBucketOwner := args[2] | ||
bucketOwner, err := sdk.AccAddressFromHexUnsafe(argBucketOwner) | ||
if err != nil { | ||
return err | ||
} | ||
argFlowRateLimit, ok := sdkmath.NewIntFromString(args[3]) | ||
if !ok { | ||
return fmt.Errorf("invalid flow-rate-limit: %s", args[3]) | ||
} | ||
|
||
clientCtx, err := client.GetClientTxContext(cmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
msg := types.NewMsgSetBucketFlowRateLimit( | ||
clientCtx.GetFromAddress(), | ||
bucketOwner, | ||
paymentAcc, | ||
argBucketName, | ||
argFlowRateLimit, | ||
) | ||
if err = msg.ValidateBasic(); err != nil { | ||
return err | ||
} | ||
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) | ||
}, | ||
} | ||
|
||
flags.AddTxFlagsToCmd(cmd) | ||
|
||
return cmd | ||
} |
Oops, something went wrong.