Revest Developer Documents
  • Revest Developer Documentation
  • Smart Contracts
    • FNFTHandler
    • LockManager
    • MetadataHandler
    • RevestAddressRegistry
    • TokenVault
    • Revest
  • Address Lock Overview
    • Address Lock Metadata File
  • Output Receiver Overview
  • API Documentation
    • IAddressLock API
    • IOutputReceiver API
      • IOutputReceiver V2
      • IOuputReceiver V3
  • Graph Protocol Subgraphs
    • Introduction
  • Subgraph Links
  • Token Vault Interactions
Powered by GitBook
On this page
  • Code
  • Events
  • TimeLockFNFTMinted
  • ValueLockFNFTMinted
  • AddressLockFNFTMinted
  • Read-Only Functions
  • getAddressesProvider
  • getFlatWeiFee
  • getERC20Fee
  • State-Changing Functions
  • mintTimeLock
  • mintValueLock
  • mintAddressLock
  • setFlatWeiFee
  • setERC20Fee
  • Interface
  • ABI

Was this helpful?

  1. Smart Contracts

Revest

This documentation covers Revest.sol core functionality.

PreviousTokenVaultNextAddress Lock Overview

Last updated 3 years ago

Was this helpful?

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!

Code

Events

TimeLockFNFTMinted

Emitted each time Time Lock FNFT is minted via .

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 .

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

AddressLockFNFTMinted

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.

  • 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.

  • 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

// 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);


}

ABI

Emitted each time Address Lock FNFT is minted via .

Revest.sol
mintTimeLock
mintValueLock
mintAddressLock