A smart contract cannot withdraw delegation rewards on behalf of another account. With the introduction of authz, it should be possible to achieve this.


After chatting in the Telegram during HackWasm 2022, it seems that the WithdrawDelegatorReward Message would need to be modified, or a new message type added. Currently, the message looks like this:

Note the part about the delegator_address automatically using the contract address. It seems that this assumption might need to be changed.

I am not well-versed in what's below the smart contract stack, but searching through GitHub I did find this:

I wonder if that's where the contract address gets added as the delegator_address, though I'm not positive why it would be under wasmd since I thought that was a daemon/chain.


After chatting with @webmaster128 about this offline, it might not be tenable to change this particular message as it'd be quite backwards incompatible. Perhaps an addition of a new message type makes sense if we're going to allow for the flexibility that authz offers.

Will change the issue name accordingly.


According to this needs to be wrapped in a MsgExec anyways. So there is nothing we can do about the existing WithdrawDelegatorReward that would help.

Maybe we should offer MsgExec natively though. Then you only have to build the inner message yourself.


MsgExec from a contract would make sense. 👍 I don't have a concrete use case but I can imagine that support for authz.Grant can be nice, too where the contract is the granter.

© 2022 - All rights reserved.