Revest

This documentation covers Revest.sol core functionality.

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

Revest.sol

Events

TimeLockFNFTMinted

Emitted each time Time Lock FNFT is minted via 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.

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.

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

Last updated