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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "vendors/yellow"]
path = vendors/yellow
url = git@github.com:layer-3/yellow.git
6 changes: 3 additions & 3 deletions docs/api-reference/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
sidebar_position: 9
title: API Reference
description: Complete Yellow SDK method documentation with examples and type definitions
keywords: [api reference, methods, types, nitrolite client, documentation]
keywords: [api reference, methods, types, virtualapp client, documentation]
displayed_sidebar: apiSidebar
---

# API Reference

Complete reference for all Yellow SDK methods, types, and utilities.

## NitroliteRPC Functions
## VirtualAppRPC Functions

### Message Creation

Expand Down Expand Up @@ -260,4 +260,4 @@ const SESSION_STATUS = {
};
```

This API reference provides everything you need to integrate NitroliteRPC into your applications with confidence and precision.
This API reference provides everything you need to integrate VirtualAppRPC into your applications with confidence and precision.
2 changes: 1 addition & 1 deletion docs/build/quick-start/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ sidebar_position: 2
sidebar_label: Quick Start
title: Quick Start
description: Build your first Yellow App in 5 minutes - a complete beginner's guide
keywords: [yellow sdk, quick start, tutorial, nitrolite, state channels, beginner guide]
keywords: [yellow sdk, quick start, tutorial, virtualapp, state channels, beginner guide]
displayed_sidebar: buildSidebar
---

Expand Down
44 changes: 44 additions & 0 deletions docs/contracts/addresses.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
title: "Deployed Addresses"
description: "Mainnet and testnet contract addresses for Yellow Network."
sidebar_position: 2
displayed_sidebar: contractsSidebar
---

# Deployed Addresses

## Ethereum Mainnet (Chain ID: 1)

| Contract | Address |
|---|---|
| YellowToken | [`0x236eB848C95b231299B4AA9f56c73D6893462720`](https://etherscan.io/address/0x236eB848C95b231299B4AA9f56c73D6893462720) |
| NodeRegistry | — |
| AppRegistry | — |
| YellowGovernor | — |
| TimelockController | — |
| Treasury | — |
| Faucet | — |

## Sepolia Testnet (Chain ID: 11155111)

| Contract | Address |
|---|---|
| YellowToken | [`0x236eB848C95b231299B4AA9f56c73D6893462720`](https://sepolia.etherscan.io/address/0x236eB848C95b231299B4AA9f56c73D6893462720) |
| NodeRegistry | — |
| AppRegistry | — |
| YellowGovernor | — |
| TimelockController | — |
| Treasury | — |
| Faucet | [`0x914abaDC0e36e03f29e4F1516951125c774dBAc8`](https://sepolia.etherscan.io/address/0x914abaDC0e36e03f29e4F1516951125c774dBAc8) |

## Using in Code

```ts
import { addresses } from "@yellow-org/contracts";

// Mainnet
addresses[1].yellowToken

// Sepolia
addresses[11155111].faucet
```
9 changes: 9 additions & 0 deletions docs/contracts/api-reference/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"label": "Contract API Reference",
"position": 4,
"link": {
"type": "generated-index"
},
"collapsible": false,
"collapsed": false
}
114 changes: 114 additions & 0 deletions docs/contracts/api-reference/app-registry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
---
title: "AppRegistry"
description: "App builder registry with slashing."
sidebar_position: 4
displayed_sidebar: contractsSidebar
---

# AppRegistry
[Git Source](https://github.com/layer-3/yellow/blob/f97fcc52ddfdc5918cb91b2af5538abb0060ee27/src/AppRegistry.sol)

**Inherits:**
[Locker](/src/Locker.sol/abstract.Locker.md), [ISlash](/src/interfaces/ISlash.sol/interface.ISlash.md), AccessControl

**Title:**
AppRegistry

Registry for app builders who post YELLOW as a service quality guarantee.
Authorised adjudicators can slash a participant's balance as penalty for misbehaviour.

Access control:
- `DEFAULT_ADMIN_ROLE` is held by the TimelockController (parameter administration) and
can grant or revoke `ADJUDICATOR_ROLE` to multiple addresses.
- `ADJUDICATOR_ROLE` holders can call `slash`.
No collateral weight for parameter administration — this registry is purely for
collateral management and slashing. See NodeRegistry for the parameter-administration-enabled
variant used by node operators.
Slashing can occur in both Locked and Unlocking states.


## State Variables
### ADJUDICATOR_ROLE

```solidity
bytes32 public constant ADJUDICATOR_ROLE = keccak256("ADJUDICATOR_ROLE")
```


### slashCooldown
Minimum time (seconds) that must elapse between any two slash calls.


```solidity
uint256 public slashCooldown
```


### lastSlashTimestamp
Timestamp of the last successful slash.


```solidity
uint256 public lastSlashTimestamp
```


## Functions
### constructor


```solidity
constructor(address asset_, uint256 unlockPeriod_, address admin_) Locker(asset_, unlockPeriod_);
```

### setSlashCooldown

Sets the global cooldown between slash calls.


```solidity
function setSlashCooldown(uint256 newCooldown) external onlyRole(DEFAULT_ADMIN_ROLE);
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`newCooldown`|`uint256`|The new cooldown in seconds (0 disables the cooldown).|


### slash

Reduces a user's locked balance and transfers the slashed tokens
to the specified recipient. Callable only by an authorised adjudicator.


```solidity
function slash(address user, uint256 amount, address recipient, bytes calldata decision)
external
onlyRole(ADJUDICATOR_ROLE)
nonReentrant;
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`user`|`address`| The user to slash.|
|`amount`|`uint256`| The amount of tokens to slash.|
|`recipient`|`address`|The address that receives the slashed tokens (cannot be the caller).|
|`decision`|`bytes`| Off-chain reference to the dispute decision.|


## Events
### SlashCooldownUpdated

```solidity
event SlashCooldownUpdated(uint256 oldCooldown, uint256 newCooldown);
```

## Errors
### SlashCooldownActive

```solidity
error SlashCooldownActive(uint256 availableAt);
```

168 changes: 168 additions & 0 deletions docs/contracts/api-reference/faucet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
---
title: "Faucet"
description: "Testnet token faucet."
sidebar_position: 7
displayed_sidebar: contractsSidebar
---

# Faucet
[Git Source](https://github.com/layer-3/yellow/blob/f97fcc52ddfdc5918cb91b2af5538abb0060ee27/src/Faucet.sol)

**Title:**
Faucet — YELLOW testnet token faucet

Dispenses a fixed amount of YELLOW per call with a per-address cooldown.


## State Variables
### TOKEN

```solidity
IERC20 public immutable TOKEN
```


### owner

```solidity
address public owner
```


### dripAmount

```solidity
uint256 public dripAmount
```


### cooldown

```solidity
uint256 public cooldown
```


### lastDrip

```solidity
mapping(address => uint256) public lastDrip
```


## Functions
### onlyOwner


```solidity
modifier onlyOwner() ;
```

### _onlyOwner


```solidity
function _onlyOwner() internal view;
```

### constructor


```solidity
constructor(IERC20 _token, uint256 _dripAmount, uint256 _cooldown) ;
```
**Parameters**

|Name|Type|Description|
|----|----|-----------|
|`_token`|`IERC20`| YELLOW token address|
|`_dripAmount`|`uint256`|Amount dispensed per drip (in wei)|
|`_cooldown`|`uint256`| Seconds between drips per address|


### drip

Drip YELLOW to msg.sender.


```solidity
function drip() external;
```

### dripTo

Drip YELLOW to a specified address (for batch use).


```solidity
function dripTo(address recipient) external;
```

### _dripTo


```solidity
function _dripTo(address recipient) internal;
```

### setDripAmount

Owner can update the drip amount.


```solidity
function setDripAmount(uint256 _dripAmount) external onlyOwner;
```

### setCooldown

Owner can update the cooldown period.


```solidity
function setCooldown(uint256 _cooldown) external onlyOwner;
```

### setOwner

Owner can transfer ownership.


```solidity
function setOwner(address _owner) external onlyOwner;
```

### withdraw

Owner can withdraw remaining tokens.


```solidity
function withdraw(uint256 amount) external onlyOwner;
```

## Events
### Dripped

```solidity
event Dripped(address indexed recipient, uint256 amount);
```

### DripAmountUpdated

```solidity
event DripAmountUpdated(uint256 newAmount);
```

### CooldownUpdated

```solidity
event CooldownUpdated(uint256 newCooldown);
```

### OwnerUpdated

```solidity
event OwnerUpdated(address indexed newOwner);
```

9 changes: 9 additions & 0 deletions docs/contracts/api-reference/interfaces/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"label": "Interfaces",
"position": 8,
"link": {
"type": "generated-index"
},
"collapsible": false,
"collapsed": false
}
Loading