> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sageprotocol.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Registry

> Tracks reward weights and manages epochs of reward configurations.

```rust theme={null}
use sui::table;
use sage_reward::reward;
```

<Tip>
  Explore this module further in the Mover Registry: @sage/reward
</Tip>

## Structs

### `RewardWeightsRegistry`

Registry of all `RewardWeights` over time.

```rust theme={null}
public struct RewardWeightsRegistry has key
```

<Expandable title="Fields">
  ```rust theme={null}
    id: sui::object::UID,
    current: u64,
    reward_weights_registry: sui::table::Table<u64, RewardWeights>
  ```
</Expandable>

## Functions

### `borrow`

Get an immutable reference to the `RewardWeights` during a specific epoch.

```rust theme={null}
public fun borrow(reward_weights_registry: &RewardWeightsRegistry, timestamp: u64): &RewardWeights
```

<Expandable title="Implementation">
  ```rust theme={null}
    public fun borrow(
        reward_weights_registry: &RewardWeightsRegistry,
        timestamp: u64
    ): &RewardWeights {
        &reward_weights_registry.reward_weights_registry[timestamp]
    }
  ```
</Expandable>

### `borrow_current`

Get an immutable reference to the `RewardWeights` during the current epoch.

```rust theme={null}
public fun borrow_current(reward_weights_registry: &RewardWeightsRegistry): &RewardWeights
```

<Expandable title="Implementation">
  ```rust theme={null}
    public fun borrow_current(
        reward_weights_registry: &RewardWeightsRegistry
    ): &RewardWeights {
        &reward_weights_registry.reward_weights_registry[reward_weights_registry.current]
    }
  ```
</Expandable>

### `get_current`

Get the current reward epoch.

```rust theme={null}
public fun get_current(reward_weights_registry: &RewardWeightsRegistry): u64
```

<Expandable title="Implementation">
  ```rust theme={null}
    public fun get_current(
        reward_weights_registry: &RewardWeightsRegistry
    ): u64 {
        reward_weights_registry.current
    }
  ```
</Expandable>

### `get_length`

Get the number of reward epochs that have occurred.

```rust theme={null}
public fun get_length(reward_weights_registry: &RewardWeightsRegistry): u64
```

<Expandable title="Implementation">
  ```rust theme={null}
    public fun get_length(
        reward_weights_registry: &RewardWeightsRegistry
    ): u64 {
        reward_weights_registry.reward_weights_registry.length()
    }
  ```
</Expandable>
