-
Notifications
You must be signed in to change notification settings - Fork 174
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
[v18] FeeShare: Allow authz exec to count towards feeshare payouts #833
Conversation
@@ -62,29 +63,63 @@ type FeeSharePayoutEventOutput struct { | |||
FeesPaid sdk.Coins `json:"fees_paid"` | |||
} | |||
|
|||
func addNewFeeSharePayoutsForMsg(ctx sdk.Context, fsk FeeShareKeeper, toPay *[]sdk.AccAddress, m sdk.Msg) error { | |||
if msg, ok := m.(*wasmtypes.MsgExecuteContract); ok { |
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.
If the message contains another authz.MsgExec
this logic doesn't work. You should add additional case for authz.MsgExec
, and if it contains another authz.MsgExec
message, call the function recursively.
validAuthz := func(execMsg *authz.MsgExec) error { | ||
for _, v := range execMsg.Msgs { | ||
var innerMsg sdk.Msg | ||
if err := json.Unmarshal(v.Value, &innerMsg); err != nil { |
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.
I think this is always going to fail. You should use SDK codec to correctly unmarshal any type to an interface.
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.
To add on to what aleem is saying, It turns out authz.MsgExec has a built in function called "GetMessages()" which returns an arrray of sdk.Msg. Way easier than looping through and trying to unmarshal.
Thanks to Aleem from Vitwit for pointing this out :)
summary
Allows feeshare authz executes to pay the wasm contract its % of feeshare rewards.
(Reuses logic from past decorator in v14.0.0)