Skip to content

Commit 5e7dad2

Browse files
authored
add: liquid staking, distribution section, governance section (#184)
2 parents ee7cb34 + 59d6ba4 commit 5e7dad2

File tree

10 files changed

+848
-36
lines changed

10 files changed

+848
-36
lines changed
Lines changed: 83 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,88 @@
11
---
22
title: Liquid Staking
3-
description: Enter description
4-
updated: 2024-09-03
5-
authors: [0xstt]
3+
description: Learn about Liquid Staking and its role in the Avalanche ecosystem.
4+
updated: 2024-10-08
5+
authors: [owenwahlgren]
66
icon: Book
77
---
88

9-
TBD
9+
**Liquid Staking** is an innovative mechanism in blockchain networks that allows users to stake their tokens to secure the network while maintaining liquidity. In the Avalanche ecosystem, liquid staking enables participants to earn staking rewards without locking up their assets entirely, providing flexibility and additional opportunities for yield.
10+
11+
---
12+
13+
## Understanding Liquid Staking
14+
15+
In traditional staking, users lock up their tokens to support network operations like block validation and consensus. While staked, these tokens are illiquid and cannot be used for other purposes until the staking period ends. Liquid staking addresses this limitation by issuing **staking derivatives** or **liquid tokens** that represent the staked assets.
16+
17+
### How It Works
18+
19+
- **Stake Tokens**: Users stake their AVAX or other supported tokens through a liquid staking provider.
20+
- **Receive Liquid Tokens**: In return, they receive liquid tokens equivalent to their staked amount.
21+
- **Earn Rewards**: Users continue to earn staking rewards over time.
22+
- **Maintain Liquidity**: Liquid tokens can be traded, transferred, or used in decentralized finance (**DeFi**) applications.
23+
- **Redeem Staked Assets**: At any time, users can redeem their liquid tokens for the original staked assets, subject to network protocols.
24+
25+
---
26+
27+
## Benefits of Liquid Staking
28+
29+
### Enhanced Liquidity
30+
31+
- **Flexibility**: Users can participate in staking without sacrificing access to their assets.
32+
- **DeFi Integration**: Liquid tokens can be used in lending, borrowing, or yield farming platforms, maximizing potential returns.
33+
34+
### Increased Capital Efficiency
35+
36+
- **Dual Rewards**: Earn staking rewards and additional yields from DeFi activities simultaneously.
37+
- **Portfolio Diversification**: Utilize staked assets in various financial strategies without unstaking.
38+
39+
### Network Security
40+
41+
- **Higher Participation**: Lower barriers encourage more users to stake, enhancing network security and decentralization.
42+
- **Economic Incentives**: Aligns individual incentives with network health by rewarding active participation.
43+
44+
---
45+
46+
## Liquid Staking Providers on Avalanche
47+
48+
### Gogopool
49+
50+
[Gogopool](https://gogopool.com) is a prominent liquid staking provider in the Avalanche ecosystem. It offers a user-friendly platform for staking AVAX tokens while retaining liquidity through their liquid staking token.
51+
52+
#### Features of Gogopool
53+
54+
- **Secure Staking**: Utilizes robust smart contracts audited for security.
55+
- **Competitive Rewards**: Offers attractive staking yields.
56+
- **Easy Integration**: Provides seamless integration with popular DeFi platforms on Avalanche.
57+
- **Community Support**: Active support channels and resources for users.
58+
59+
---
60+
61+
## Considerations and Risks
62+
63+
While liquid staking offers numerous benefits, users should be aware of potential risks:
64+
65+
### Smart Contract Risk
66+
67+
- **Vulnerabilities**: Liquid staking relies on smart contracts that may have undiscovered bugs or vulnerabilities.
68+
- **Mitigation**: Choose providers like Gogopool that have undergone thorough security audits.
69+
70+
### Market Risk
71+
72+
- **Price Volatility**: The value of liquid tokens may fluctuate based on market conditions.
73+
- **Liquidity**: Ensure there is sufficient market liquidity to trade liquid tokens without significant slippage.
74+
75+
### Protocol Risk
76+
77+
- **Slashing Penalties**: In cases of validator misconduct, staked assets may be slashed, affecting the value of liquid tokens.
78+
- **Validator Selection**: Use reputable providers that delegate stakes to trustworthy validators.
79+
80+
---
81+
82+
## Conclusion
83+
84+
Liquid staking enhances the staking experience on Avalanche by combining the benefits of network participation with the flexibility of liquidity. Providers like [Gogopool](https://gogopool.com) make it accessible and secure for users to maximize their asset utility.
85+
86+
By understanding the mechanics and benefits of liquid staking, participants can make informed decisions that align with their investment strategies and contribute to the overall health and decentralization of the Avalanche network.
87+
88+
---
Lines changed: 91 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,96 @@
11
---
22
title: Vesting Schedules
3-
description: Enter description
4-
updated: 2024-09-03
5-
authors: [0xstt]
3+
description: Learn about vesting schedules and how to implement them in Solidity.
4+
updated: 2024-10-08
5+
authors: [owenwahlgren]
66
icon: Book
77
---
88

9-
TBD
9+
**Vesting schedules** are mechanisms used in blockchain projects to release tokens to team members, investors, or other stakeholders over a specified period. This approach helps align incentives, prevent immediate sell-offs, and promote long-term commitment to the project.
10+
11+
---
12+
13+
## Understanding Vesting Schedules
14+
15+
A vesting schedule dictates how and when tokens are released to a recipient. Common elements include:
16+
17+
- **Cliff Period**: An initial period during which no tokens are vested.
18+
- **Vesting Period**: The total duration over which tokens are gradually released.
19+
- **Release Interval**: The frequency at which tokens are released (e.g., monthly, quarterly).
20+
- **Total Allocation**: The total number of tokens to be vested.
21+
22+
### Types of Vesting Schedules
23+
24+
1. **Linear Vesting**: Tokens are released uniformly over the vesting period.
25+
2. **Graded Vesting**: Tokens vest in portions at different intervals.
26+
3. **Cliff Vesting**: All or a significant portion of tokens vest after the cliff period.
27+
28+
---
29+
30+
## Implementing Vesting Schedules in Solidity
31+
32+
Smart contracts can automate vesting schedules, ensuring transparency and trustlessness. Below is an example of a simple Solidity contract implementing a linear vesting schedule.
33+
34+
### Example Solidity Contract
35+
36+
```solidity
37+
// SPDX-License-Identifier: MIT
38+
pragma solidity ^0.8.0;
39+
40+
contract TokenVesting {
41+
address public beneficiary;
42+
uint256 public start;
43+
uint256 public duration;
44+
uint256 public cliff;
45+
uint256 public totalTokens;
46+
uint256 public released;
47+
48+
IERC20 public token;
49+
50+
constructor(
51+
address _token,
52+
address _beneficiary,
53+
uint256 _start,
54+
uint256 _cliffDuration,
55+
uint256 _duration,
56+
uint256 _totalTokens
57+
) {
58+
require(_beneficiary != address(0), "Invalid beneficiary");
59+
require(_cliffDuration <= _duration, "Cliff longer than duration");
60+
require(_duration > 0, "Duration must be > 0");
61+
62+
token = IERC20(_token);
63+
beneficiary = _beneficiary;
64+
start = _start;
65+
cliff = _start + _cliffDuration;
66+
duration = _duration;
67+
totalTokens = _totalTokens;
68+
}
69+
70+
function release() public {
71+
require(block.timestamp >= cliff, "Cliff period not reached");
72+
uint256 unreleased = releasableAmount();
73+
require(unreleased > 0, "No tokens to release");
74+
75+
released += unreleased;
76+
token.transfer(beneficiary, unreleased);
77+
}
78+
79+
function releasableAmount() public view returns (uint256) {
80+
return vestedAmount() - released;
81+
}
82+
83+
function vestedAmount() public view returns (uint256) {
84+
if (block.timestamp < cliff) {
85+
return 0;
86+
} else if (block.timestamp >= start + duration) {
87+
return totalTokens;
88+
} else {
89+
return (totalTokens * (block.timestamp - start)) / duration;
90+
}
91+
}
92+
}
93+
94+
interface IERC20 {
95+
function transfer(address recipient, uint256 amount) external returns (bool);
96+
}
Lines changed: 161 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,166 @@
11
---
22
title: Bonding Curves
3-
description: Enter description
4-
updated: 2024-09-03
5-
authors: [0xstt]
3+
description: Learn about bonding curves and their role in token economics.
4+
updated: 2024-10-08
5+
authors: [owenwahlgren]
66
icon: Book
77
---
88

9-
TBD
9+
**Bonding curves** are mathematical formulas used in blockchain and token economics to define the relationship between a token's price and its supply. They provide a mechanism for automated price discovery and liquidity, enabling decentralized issuance and trading of tokens without relying on traditional market makers or exchanges.
10+
11+
---
12+
13+
## Understanding Bonding Curves
14+
15+
A bonding curve is a continuous token model where the price of a token is determined by a predefined mathematical function based on the total supply in circulation. As more tokens are purchased and the supply increases, the price per token rises according to the curve. Conversely, selling tokens decreases the supply and lowers the price.
16+
17+
### Key Concepts
18+
19+
- **Automated Market Maker (AMM)**: A system that provides liquidity and facilitates trading by automatically adjusting prices based on supply and demand.
20+
- **Price Function**: A mathematical formula that defines how the token price changes with supply.
21+
- **Liquidity Pool**: A reserve of tokens used to facilitate buying and selling without requiring counterparties.
22+
23+
---
24+
25+
## How Bonding Curves Work
26+
27+
### Price Functions
28+
29+
The bonding curve relies on a price function `P(S)`, where:
30+
31+
- `P` is the price per token.
32+
- `S` is the current supply of tokens.
33+
34+
Common price functions include linear, exponential, and sigmoid curves.
35+
36+
#### Linear Bonding Curve
37+
38+
A simple linear function:
39+
40+
```
41+
P(S) = a * S + b
42+
```
43+
44+
- `a` and `b` are constants defining the slope and intercept.
45+
46+
#### Exponential Bonding Curve
47+
48+
An exponential function:
49+
50+
```
51+
P(S) = e^(k * S)
52+
```
53+
54+
- `e` is the base of the natural logarithm.
55+
- `k` is a constant determining the rate of price increase.
56+
57+
### Buying and Selling Tokens
58+
59+
- **Buying Tokens**: To purchase tokens, a user pays an amount calculated by integrating the price function over the desired increase in supply.
60+
- **Selling Tokens**: To sell tokens, a user receives an amount calculated by integrating the price function over the desired decrease in supply.
61+
62+
---
63+
64+
## Applications of Bonding Curves
65+
66+
### Token Launch Mechanisms
67+
68+
Bonding curves enable projects to launch tokens without initial liquidity or listing on exchanges.
69+
70+
- **Continuous Token Issuance**: Tokens can be minted on-demand as users buy them.
71+
- **Fair Price Discovery**: Prices adjust automatically based on demand.
72+
73+
### Decentralized Finance (DeFi)
74+
75+
Used in AMMs and liquidity pools to facilitate decentralized trading.
76+
77+
- **Uniswap**: Utilizes bonding curves for token swaps.
78+
- **Balancer**: Manages portfolios using bonding curves.
79+
80+
### Fundraising and DAOs
81+
82+
Facilitate fundraising by allowing investors to buy tokens that represent shares or voting rights.
83+
84+
- **Continuous Organizations**: Organizations that continuously raise funds through token sales governed by bonding curves.
85+
- **DAO Membership**: Tokens purchased via bonding curves grant access and voting power.
86+
87+
---
88+
89+
## Implementing Bonding Curves in Smart Contracts
90+
91+
### Solidity Example
92+
93+
Below is a simplified example of implementing a linear bonding curve in Solidity.
94+
95+
```solidity
96+
// SPDX-License-Identifier: MIT
97+
pragma solidity ^0.8.0;
98+
99+
contract BondingCurve {
100+
uint256 public totalSupply;
101+
uint256 public constant a = 1e18; // Slope
102+
uint256 public constant b = 1e18; // Intercept
103+
mapping(address => uint256) public balances;
104+
105+
function buy() external payable {
106+
uint256 tokensToMint = calculateTokensToMint(msg.value);
107+
balances[msg.sender] += tokensToMint;
108+
totalSupply += tokensToMint;
109+
}
110+
111+
function sell(uint256 tokenAmount) external {
112+
require(balances[msg.sender] >= tokenAmount, "Insufficient balance");
113+
uint256 ethToReturn = calculateEthToReturn(tokenAmount);
114+
balances[msg.sender] -= tokenAmount;
115+
totalSupply -= tokenAmount;
116+
payable(msg.sender).transfer(ethToReturn);
117+
}
118+
119+
function calculatePrice(uint256 supply) public pure returns (uint256) {
120+
return a * supply + b;
121+
}
122+
123+
function calculateTokensToMint(uint256 ethAmount) public view returns (uint256) {
124+
// Simplified calculation for demonstration purposes
125+
uint256 tokens = ethAmount / calculatePrice(totalSupply);
126+
return tokens;
127+
}
128+
129+
function calculateEthToReturn(uint256 tokenAmount) public view returns (uint256) {
130+
// Simplified calculation for demonstration purposes
131+
uint256 ethAmount = tokenAmount * calculatePrice(totalSupply);
132+
return ethAmount;
133+
}
134+
}
135+
```
136+
137+
Explanation
138+
139+
- **`buy()`:** Users send ETH to buy tokens. The number of tokens minted is calculated based on the bonding curve.
140+
- **`sell()`:** Users can sell their tokens back for ETH. The amount of ETH returned is calculated based on the current supply.
141+
- **`calculatePrice()`:** Determines the price per token based on the total supply.
142+
143+
<Callout>This is a simplified example and not suitable for production. Proper handling of floating-point arithmetic and security considerations is necessary.</Callout>
144+
145+
### Considerations and Risks
146+
147+
**Price Volatility**
148+
149+
- **Speculation**: Prices can become volatile due to speculative trading.
150+
- **Market Manipulation**: Large trades may influence prices significantly.
151+
152+
**Smart Contract Risks**
153+
154+
- **Security Vulnerabilities**: Bugs in the contract can lead to loss of funds.
155+
- **Complexity**: Implementing accurate bonding curves requires careful mathematical and technical design.
156+
157+
**Liquidity Concerns**
158+
159+
- **Slippage**: Large trades may experience significant price slippage.
160+
- **Liquidity Pools**: Adequate reserves are necessary to handle buy and sell orders.
161+
162+
## Conclusion
163+
164+
Bonding curves offer a powerful tool for automated price discovery and token issuance in decentralized networks like Avalanche. They enable projects to create self-sustaining economies with built-in liquidity and dynamic pricing. Understanding bonding curves is essential for developers and stakeholders involved in tokenomics and decentralized finance.
165+
166+
By carefully designing bonding curve parameters and smart contracts, projects can align incentives, promote fair participation, and foster sustainable growth within their ecosystems.

0 commit comments

Comments
 (0)