Renfter Protocol

Renfter Protocol is multi-chain uncollateralized NFT renting protocol that can be easily integrated into any project to unlock the entire new sets of features in order to help them further grow & scale.

Setup

This repo contains core smart contracts for managing rentals, as well as supporting contracts for creating holder wallets, wrapper contracts.

Before using the logic and creating the network, it is recommended the LTS of Node and latest npm to be installed as global packages.

After this, following command should be called:

npm ci

All dependencies will be installed as development dependencies, without a need of using globally installed packages.

Project is using Hardhat as development framework. As wrapper contracts are the mirror copy of ERC721 and ERC1155 contracts, OpenZeppelin contracts have been utilised. Renfter implementation is using OpenZeppelin-Upgrades as the mehanism for deploying contract ready for future update. WalletFactory and wNFTFactory are using Beacon proxy as the mehanism for deploying contracts ready for future update.

Dozen of commands are available for running, but the most important ones are the following:

npm start - Starts local Hardhat environment, compiles and deploys contracts using scripts defined in deploy folder. It also generates test accounts that can be used during testing out deployed contracts. All of the addresses will can be found in console output after running the command.

npm test - Runs tests using local Hardhat environment, compiles and deploys contracts using scripts defined in deploy folder, and runs tests defined in test folder. Output will give a report of success/fail tests, as well as gas consumtion gathered durring execution of tests.

Network deployment

To support deployment of contracts to testnets like Polygon Mumbai, Rinkeby and others, or to any mainnet, following steps should be followed:

  1. hardhat.config.js should be properly configured to support deployment. At the time of writting, Polygon Mumbai and SKALE testnets are supported. Configuration for these can be used later on as an example for setting up other networks

  2. As hardhat.config.js is using environment variables defined in .env, the content of this file should be properly updated with correct data in order for deployment to networks to work (this file is not part of repo for security reasons, however, there is .env.sample file which should be used as an example of how .env should look like). Values set in this file (eg. DEV_MNEMONIC and PRIVATE_KEY), should be updated to proper values when deploying to networks, as well as other network specific metadata (eg. SKALE_STAGE_URL is link to json-rpc node for SKALE network).

  3. In order to deploy contracts to desired network, after all of the previously mentioned configuration and variables are set to proper values, hardhat deploy tool can be used to deploy contracts. For this purpose, following command can be used:

    npm deploy ${NETWORK_NAME}

    Instead of ${NETWORK_NAME}, concrete network name should be passed. This must be the name defined in configuration file hardhat.config.js (eg. skaleStage). The output of running this command will be address of deployed contracts on target network, as well as ABI and contract address for contracts deployed (this can be found in abi folder)

Last updated