# Revest

{% hint style="info" %}
Revest.sol is a stateless component that can be upgraded incrementally; if you have any exciting ideas for future functionality, be sure to share with the team!
{% endhint %}

## Code

[Revest.sol](https://github.com/Revest-Finance/RevestContracts/blob/master/hardhat/contracts/Revest.sol)

## Events

### TimeLockFNFTMinted

Emitted each time Time Lock FNFT is minted via [mintTimeLock](https://app.gitbook.com/@revest-finance/s/revest-developer-documents/~/drafts/-MjnxiIlNMHYs3bCnEOI/smart-contracts/revest#minttimelock).

```
event TimeLockFNFTMinted(
        address indexed asset,
        address indexed from,
        uint indexed fnftId,
        uint endTime,
        FNFTConfig fnftConfig    
    );
```

### ValueLockFNFTMinted

Emitted each time Value Lock FNFT is minted via [mintValueLock](https://app.gitbook.com/@revest-finance/s/revest-developer-documents/~/drafts/-MjnxiIlNMHYs3bCnEOI/smart-contracts/revest#mintvaluelock).

```
event ValueLockFNFTMinted(
        address indexed primaryAsset,
        address indexed from,
        uint indexed fnftId,
        address compareTo,
        address oracleDispatch,
        uint depositAmount,
        uint[] quantities
    );
```

### AddressLockFNFTMinted

Emitted each time Address Lock FNFT is minted via [mintAddressLock](https://app.gitbook.com/@revest-finance/s/revest-developer-documents/~/drafts/-MjnxiIlNMHYs3bCnEOI/smart-contracts/revest#mintaddresslock).

```
event AddressLockFNFTMinted(
        address indexed asset,
        address indexed from,
        uint indexed fnftId,
        address trigger,
        FNFTConfig fnftConfig
    );
```

## Read-Only Functions

### getAddressesProvider

```
function getAddressesProvider() external view returns (IAddressRegistry) {
    return addressesProvider;
}
```

Returns the cached IAddressRegistry connected to this contract.

### getFlatWeiFee

```
function getFlatWeiFee() external view override returns (uint) {
    return flatWeiFee;
}
```

Returns the value of the fees in Wei.

### getERC20Fee

```
function getERC20Fee() external view override returns (uint) {
    return erc20Fee;
}
```

Returns the value of the fees in Wei.

## State-Changing Functions

### mintTimeLock

```
function mintTimeLock(
        uint endTime,
        address[] memory recipients,
        uint[] memory quantities,
        IRevest.FNFTConfig memory fnftConfig
    ) external payable returns (uint);
```

Creates Time Lock FNFT.&#x20;

* Emits: TimeLockFNFTMinted, CreateFNFT

### mintValueLock

```
function mintValueLock(
        address primaryAsset,
        address compareTo,
        uint unlockValue,
        bool unlockRisingEdge,
        address oracleDispatch,
        address[] memory recipients,
        uint[] memory quantities,
        IRevest.FNFTConfig memory fnftConfig
    ) external payable returns (uint);
```

Creates Value Lock FNFT.

* Emits: ValueLockFNFTMinted, CreateFNFT

### mintAddressLock

```
function mintAddressLock(
        address trigger,
        bytes memory arguments,
        address[] memory recipients,
        uint[] memory quantities,
        IRevest.FNFTConfig memory fnftConfig
    ) external payable returns (uint);
```

Creates Address Lock FNFT.&#x20;

* Emits AddressLockFNFTMinted, CreateFNFT

### setFlatWeiFee

```
function setFlatWeiFee(uint wethFee) external override onlyOwner {
    flatWeiFee = wethFee;
}
```

Admin functionality to change the fees.

### setERC20Fee

```
function setERC20Fee(uint erc20) external override onlyOwner {
    erc20Fee = erc20;
}
```

Admin functionality to change the fees.

## Interface

{% tabs %}
{% tab title="IReves .sol " %}

```
// SPDX-License-Identifier: GNU-GPL v3.0 or later

pragma solidity >=0.8.0;

/**
 * @title Mintable interface for Revest FNFTs
 * @dev ...
 */
interface IRevest {
    event TimeLockFNFTMinted(
        address indexed asset,
        address indexed from,
        uint indexed fnftId,
        uint depositAmount,
        uint[] quantities,
        uint endTime
    );

    event ValueLockFNFTMinted(
        address indexed primaryAsset,
        address indexed from,
        uint indexed fnftId,
        address compareTo,
        address oracleDispatch,
        uint depositAmount,
        uint[] quantities
    );

    event AddressLockFNFTMinted(
        address indexed asset,
        address indexed from,
        uint indexed fnftId,
        address trigger,
        uint depositAmount,
        uint[] quantities
    );

    struct FNFTConfig {
        address asset; // The token being stored 0
        address pipeToContract; // Indicates if FNFT will pipe to another contract 1
        uint depositAmount; // How many tokens 2
        uint depositMul; // Deposit multiplier 3
        uint split; // Number of splits remaining 4
        uint depositStopTime; // 5
        bool maturityExtension; // Maturity extensions remaining 6
        bool isMulti; // 7
        bool nontransferrable; // False by default (transferrable) // 8
    }

    // Refers to the global balance for an ERC20, encompassing possibly many FNFTs
    struct TokenTracker {
        uint lastBalance;
        uint lastMul;
    }

    // Corresponds to uints 0,1,2,3
    enum LockType {
        DoesNotExist,
        TimeLock,
        ValueLock,
        AddressLock
    }

    struct LockParam {
        address addressLock;
        uint timeLockExpiry;
        LockType lockType;
        ValueLock valueLock;
    }

    struct Lock {
        address addressLock;
        LockType lockType;
        ValueLock valueLock;
        uint timeLockExpiry;
        uint creationTime;
        bool unlocked;
    }

    struct ValueLock {
        address asset;
        address compareTo;
        address oracle;
        uint unlockValue;
        bool unlockRisingEdge; // if false, then unlockFallingEdge
    }

    function mintTimeLock(
        uint endTime,
        address[] memory recipients,
        uint[] memory quantities,
        IRevest.FNFTConfig memory fnftConfig
    ) external payable returns (uint);

    function mintValueLock(
        address primaryAsset,
        address compareTo,
        uint unlockValue,
        bool unlockRisingEdge,
        address oracleDispatch,
        address[] memory recipients,
        uint[] memory quantities,
        IRevest.FNFTConfig memory fnftConfig
    ) external payable returns (uint);

    function mintAddressLock(
        address trigger,
        bytes memory arguments,
        address[] memory recipients,
        uint[] memory quantities,
        IRevest.FNFTConfig memory fnftConfig
    ) external payable returns (uint);

    function withdrawFNFT(uint tokenUID, uint quantity) external;

    function unlockFNFT(uint tokenUID) external;

    function splitFNFT(
        uint fnftId,
        uint[] memory proportions,
        uint quantity
    ) external returns (uint[] memory newFNFTIds);

    function depositAdditionalToFNFT(
        uint fnftId,
        uint amount,
        uint quantity
    ) external returns (uint);

    function setFlatWeiFee(uint wethFee) external;

    function setERC20Fee(uint erc20) external;

    function getFlatWeiFee() external returns (uint);

    function getERC20Fee() external returns (uint);


}

```

{% endtab %}
{% endtabs %}

## ABI


---

# 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://dev.revest.finance/smart-contracts/revest.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.
