# TimelockedDelegator

## Delegatee

### Functions

#### constructor

```solidity
function constructor(
    address _delegatee,
    address _zen
) public
```

Delegatee constructor

**Parameters**

| Name         | Type    | Description                    |
| ------------ | ------- | ------------------------------ |
| `_delegatee` | address | the address to delegate ZEN to |
| `_zen`       | address | the ZEN token address          |

#### withdraw

```solidity
function withdraw() public
```

send ZEN back to timelock and selfdestruct

## TimelockedDelegator

allows the timelocked ZEN to be delegated by the beneficiary while locked

### Functions

#### constructor

```solidity
function constructor(
    address _zen,
    address _beneficiary,
    uint256 _duration
) public
```

Delegatee constructor

**Parameters**

| Name           | Type    | Description                                       |
| -------------- | ------- | ------------------------------------------------- |
| `_zen`         | address | the ZEN token address                             |
| `_beneficiary` | address | default delegate, admin, and timelock beneficiary |
| `_duration`    | uint256 | duration of the token timelock window             |

#### delegate

```solidity
function delegate(
    address delegatee,
    uint256 amount
) public
```

delegate locked ZEN to a delegatee

**Parameters**

| Name        | Type    | Description                                                          |
| ----------- | ------- | -------------------------------------------------------------------- |
| `delegatee` | address | the target address to delegate to                                    |
| `amount`    | uint256 | the amount of ZEN to delegate. Will increment existing delegated ZEN |

#### undelegate

```solidity
function undelegate(
    address delegatee
) public returns (uint256)
```

return delegated ZEN to the timelock

**Parameters**

| Name        | Type    | Description                           |
| ----------- | ------- | ------------------------------------- |
| `delegatee` | address | the target address to undelegate from |

**Return Values**

| Name  | Type    | Description                |
| ----- | ------- | -------------------------- |
| `[0]` | uint256 | the amount of ZEN returned |

#### totalToken

```solidity
function totalToken() public returns (uint256)
```

calculate total ZEN held plus delegated

used by LinearTokenTimelock to determine the released amount

#### acceptBeneficiary

```solidity
function acceptBeneficiary() public
```

accept beneficiary role over timelocked ZEN. Delegates all held (non-subdelegated) zen to beneficiary

#### \_zenBalance

```solidity
function _zenBalance() internal returns (uint256)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.essencefinance.io/development/smart-contracts/timelocks/timelockeddelegator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
