# ZEROFROST

ERC721 contract that issues an NFT representing a FROST signer's bond and active collateral.

```javascript
function epoch() public view returns (uint256);
```

Current epoch number. ZEROFROST holders which have acquired a bond for the current epoch remain locked until the next epoch after the one which they call \`goodbye(bytes)\`. Epochs begin at 0 and increment deterministically.

```javascript
function nextEpoch() public view returns (uint256 timestamp);
```

Returns the UNIX timestamp representing the point where ZEROFROST holders can rotate the FROST public key and become eligible to exit with their rewards.

```javascript
function setEpochLength(uint256 seconds) public onlyGovernance;
```

Sets the amount of time added to \`nextEpoch\` when the next round is triggered.

```javascript
function principal() public view returns (uint256 requiredZeroTokens);
```

Returns the amount of ZERO tokens required to acquire a bond. Configurable by on-chain governance with the \`setPrincipal(uint256)\` function.

```javascript
function acceptsCollateral(address) public view returns (bool canUse);
```

Returns true if an asset can be used as collateral associated with a bond.

```javascript
function getAcceptedCollateral() public view returns (address[]);
```

Returns the list of contract addresses for all collateral supported by ZEROFROST.

```javascript
function purchase(address[] memory inputCollateral, uint256[] memory inputCollateralAmounts, bytes memory blsPubKey) public;
```

Acquire a ZEROFROST NFT and become eligible to be included in FROST. When the ZERO network is forming a FROST ring, it will prefer ZEROFROST holders with the most collateral. ZEROFROST holders who did not get awarded a secret share during DKG will still be locked until the next epoch, but will earn rewards the same based on their collateral.

The ID of the NFT received from a purchase is always \`keccak256(blsPubKey))\`\`

```javascript
function collateral(bytes memory blsPubKey) public view returns (address[] memory assets, uint256[] memory qtys);
```

Returns the amount of collateral for each asset staked, for a given ZEROFROST bond.

```javascript
function collateralValueInETH() public view returns (address[] memory assets, uint256[] memory totalValue);
```

Returns the total value of each collateral asset held in terms of ETH. Used to determine distribution of rewards awarded to ZEROFROST bonds as they are redeemed.

```javascript
function wrappedAssetValueInETH() public view returns (address[] memory assets, uint256[] memory totalValue);
```

Returns the total value of active wrapped assets which exist, in terms of ETH. Used to determine the amount of collateral distributed in a liquidation scenario, for any given default asset that is eligible to be burned for collateral.

```javascript
function goodbye(bytes memory blsPubKey) public
```

Signal your intent to leave the FROST ring and abdicate your responsibility as a signer. But, you can't leave yet! You have to keep signing until the next epoch is triggered.

[A Classic Midwestern Goodbye](https://www.youtube.com/watch?v=MHCmE4ABnNs)

Without calling this function, whether or not your node is online to participate in DKG, your ZEROFROST bond will still have its collateral on the line, and you will still earn rewards.

```javascript
function canLeaveAfter(bytes memory blsPubKey) public view returns (uint256 timestamp);
```

Returns a UNIX timestamp representing when a ZEROFROST bond is considered inactive and eligible to call \`redeem(bytes)\`.

```javascript
function redeem(bytes memory blsPubKey) public;
```

Trade in a ZEROFROST NFT for the input collateral and any rewards accrued (proportional to collateral)

```javascript
function rotate(bytes memory frostPubKey) public eitherFrostOrGovernance;
```

Queues the next FROST pubkey to be activated after the next epoch is triggered.

```javascript
function liquidate() public onlyGovernance;
```

To be used in the event that FROST fails, either due to more than 33% of active signers dropping from the ZERO network, or otherwise if FROST colludes to steal assets backing wrapped assets.

In ideal conditions, this function will never be called, but if it is, in order to make sure wrapped assets can all be recovered no matter where they exist, a new wrapped asset will be factoried up for each asset and the GatewayRegistry updated to reflect the new addresses. Old wrapped assets will be able to be redeemed for the proportion of FROST collateral from the compromised FROST ring.

```javascript
function collect(uint256 epoch) public;
```

Exchange all assets which were backed by a liquidated FROST ring for the proportional amount of FROST collateral.


---

# 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.zerodao.com/dao/zerofrost.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.
