-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement paymaster #582
Merged
Merged
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9c0f613
feat: implement paymaster
yutianwu f156bb6
fix: fix proto file
yutianwu b78303e
fix: fix e2e tests
yutianwu 77e9958
fix: fix the e2e test and add log
yutianwu 7679d13
fix: fix e2e test case
yutianwu c382c1f
feat: add unit tests
yutianwu b0b0078
fix: fix the comments
yutianwu 80c2106
fix some corner cases
yutianwu 41e8849
fix comments
yutianwu 7c2f1be
fix comments
yutianwu 2d1f1e5
update query api
yutianwu 7e058e7
fix the comment
yutianwu 9793f07
fix comments
yutianwu 7403760
add more unit tests
yutianwu 37dedff
fix the test cases and rebase code
yutianwu 8ab015e
fix the lint errors
yutianwu 9de8188
fix lint errors
yutianwu 35d606d
generate swagger
yutianwu f530497
update buf version
yutianwu 26e6e18
fix e2e tests
yutianwu 7a26b5b
register new message
yutianwu 2a6d55c
fix comments
yutianwu 030f432
update swagger
yutianwu 21ab011
delete unused code
yutianwu be42384
update swagger file
yutianwu c181af2
resolve confilcts and comments
yutianwu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BucketFlowRateLimit
is justInt
. Why we need this instead of usingInt
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add another fields