Renfter

Core protocol logic implementation

MIN_RENT_DURATION

uint64 MIN_RENT_DURATION

Minimum rental duration period in seconds

wNFTFactory

contract IwNFTFactory wNFTFactory

Interface of wNFTFactory contract

walletManager

contract IWalletManager walletManager

Interface of WalletManager contract

feeDistributor

contract IFeeDistributor feeDistributor

Interface of FeeDistributor contract

_wContracts

Original contract address to wrapper contract

_oContractsData

Wrapper contract address to original contract

_offers

Wrapper contract to token id to offer details

_rents

Wrapper contract to token id to rent details

notRented

isWrapper

collectionNotWrapped

collectionWrapped

wrapperTokenExists

wrapperTokenNotExist

senderOTokenOwner

tokenOfferedForRent

initialize

Zero address check for depending contracts intentionally omitted

Initializer method

Parameters

Name
Type
Description

governator_

address

governator address

wNFTFactory_

address

wNFTFactory contract address

walletManager_

address

WalletManager contract address

feeDistributor_

address

FeeDistributor contract address

setWNFTFactory

Sets address of wNFTFactory contract

Parameters

Name
Type
Description

wNFTFactory_

address

New wNFTFactory contract address

_setWNFTFactory

Sets address of wNFTFactory contract

Parameters

Name
Type
Description

wNFTFactory_

address

New wNFTFactory contract address

setWalletManager

Sets address of WalletFactory contract

Parameters

Name
Type
Description

walletManager_

address

New WalletManager contract address

_setWalletManager

Sets address of WalletManager contract

Parameters

Name
Type
Description

walletManager_

address

New WalletManager contract address

setFeeDistributor

Sets address of FeeDistributor contract

Parameters

Name
Type
Description

feeDistributor_

address

New FeeDistributor contract address

_setFeeDistributor

Sets address of FeeDistributor contract

Parameters

Name
Type
Description

feeDistributor_

address

New FeeDistributor contract address

safeWrap721Collection

Creates wrapper contract for ERC-721 collection

Parameters

Name
Type
Description

oContract

address

Collection address being wrapped

restrictedSelectors

bytes4[]

List of selectors restricted for call whitelisting

safeWrap1155Collection

Creates wrapper contract for ERC-1155 collection

Parameters

Name
Type
Description

oContract

address

Collection address being wrapped

restrictedSelectors

bytes4[]

List of selectors restricted for call whitelisting

_postWrapCollection

Performs post-wrapper creation operations

Parameters

Name
Type
Description

oContract

address

Original contract address

wContract

address

Wrapper contract address

ercType

enum IRenfter.ERCType

restrictedSelectors

bytes4[]

List of selectors restricted for call whitelisting

safeWrap721Token

Creates a ERC-721 wrapper token of original contract with same token identifier

Parameters

Name
Type
Description

oContract

address

Collection address token is being wrapped

tokenId

uint256

Token identifier

wrapAndOffer721Token

Wraps ERC-721 token and offers it for renting

Parameters

Name
Type
Description

oContract

address

Collection address token is being wrapped

tokenId

uint256

Token identifier

conditions

struct IRenfter.ConditionsParams

ConditionsParams struct with offer conditions

whitelisted

struct WhitelistedParams[]

Array of WhitelistedParam structs with whitelisted method selectors

_wrap721Token

Creates a ERC-721 wrapper token of original contract with same token identifier

Parameters

Name
Type
Description

oContract

address

Collection address being wrapped

tokenId

uint256

Token identifier

sender

address

Sender address

safeWrap1155Token

Creates a ERC-1155 wrapper token of original contract with same token identifier

Parameters

Name
Type
Description

oContract

address

Collection address token is being wrapped

tokenId

uint256

Token identifier

wrapAndOffer1155Token

Wraps ERC-1155 token and offers it for renting

Parameters

Name
Type
Description

oContract

address

Collection address token is being wrapped

tokenId

uint256

Token identifier

conditions

struct IRenfter.ConditionsParams

ConditionsParams struct with offer conditions

whitelisted

struct WhitelistedParams[]

Array of WhitelistedParam structs with whitelisted method selectors

_wrap1155Token

Creates a ERC-1155 wrapper token of original contract with same token identifier

Parameters

Name
Type
Description

oContract

address

Collection address being wrapped

tokenId

uint256

Token identifier

sender

address

Sender address

_prepareTokenWrap

Perform preparation for token wrapping

Parameters

Name
Type
Description

oContract

address

Original contract address

tokenId

uint256

Token identifier

sender

address

Sender address

offerForRent

Offers token for a rent with defined conditions and whitelisted methods

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

conditions

struct IRenfter.ConditionsParams

ConditionsParams struct with offer conditions

whitelisted

struct WhitelistedParams[]

Array of WhitelistedParam structs with whitelisted method selectors

_offerForRent

Sets wrapped token as ready for renting by setting rent conditions

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

conditions

struct IRenfter.ConditionsParams

ConditionsParams struct with conditions

whitelisted

struct WhitelistedParams[]

Array of WhitelistedParams with whitelisted methods

removeRentalOffer

Sets previously listed token as unavailable for renting

Parameters

Name
Type
Description

wContract

address

Address of wrapper contract

tokenId

uint256

Token identifier

rentToken

Rents wrapper token that was previously listed for renting

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

duration

uint64

Rent duration in seconds

_getCurrentHolderOf

Returns current holder of the original token

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

currentHolder

address

Current holder address

_transferWToken

Transfers wrapper token

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

to

address

Receiver address

tokenId

uint256

Token identifier

_transferOToken

Transfers original token from wallet to to address

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

from

address

Sender address

to

address

Receiver address

tokenId

uint256

Token identifier

safeUnwrap721Token

Unwraps wrapped token ERC-721 token and returns original token to initial owner

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

_unwrap721Token

Unwraps wrapped ERC-721 token token and returns original token to initial owner

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

isEmergency

bool

Flag if its emergency unwrap

safeUnwrap1155Token

Unwraps wrapped token ERC1155 token and returns original token to initial owner

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

_unwrap1155Token

Unwraps wrapped ERC-1155 token and returns original token to initial owner

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

isEmergency

bool

Flag if its emergency unwrap

_prepareTokenUnwrap

Perform pre-unwrapping operations

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

lender

address

Original owner address

oTokenOwner

address

Current original token owner

emergencyUnwrap

Performs emergency unwrap of wrapper token

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

forwardCall

Forwards call received by wrapper contract

Parameters

Name
Type
Description

tokenId

uint256

Token identifier

data

bytes

Calldata being passed as calldata (selector + data)

batchResetOwnership

Batch method for reseting ownership of wrapper and original tokens if rent has expired

Parameters

Name
Type
Description

wContracts

address[]

Array of wrapper contract addresses

tokenIds

uint256[]

Array of token identifiers

resetOwnership

Resets ownership of wrapper and original tokens if rent has expired

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

getHolderOf

It probably won't return the same result as for example ownerOf method, as tokens are not transferred on rent expiration

Returns the address that should hold original token

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

getOriginTokenData

Returns original token data

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

oContract

address

Original collection address

lender

address

wTokenOwner

address

Wrapper token owner

getWrapperTokenData

Returns wrapper token data

Parameters

Name
Type
Description

oContract

address

Original collection address

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

wContract

address

Wrapper contract address

wTokenOwner

address

Wrapper token owner

getOriginalContract

Returns original contract address for wContract

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

Return Values

Name
Type
Description

[0]

address

Original collection address

getWrapperContract

Returns wrapper contract address for oContract

Parameters

Name
Type
Description

oContract

address

Address of original contract

Return Values

Name
Type
Description

[0]

address

Address of wrapper contract

getBatchWrapperTokenExist

Returns if all of oContracts have wrapper contract

Parameters

Name
Type
Description

contracts

address[]

Array of original contracts

tokenIds

uint256[]

Return Values

Name
Type
Description

[0]

bool

Flag if all original contracts have wrapper contracts

getOfferDetails

Returns offer details for wrapper token

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

[0]

struct IRenfter.Offer

{Offer} struct with data

getRentDetails

Returns rent details for wrapper token

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

[0]

struct IRenfter.Rent

{Rent} struct with data

getLender

Returns original owner of wrapper token

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

[0]

address

Original owner address

getOffered

Returns if token is listed for renting

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

getERCCompatible

Returns whether if address_ is compatible with ERC-721 or ERC-1155 standard

Parameters

Name
Type
Description

addr

address

Return Values

Name
Type
Description

compatible721

bool

Flag if address_ compatible with ERC-721

compatible1155

bool

Flag if address_ comaptible with ERC-1155

getRentExpired

Returns if rent has expired for token

Parameters

Name
Type
Description

wContract

address

Wrapper contract address

tokenId

uint256

Token identifier

Return Values

Name
Type
Description

[0]

bool

Flag if rent has expired

Last updated