-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(x/feeshare): Allow registering factory contracts (#566)
* Allow factory contracts to self register without bindings * cleanup factory logic * improve readability of isFactoryContract * Add register & update docs
- Loading branch information
1 parent
70b3033
commit 8d11c10
Showing
8 changed files
with
122 additions
and
7 deletions.
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
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,31 @@ | ||
# Register a contract | ||
|
||
`junod tx feeshare register [contract_bech32] [withdraw_bech32] --from [key]` | ||
|
||
Registers the withdrawal address for the given contract. | ||
|
||
## Parameters | ||
|
||
`contract_bech32 (string, required)`: The bech32 address of the contract whose interaction fees will be shared. | ||
|
||
`withdraw_bech32 (string, required)`: The bech32 address where the interaction fees will be sent every block. | ||
|
||
## Description | ||
|
||
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. | ||
|
||
## Permissions | ||
|
||
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. | ||
|
||
## Exceptions | ||
|
||
```text | ||
withdraw_bech32 can not be the community pool (distribution) address. This is a limitation of the way the SDK handles this module account | ||
``` | ||
|
||
```text | ||
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. | ||
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 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,11 @@ | ||
# Update a Contract's Withdrawal Address | ||
|
||
This can be changed at any time so long as you are still the admin or creator of a contract with the command: | ||
|
||
`junod tx feeshare update [contract] [new_withdraw_address]` | ||
|
||
## Update Exception | ||
|
||
```text | ||
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. | ||
``` |
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