dao-contracts
dao-contracts copied to clipboard
Add a withdraw method to `cw20-stake-external-rewards`
Currently it is possible for the contract to get into a weird state if a cw20 Transfer
method (as opposed to a Send
) is used to fund the contract. This happens because the funds present will be greater than the funds expected and thus this contract will distribute rewards longer than the rewards duration.
If someone gets into this state having a Withdraw {}
method which the owner can call which withdraws all of the contract's funds will help mitigate the harm caused by something like this.
This method should likely query it's balance (see: reward_token
field on Config
) and then return that many tokens to the owner. It should only be callable by the owner.
Would also be nice to consider adding methods that let the owner / manager enable or disable the contract. Methods like that are good for stopping the world to investigate things.