Skip to content

ListingManager

ListingManager

ListingManagerInitParams

struct ListingManagerInitParams {
  contract IACL acl;
  contract IMetahub metahub;
}

onlyRentingManager

modifier onlyRentingManager()

Modifier to make a function callable only by the Renting Manager contract

onlyListingWizard

modifier onlyListingWizard()

Modifier to make a function callable only by the account with LISTING_WIZARD role.

onlyIsAuthorizedOperatorForListingManagement

modifier onlyIsAuthorizedOperatorForListingManagement(uint256 listingId)

Modifier to make a function callable only by the Operator authorized for Listing management.

Name Type Description
listingId uint256 Listing ID.

onlyRegisteredAndListed

modifier onlyRegisteredAndListed(uint256 listingId)

Modifier to make sure the function is called for a Listing that has been registered and is listed.

onlyRegistered

modifier onlyRegistered(uint256 listingId)

Modifier to make sure the function is called for a Listing that has been registered.

constructor

constructor() public

Constructor that gets called for the implementation contract.

initialize

function initialize(struct ListingManager.ListingManagerInitParams params) external

Listing Manager initializer.

Name Type Description
params struct ListingManager.ListingManagerInitParams Initialization params.

createListing

function createListing(struct Assets.Asset[] assets, struct Listings.Params params, uint32 maxLockPeriod, bool immediatePayout) external returns (uint256 listingId)

Creates new listing. Emits an {ListingCreated} event.

Name Type Description
assets struct Assets.Asset[] Assets to be listed.
params struct Listings.Params Listing params.
maxLockPeriod uint32 The maximum amount of time the original asset owner can wait before getting the asset back.
immediatePayout bool Indicates whether the rental fee must be transferred to the lister on every renting. If FALSE, the rental fees get accumulated until withdrawn manually.
Name Type Description
listingId uint256 New listing ID.

addLock

function addLock(uint256 listingId, uint32 unlockTimestamp) external

Updates listing lock time for Listing.

Name Type Description
listingId uint256 Listing ID.
unlockTimestamp uint32 Timestamp when asset would be unlocked.

disableListing

function disableListing(uint256 listingId) external

Marks the assets as being delisted. This operation in irreversible. After delisting, the asset can only be withdrawn when it has no active rentals. Emits an {AssetDelisted} event.

Name Type Description
listingId uint256 Listing ID.

withdrawListingAssets

function withdrawListingAssets(uint256 listingId) external

Returns the asset back to the lister. Emits an {AssetWithdrawn} event.

Name Type Description
listingId uint256 Listing ID.

pauseListing

function pauseListing(uint256 listingId) external

Puts the listing on pause. Emits a {ListingPaused} event.

Name Type Description
listingId uint256 Listing ID.

unpauseListing

function unpauseListing(uint256 listingId) external

Lifts the listing pause. Emits a {ListingUnpaused} event.

Name Type Description
listingId uint256 Listing ID.

listingInfo

function listingInfo(uint256 listingId) external view returns (struct Listings.Listing listing)

Returns the Listing details by the `listingId`. Performs a look up among both present (contains listed and delisted, but not yet withdrawn Listings) and historical ones (withdrawn Listings only).

Name Type Description
listingId uint256 Listing ID.
Name Type Description
listing struct Listings.Listing Listing details.

listingCount

function listingCount() external view returns (uint256)

Returns the number of currently registered listings.

Name Type Description
[0] uint256 Listing count.

listings

function listings(uint256 offset, uint256 limit) external view returns (uint256[], struct Listings.Listing[])

Returns the paginated list of currently registered listings.

Name Type Description
offset uint256 Starting index.
limit uint256 Max number of items.
Name Type Description
[0] uint256[] Listing IDs.
[1] struct Listings.Listing[] Listings.

userListingCount

function userListingCount(address lister) external view returns (uint256)

Returns the number of currently registered listings for the particular lister account.

Name Type Description
lister address Lister address.
Name Type Description
[0] uint256 Listing count.

userListings

function userListings(address lister, uint256 offset, uint256 limit) external view returns (uint256[], struct Listings.Listing[])

Returns the paginated list of currently registered listings for the particular lister account.

Name Type Description
lister address Lister address.
offset uint256 Starting index.
limit uint256 Max number of items.
Name Type Description
[0] uint256[] Listing IDs.
[1] struct Listings.Listing[] Listings.

assetListingCount

function assetListingCount(address original) external view returns (uint256)

Returns the number of currently registered listings for the particular original asset address.

Name Type Description
original address Original asset address.
Name Type Description
[0] uint256 Listing count.

assetListings

function assetListings(address original, uint256 offset, uint256 limit) external view returns (uint256[], struct Listings.Listing[])

Returns the paginated list of currently registered listings for the particular original asset address.

Name Type Description
original address Original asset address.
offset uint256 Starting index.
limit uint256 Max number of items.
Name Type Description
[0] uint256[] Listing IDs.
[1] struct Listings.Listing[] Listings.

contractKey

function contractKey() external pure returns (bytes4)

Returns implemented contract key.

Name Type Description
[0] bytes4 Contract key;

checkRegisteredAndListed

function checkRegisteredAndListed(uint256 listingId) public view

Reverts if Listing is neither registered among present ones nor listed.

Name Type Description
listingId uint256 Listing ID.

checkIsListingWizard

function checkIsListingWizard(address account) public view

Reverts if the provided `account` does not own LISTING_WIZARD role.

Name Type Description
account address The account to check ownership for.

supportsInterface

function supportsInterface(bytes4 interfaceId) public view returns (bool)

_Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created.

This function call must use less than 30 000 gas._

_authorizeUpgrade

function _authorizeUpgrade(address newImplementation) internal

Checks whether the caller is authorized to upgrade the Metahub implementation.

_acl

function _acl() internal view returns (contract IACL)

return the IACL address

_isListingWizard

function _isListingWizard(address account) internal view returns (bool)

_isAssetLister

function _isAssetLister(uint256 listingId, address account) internal view returns (bool)

_checkRegistered

function _checkRegistered(uint256 listingId) internal view