Skip to content

Listings

Listings

ListingIsNeitherRegisteredNorListed

error ListingIsNeitherRegisteredNorListed(uint256 listingId)

Thrown when the Listing with `listingId` is neither registered among present ones nor listed (disabled).

ListingIsNotRegistered

error ListingIsNotRegistered(uint256 listingId)

Thrown when the Listing with `listingId` is not registered among present ones.

ListingIsPaused

error ListingIsPaused()

Thrown when the operation is not allowed due to the listing being paused.

ListingIsNotPaused

error ListingIsNotPaused()

Thrown when the operation is not allowed due to the listing not being paused.

InvalidLockPeriod

error InvalidLockPeriod(uint32 period)

Thrown when attempting to lock listed assets for the period longer than the lister allowed.

Params

struct Params {
  address lister;
  address configurator;
}

Listing

struct Listing {
  struct Assets.Asset[] assets;
  address lister;
  address beneficiary;
  uint32 maxLockPeriod;
  uint32 lockedTill;
  address configurator;
  bool immediatePayout;
  bool enabled;
  bool paused;
}

ListerInfo

struct ListerInfo {
  struct EnumerableSetUpgradeable.UintSet listingIndex;
}

AssetInfo

struct AssetInfo {
  struct EnumerableSetUpgradeable.UintSet listingIndex;
}

Registry

struct Registry {
  struct CountersUpgradeable.Counter listingIdTracker;
  struct EnumerableSetUpgradeable.UintSet listingIndex;
  mapping(uint256 => struct Listings.Listing) listings;
  mapping(uint256 => struct Listings.Listing) listingsHistory;
  mapping(address => struct Listings.ListerInfo) listers;
  mapping(address => struct Listings.AssetInfo) assetCollections;
}

pause

function pause(struct Listings.Listing self) internal

Puts the listing on pause.

unpause

function unpause(struct Listings.Listing self) internal

Lifts the listing pause.

isRegisteredAndListed

function isRegisteredAndListed(struct Listings.Listing self) internal view returns (bool)

Determines whether the listing is registered and active.

isRegistered

function isRegistered(struct Listings.Listing self) internal view returns (bool)

checkNotPaused

function checkNotPaused(struct Listings.Listing self) internal pure

Reverts if the listing is paused.

isValidLockPeriod

function isValidLockPeriod(struct Listings.Listing self, uint32 lockPeriod) internal pure returns (bool)

isAssetLister

function isAssetLister(struct Listings.Registry self, uint256 listingId, address caller) internal view returns (bool)

Determines whether the caller address is assets lister.

checkValidLockPeriod

function checkValidLockPeriod(struct Listings.Listing self, uint32 lockPeriod) internal pure

Reverts if the lock period is not valid.

addLock

function addLock(struct Listings.Listing self, uint32 unlockTimestamp) internal

Extends listing lock time. Does not modify the state if current lock time is larger.

register

function register(struct Listings.Registry self, struct Listings.Listing listing) external returns (uint256 listingId)

Registers new listing.

Name Type Description
listingId uint256 New listing ID.

remove

function remove(struct Listings.Registry self, uint256 listingId) external

Removes listing data.

Name Type Description
self struct Listings.Registry
listingId uint256 The ID of the listing to be deleted.

allListings

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

Returns the paginated list of currently registered listings.

userListings

function userListings(struct Listings.Registry self, 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.

assetListings

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

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

checkRegisteredAndListed

function checkRegisteredAndListed(struct Listings.Registry self, uint256 listingId) internal view

Reverts if Listing is neither registered among present Listings nor enabled.

Name Type Description
self struct Listings.Registry
listingId uint256 Listing ID.

checkRegistered

function checkRegistered(struct Listings.Registry self, uint256 listingId) internal view

listingCount

function listingCount(struct Listings.Registry self) internal view returns (uint256)

Returns the number of currently registered listings.

userListingCount

function userListingCount(struct Listings.Registry self, address lister) internal view returns (uint256)

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

assetListingCount

function assetListingCount(struct Listings.Registry self, address original) internal view returns (uint256)

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

paginateIndexedListings

function paginateIndexedListings(struct Listings.Registry self, struct EnumerableSetUpgradeable.UintSet listingIndex, uint256 offset, uint256 limit) internal view returns (uint256[], struct Listings.Listing[])

Returns the paginated list of currently registered listing using provided index reference.

hash

function hash(struct IListingTermsRegistry.ListingTerms listingTerms) internal pure returns (bytes32)

Returns the hash of listing terms strategy ID and data.

Name Type Description
listingTerms struct IListingTermsRegistry.ListingTerms Listing Terms.