forked from 0xSplits/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6c15dfb
commit cafa5cd
Showing
6 changed files
with
164 additions
and
1 deletion.
There are no files selected for viewing
File renamed without changes.
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
{ | ||
"gas-estimates": "Gas Estimates", | ||
"subgraph": "Subgraph", | ||
"alternative-solutions": "Alternative Solutions", | ||
"test-coverage": "Test Coverage" | ||
} |
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,4 @@ | ||
{ | ||
"overview": "Overview", | ||
"vesting": "Vesting" | ||
} |
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,65 @@ | ||
# Modules | ||
|
||
Modules are smart contracts that extend the functionality of the protocol. They | ||
exist independently of 0xSplits, and operate either above or below the protocol. | ||
|
||
Above the protocol modules execute logic _before_ tokens are sent to the split. | ||
This means tokens must be sent to the module directly instead of the split. For | ||
example, a vesting module vests tokens _before_ sending the vested portion to a | ||
split. Tokens get sent to the vesting module, and from the vesting module to the | ||
split. | ||
|
||
Below the protocol modules execute logic _after_ tokens have been sent to a | ||
split. For example, an NFT pointer module allows split recipients to change | ||
based on NFT ownership. In this case, tokens are still sent to the split's | ||
address—the logic only impacts how tokens are distributed within the split. | ||
|
||
``` | ||
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ | ||
│ "Above the Protocol" │ | ||
Logic happens here, before | ||
│ tokens are sent to the split │ | ||
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ | ||
│ | ||
│ | ||
▼ | ||
┌─────────────────────────────────────────────┐ | ||
│ │ | ||
│ SPLIT SMART CONTRACT │ | ||
│ │ | ||
└─────────────────────────────────────────────┘ | ||
│ | ||
│ | ||
▼ | ||
┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ | ||
│ "Below the Protocol" │ | ||
Logic happens here, after tokens | ||
│ are received by the split │ | ||
└ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ | ||
``` | ||
|
||
Most of these modules work independently of each other and can be combined to | ||
match the specific workflow you have in mind. For example, vesting tokens to a | ||
liquid split may be a great way to discourage quick flipping NFTs. | ||
|
||
### Building Modules | ||
|
||
Creating modules is permissionless since they exist independently of the | ||
protocol itself. They're made possible due to the protocol's composability in | ||
three key areas: | ||
|
||
1. Receiving tokens: each split is a payable smart contract that can receive | ||
funds from any other account via `send`, `transfer`, or `call`. | ||
2. Distributing tokens: each recipient can be an EOA or smart contract for which | ||
third parties may execute withdrawals. | ||
3. Modifying recipients: the controller of a mutable split can also be an EOA or | ||
smart contract with custom logic. | ||
|
||
All of the modules highlighted here have been suggestions from the community. | ||
We'd love to see what modules you create, so please drop us a note in the | ||
`#dev-support` channel in Discord to discuss integrating your modules into the | ||
app. |
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,93 @@ | ||
# Vesting Module | ||
|
||
The Vesting Module allows multiple, isolated streams of different tokens to be | ||
vested to a beneficiary over a set period of time. All streams within a vesting | ||
module share a vesting period, but each stream may begin vesting or release | ||
tokens independently. | ||
|
||
## How It Works | ||
|
||
- Each vesting module has a payable address to which ETH and ERC20 tokens can be | ||
sent. | ||
- Tokens sent to the vesting module are held until a vesting stream for a | ||
specific token is started. Streams are token-specific, and multiple streams | ||
may occur simultaneously. | ||
- Once a stream has begun, the vested portion can be transferred from the | ||
vesting contract to the beneficiary. | ||
|
||
``` | ||
EXTERNAL ACCOUNT/SMART CONTRACT | ||
│ | ||
│ | ||
▼ | ||
Vesting Module────────────────────────────────┐ | ||
│ │ | ||
│ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ | ||
│ │ | ||
│ │ ┌─────────┐ ┌─────────┐ │ │ | ||
│ │ Pending │────────────▶│ Vested │ │ | ||
│ │ └─────────┘ └─────────┘ │ │ | ||
│ │ | ||
│ └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ │ | ||
│ │ | ||
└─────────────────────────────────────────────┘ | ||
│ | ||
0xSplits───────────────┼──────────────────────┐ | ||
│ │ │ | ||
│ ▼ │ | ||
│ ┌─────────────────────────┐ │ | ||
│ │ Split Contract Mutable │ │ | ||
│ └─────────────────────────┘ │ | ||
│ │ │ | ||
│ │ │ ┌──────────┐ | ||
│ ┌───────────┼───────────┐ │ │Controller│ | ||
│ │ │ │ │ └──────────┘ | ||
│ ┌ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ┐ │ ● | ||
│ ▼ ▼ ▼ │ │ | ||
│ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ Controller | ||
│ │Recipient│ │Recipient│ │Recipient│ ●─┼──can change | ||
│ │ └─────────┘ └─────────┘ └─────────┘ │ │ recipients | ||
│ │ │ │ │ | ||
│ └ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ┘ │ | ||
│ │ │ │ │ | ||
└──────────┼───────────┼───────────┼──────────┘ | ||
│ │ │ | ||
▼ ▼ ▼ | ||
EOA/SC EOA/SC EOA/SC | ||
``` | ||
|
||
## How To Use | ||
|
||
1. Navigate to an existing split's detail page and hit "New Vesting Module" | ||
within the Address section. | ||
2. A form will appear with the beneficiary's address pre-filled to the current | ||
split's address. Enter the vesting period (in days) and approve the | ||
transaction. | ||
3. Once the transaction has been confirmed, you'll see the vesting module listed | ||
in the Address section under "Vesting Modules" on the split detail page. | ||
4. Click on the vesting module's address and send tokens to it like you would a | ||
split. | ||
5. Tokens received by the vesting module are held in a "Pending" section until a | ||
stream has begun. Each token will have it's own unique stream, however, | ||
multiple deposits can occur before a stream begins. You may wish to wait | ||
until a ~meaningful balance accrues before starting the stream. | ||
6. Once a stream has begun and tokens have vested, select the streams to release | ||
and click "Release Streams". Once the transaction is confirmed, the vested | ||
tokens will be sent to the split (the beneficiary). | ||
7. From here you can interact with the split as you normally would. You can | ||
navigate to the split's detail page and select the balance(s) to distribute | ||
to the recipients, or wait for the system to do that automatically (assuming | ||
a distributor fee has been set). | ||
|
||
## Notes | ||
|
||
- This module is designed to be used in conjunction with a mutable Split. You | ||
may use it with an immutable split, however, vesting tokens to an immutable | ||
split is equivalent to sending all tokens in one lump sum. | ||
- This module is immutable. Once it's been created, it cannot be changed. | ||
- Multiple vesting modules can point to the same beneficiary, however, each | ||
vesting module must be unique. No two vesting modules can have identical | ||
beneficiaries _and_ vesting periods. |