Skip to content

Warpers

Warpers

MultipleWarpersNotSupported

error MultipleWarpersNotSupported()

Thrown if creating warper for universe asset in case one already exists.

InvalidWarperInterface

error InvalidWarperInterface()

Thrown if provided warper address does not implement warper interface.

WarperHasIncorrectMetahubReference

error WarperHasIncorrectMetahubReference(address provided, address required)

Thrown when the warper returned metahub address differs from the one it is being registered in.

Name Type Description
provided address Metahub address returned by warper.
required address Required metahub address.

WarperIsNotRegistered

error WarperIsNotRegistered(address warper)

Thrown when performing action or accessing data of an unknown warper.

Name Type Description
warper address Warper address.

WarperIsAlreadyRegistered

error WarperIsAlreadyRegistered(address warper)

Thrown upon attempting to register a warper twice.

Name Type Description
warper address Duplicate warper address.

MissingWarpersForUniverse

error MissingWarpersForUniverse(uint256 universeId)

Thrown upon attempting to rent for universe without any warper(s).

MissingWarpersForAssetInUniverse

error MissingWarpersForAssetInUniverse(uint256 universeId, address asset)

Thrown upon attempting to rent for asset in the certain universe without any warper(s).

WarperIsPaused

error WarperIsPaused()

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

WarperIsNotPaused

error WarperIsNotPaused()

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

UnsupportedAsset

error UnsupportedAsset(address asset)

Thrown when there are no registered warpers for a particular asset.

Name Type Description
asset address Asset address.

IncompatibleAsset

error IncompatibleAsset(address asset)

Thrown upon attempting to use the warper which is not registered for the provided asset.

Warper

struct Warper {
  bytes4 assetClass;
  address original;
  bool paused;
  contract IWarperController controller;
  string name;
  uint256 universeId;
}

checkCompatibleAsset

function checkCompatibleAsset(struct Warpers.Warper self, struct Assets.Asset asset) internal pure

Reverts if the warper original does not match the `asset`;

pause

function pause(struct Warpers.Warper self) internal

Puts the warper on pause.

unpause

function unpause(struct Warpers.Warper self) internal

Lifts the warper pause.

checkNotPaused

function checkNotPaused(struct Warpers.Warper self) internal pure

Reverts if the warper is paused.

Registry

struct Registry {
  contract IWarperPresetFactory presetFactory;
  struct EnumerableSetUpgradeable.AddressSet warperIndex;
  mapping(uint256 => struct EnumerableSetUpgradeable.AddressSet) universeWarperIndex;
  mapping(address => struct EnumerableSetUpgradeable.AddressSet) assetWarperIndex;
  mapping(uint256 => mapping(address => struct EnumerableSetUpgradeable.AddressSet)) universeAssetWarperIndex;
  mapping(address => struct Warpers.Warper) warpers;
}

registerWarper

function registerWarper(struct Warpers.Registry self, address warper, struct IWarperManager.WarperRegistrationParams params) internal returns (bytes4 assetClass, address original)

Performs warper registration.

Name Type Description
self struct Warpers.Registry
warper address Warper address.
params struct IWarperManager.WarperRegistrationParams Warper registration params.

_register

function _register(struct Warpers.Registry self, address warperAddress, struct Warpers.Warper warper) private

Performs warper registration.

remove

function remove(struct Warpers.Registry self, address warperAddress) internal

Removes warper data from the registry.

universeWarpers

function universeWarpers(struct Warpers.Registry self, uint256 universeId, uint256 offset, uint256 limit) internal view returns (address[], struct Warpers.Warper[])

Returns the paginated list of warpers belonging to the particular universe.

universeAssetWarpers

function universeAssetWarpers(struct Warpers.Registry self, uint256 universeId, address asset, uint256 offset, uint256 limit) internal view returns (address[], struct Warpers.Warper[])

Returns the paginated list of warpers belonging to the particular universe.

isRegisteredWarper

function isRegisteredWarper(struct Warpers.Registry self, address warper) internal view returns (bool)

Checks warper registration by address.

checkRegisteredWarper

function checkRegisteredWarper(struct Warpers.Registry self, address warper) internal view

Reverts if warper is not registered.

checkUniverseHasWarper

function checkUniverseHasWarper(struct Warpers.Registry self, uint256 universeId) internal view

Reverts if no warpers are registered for the universe.

checkUniverseHasWarperForAsset

function checkUniverseHasWarperForAsset(struct Warpers.Registry self, uint256 universeId, address asset) internal view

Reverts if no warpers are registered for the universe.

isSupportedAsset

function isSupportedAsset(struct Warpers.Registry self, address asset) internal view returns (bool)

Checks asset support by address. The supported asset should have at least one warper.

Name Type Description
self struct Warpers.Registry
asset address Asset address.

universeWarperCount

function universeWarperCount(struct Warpers.Registry self, uint256 universeId) internal view returns (uint256)

Returns the number of warpers belonging to the particular universe.

universeAssetWarperCount

function universeAssetWarperCount(struct Warpers.Registry self, uint256 universeId, address asset) internal view returns (uint256)

Returns the number of warpers registered for certain asset in universe.

Name Type Description
self struct Warpers.Registry
universeId uint256 Universe ID.
asset address Asset address.

supported

function supported(struct Warpers.Registry self, address original) internal view returns (uint256)

Returns the number of warpers associated with the particular original asset.

paginateIndexedWarpers

function paginateIndexedWarpers(struct Warpers.Registry self, struct EnumerableSetUpgradeable.AddressSet warperIndex, uint256 offset, uint256 limit) internal view returns (address[], struct Warpers.Warper[])

Returns the paginated list of registered warpers using provided index reference.