You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Anyone is allowed to register a contract to itself if it was created from a factory contract
111
+
ifmsg.WithdrawerAddress!=msg.ContractAddress {
112
+
returnnil, sdkerrors.Wrapf(types.ErrFeeShareInvalidWithdrawer, "withdrawer address must be the same as the contract address if it is from a factory contract withdraw:%s contract:%s", msg.WithdrawerAddress, msg.ContractAddress)
113
+
}
114
+
115
+
// set the deployer address to the contract address so it can self register
Registers the withdrawal address for the given contract.
6
+
7
+
## Parameters
8
+
9
+
`contract_bech32 (string, required)`: The bech32 address of the contract whose interaction fees will be shared.
10
+
11
+
`withdraw_bech32 (string, required)`: The bech32 address where the interaction fees will be sent every block.
12
+
13
+
## Description
14
+
15
+
This command registers the withdrawal address for the given contract. Any time a user interacts with your contract, the funds will be sent to the withdrawal address. It can be any valid address, such as a DAO, normal account, another contract, or a multi-sig.
16
+
17
+
## Permissions
18
+
19
+
This command can only be run by the admin of the contract. If there is no admin, then it can only be run by the contract creator.
20
+
21
+
## Exceptions
22
+
23
+
```text
24
+
withdraw_bech32 can not be the community pool (distribution) address. This is a limitation of the way the SDK handles this module account
25
+
```
26
+
27
+
```text
28
+
For contracts created or administered by a contract factory, the withdrawal address can only be the same as the contract address. This can be registered by anyone, but it's unchangeable. This is helpful for SubDAOs or public goods to save fees in the treasury.
29
+
30
+
If you create a contract like this, it's best to create an execution method for withdrawing fees to an account. To do this, you'll need to save the withdrawal address in the contract's state before uploading a non-migratable contract.
This can not be done if the contract was created from or is administered by another contract (a contract factory). There is not currently a way for a contract to change its own withdrawal address directly.
0 commit comments