# QuadraticTimelockedSubdelegator

## 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

## QuadtraticTimelockedSubdelegator

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

### Functions

#### constructor

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

Delegatee constructor

clawback admin needs to be 0 because clawbacks can be bricked by beneficiary

**Parameters**

| Name           | Type    | Description                                       |
| -------------- | ------- | ------------------------------------------------- |
| `_beneficiary` | address | default delegate, admin, and timelock beneficiary |
| `_duration`    | uint256 | duration of the token timelock window             |
| `_zen`         | address | the ZEN token address                             |
| `_cliff`       | uint256 | the seconds before first claim is allowed         |
| `_startTime`   | uint256 | the initial time to use for timelock              |

#### 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)
```
