Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Introduction
description: ...
updated: 2025-08-21
authors: [nicolasarnedo]
icon: Book
---

bla bla
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Introduction
description: ...
updated: 2025-08-21
authors: [nicolasarnedo]
icon: Book
---

bla bla
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Introduction
description: ...
updated: 2025-08-21
authors: [nicolasarnedo]
icon: Book
---

bla bla
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
title: Introduction
description: ...
updated: 2025-08-21
authors: [nicolasarnedo]
icon: Book
---

bla bla
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Initial Allocation
description: Considerations for the initial token allocation on an Avalanche L1
updated: 2024-09-03
authors: [0xstt]
icon: Book
---

The creator of an Avalanche L1 can pre-allocate native tokens during the chain genesis event. This **initial token allocation** refers to the distribution of tokens or digital assets when a new blockchain network is launched, which is a crucial aspect of the network's design.

> **Note:** Initial token allocation determines how tokens are distributed among stakeholders and participants.
### Key Considerations for Initial Token Allocation

There are several factors to consider when allocating tokens:

#### Founders and Development Team

A portion of the initial token supply is often allocated to the founders and the development team as a reward for their efforts in creating the blockchain protocol. This serves as an incentive for continued development and network maintenance.

#### Early Investors and Backers

Another portion of the token supply may be allocated to early investors and backers who provided funding or support during the project's early stages. These entities take on early risk and are rewarded with tokens that may increase in value as the network grows.

#### Community

A significant portion of tokens may be allocated to the community through mechanisms such as token sales, airdrops, or other distribution methods. This ensures widespread ownership and participation in the network, fostering decentralization and security.

#### Reserve

Some tokens may be allocated to a reserve or treasury to fund ongoing development, marketing, and ecosystem growth initiatives. This reserve can be managed by a DAO or another entity tasked with allocating funds for the network's benefit.

> **Tip:** Transparent and equitable token allocation mechanisms are essential for fostering trust and confidence in the network among its stakeholders.
<Quiz quizId="212" />
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
---
title: Vesting Schedules
description: Learn about vesting schedules and how to implement them in Solidity.
updated: 2024-10-08
authors: [owenwahlgren]
icon: Book
---

**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.

---

## Understanding Vesting Schedules

A vesting schedule dictates how and when tokens are released to a recipient. Common elements include:

- **Cliff Period**: An initial period during which no tokens are vested.
- **Vesting Period**: The total duration over which tokens are gradually released.
- **Release Interval**: The frequency at which tokens are released (e.g., monthly, quarterly).
- **Total Allocation**: The total number of tokens to be vested.

### Types of Vesting Schedules

1. **Linear Vesting**: Tokens are released uniformly over the vesting period.
2. **Graded Vesting**: Tokens vest in portions at different intervals.
3. **Cliff Vesting**: All or a significant portion of tokens vest after the cliff period.

---

## Implementing Vesting Schedules in Solidity

Smart contracts can automate vesting schedules, ensuring transparency and trustlessness. Below is an example of a simple Solidity contract implementing a linear vesting schedule.

### Example Solidity Contract

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract TokenVesting {
address public beneficiary;
uint256 public start;
uint256 public duration;
uint256 public cliff;
uint256 public totalTokens;
uint256 public released;
IERC20 public token;
constructor(
address _token,
address _beneficiary,
uint256 _start,
uint256 _cliffDuration,
uint256 _duration,
uint256 _totalTokens
) {
require(_beneficiary != address(0), "Invalid beneficiary");
require(_cliffDuration <= _duration, "Cliff longer than duration");
require(_duration > 0, "Duration must be > 0");
token = IERC20(_token);
beneficiary = _beneficiary;
start = _start;
cliff = _start + _cliffDuration;
duration = _duration;
totalTokens = _totalTokens;
}
function release() public {
require(block.timestamp >= cliff, "Cliff period not reached");
uint256 unreleased = releasableAmount();
require(unreleased > 0, "No tokens to release");
released += unreleased;
token.transfer(beneficiary, unreleased);
}
function releasableAmount() public view returns (uint256) {
return vestedAmount() - released;
}
function vestedAmount() public view returns (uint256) {
if (block.timestamp < cliff) {
return 0;
} else if (block.timestamp >= start + duration) {
return totalTokens;
} else {
return (totalTokens * (block.timestamp - start)) / duration;
}
}
}
interface IERC20 {
function transfer(address recipient, uint256 amount) external returns (bool);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
---
title: Bonding Curves
description: Learn about bonding curves and their role in token economics.
updated: 2024-10-08
authors: [owenwahlgren]
icon: Book
---

**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.

---

## Understanding Bonding Curves

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.

### Key Concepts

- **Automated Market Maker (AMM)**: A system that provides liquidity and facilitates trading by automatically adjusting prices based on supply and demand.
- **Price Function**: A mathematical formula that defines how the token price changes with supply.
- **Liquidity Pool**: A reserve of tokens used to facilitate buying and selling without requiring counterparties.

---

## How Bonding Curves Work

### Price Functions

The bonding curve relies on a price function `P(S)`, where:

- `P` is the price per token.
- `S` is the current supply of tokens.

Common price functions include linear, exponential, and sigmoid curves.

#### Linear Bonding Curve

A simple linear function:

```
P(S) = a * S + b
```

- `a` and `b` are constants defining the slope and intercept.

#### Exponential Bonding Curve

An exponential function:

```
P(S) = e^(k * S)
```

- `e` is the base of the natural logarithm.
- `k` is a constant determining the rate of price increase.

### Buying and Selling Tokens

- **Buying Tokens**: To purchase tokens, a user pays an amount calculated by integrating the price function over the desired increase in supply.
- **Selling Tokens**: To sell tokens, a user receives an amount calculated by integrating the price function over the desired decrease in supply.

---

## Applications of Bonding Curves

### Token Launch Mechanisms

Bonding curves enable projects to launch tokens without initial liquidity or listing on exchanges.

- **Continuous Token Issuance**: Tokens can be minted on-demand as users buy them.
- **Fair Price Discovery**: Prices adjust automatically based on demand.

### Decentralized Finance (DeFi)

Used in AMMs and liquidity pools to facilitate decentralized trading.

- **Uniswap**: Utilizes bonding curves for token swaps.
- **Balancer**: Manages portfolios using bonding curves.

### Fundraising and DAOs

Facilitate fundraising by allowing investors to buy tokens that represent shares or voting rights.

- **Continuous Organizations**: Organizations that continuously raise funds through token sales governed by bonding curves.
- **DAO Membership**: Tokens purchased via bonding curves grant access and voting power.

---

## Implementing Bonding Curves in Smart Contracts

### Solidity Example

Below is a simplified example of implementing a linear bonding curve in Solidity.

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract BondingCurve {
uint256 public totalSupply;
uint256 public constant a = 1e18; // Slope
uint256 public constant b = 1e18; // Intercept
mapping(address => uint256) public balances;
function buy() external payable {
uint256 tokensToMint = calculateTokensToMint(msg.value);
balances[msg.sender] += tokensToMint;
totalSupply += tokensToMint;
}
function sell(uint256 tokenAmount) external {
require(balances[msg.sender] >= tokenAmount, "Insufficient balance");
uint256 ethToReturn = calculateEthToReturn(tokenAmount);
balances[msg.sender] -= tokenAmount;
totalSupply -= tokenAmount;
payable(msg.sender).transfer(ethToReturn);
}
function calculatePrice(uint256 supply) public pure returns (uint256) {
return a * supply + b;
}
function calculateTokensToMint(uint256 ethAmount) public view returns (uint256) {
// Simplified calculation for demonstration purposes
uint256 tokens = ethAmount / calculatePrice(totalSupply);
return tokens;
}
function calculateEthToReturn(uint256 tokenAmount) public view returns (uint256) {
// Simplified calculation for demonstration purposes
uint256 ethAmount = tokenAmount * calculatePrice(totalSupply);
return ethAmount;
}
}
```

Explanation

- **`buy()`:** Users send ETH to buy tokens. The number of tokens minted is calculated based on the bonding curve.
- **`sell()`:** Users can sell their tokens back for ETH. The amount of ETH returned is calculated based on the current supply.
- **`calculatePrice()`:** Determines the price per token based on the total supply.

<Callout>This is a simplified example and not suitable for production. Proper handling of floating-point arithmetic and security considerations is necessary.</Callout>

### Considerations and Risks

**Price Volatility**

- **Speculation**: Prices can become volatile due to speculative trading.
- **Market Manipulation**: Large trades may influence prices significantly.

**Smart Contract Risks**

- **Security Vulnerabilities**: Bugs in the contract can lead to loss of funds.
- **Complexity**: Implementing accurate bonding curves requires careful mathematical and technical design.

**Liquidity Concerns**

- **Slippage**: Large trades may experience significant price slippage.
- **Liquidity Pools**: Adequate reserves are necessary to handle buy and sell orders.

## Conclusion

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.

By carefully designing bonding curve parameters and smart contracts, projects can align incentives, promote fair participation, and foster sustainable growth within their ecosystems.
<Quiz quizId="213"/>
Loading