Skip to main content

ExecutionManager

LooksRare protocol team (👀,💎); bitbeckers;

ExecutionManager

This contract handles the execution and resolution of transactions. A transaction is executed on-chain when an off-chain maker order is matched by on-chain taker order of a different kind. For instance, a taker ask is executed against a maker bid (or a taker bid against a maker ask).

Methods​

MAGIC_VALUE_ORDER_NONCE_EXECUTED​

function MAGIC_VALUE_ORDER_NONCE_EXECUTED() external view returns (bytes32)

Magic value nonce returned if executed (or cancelled).

Returns​

NameTypeDescription
_0bytes32undefined

addStrategy​

function addStrategy(uint16 standardProtocolFeeBp, uint16 minTotalFeeBp, uint16 maxProtocolFeeBp, bytes4 selector, bool isMakerBid, address implementation) external nonpayable

This function allows the owner to add a new execution strategy to the protocol.

Strategies have an id that is incremental. Only callable by owner.

Parameters​

NameTypeDescription
standardProtocolFeeBpuint16Standard protocol fee (in basis point)
minTotalFeeBpuint16Minimum total fee (in basis point)
maxProtocolFeeBpuint16Maximum protocol fee (in basis point)
selectorbytes4Function selector for the strategy
isMakerBidboolWhether the function selector is for maker bid
implementationaddressImplementation address

cancelOrderNonces​

function cancelOrderNonces(uint256[] orderNonces) external nonpayable

This function allows a user to cancel an array of order nonces.

It does not check the status of the nonces to save gas and to prevent revertion if one of the orders is filled in the same block.

Parameters​

NameTypeDescription
orderNoncesuint256[]Array of order nonces

cancelOwnershipTransfer​

function cancelOwnershipTransfer() external nonpayable

This function is used to cancel the ownership transfer.

This function can be used for both cancelling a transfer to a new owner and cancelling the renouncement of the ownership.

cancelSubsetNonces​

function cancelSubsetNonces(uint256[] subsetNonces) external nonpayable

This function allows a user to cancel an array of subset nonces.

It does not check the status of the nonces to save gas.

Parameters​

NameTypeDescription
subsetNoncesuint256[]Array of subset nonces

confirmOwnershipRenouncement​

function confirmOwnershipRenouncement() external nonpayable

This function is used to confirm the ownership renouncement.

confirmOwnershipTransfer​

function confirmOwnershipTransfer() external nonpayable

This function is used to confirm the ownership transfer.

This function can only be called by the current potential owner.

creatorFeeManager​

function creatorFeeManager() external view returns (contract ICreatorFeeManager)

Creator fee manager.

Returns​

NameTypeDescription
_0contract ICreatorFeeManagerundefined

incrementBidAskNonces​

function incrementBidAskNonces(bool bid, bool ask) external nonpayable

This function increments a user's bid/ask nonces.

The logic for computing the quasi-random number is inspired by Seaport v1.2. The pseudo-randomness allows non-deterministic computation of the next ask/bid nonce. A deterministic increment would make the cancel-all process non-effective in certain cases (orders signed with a greater ask/bid nonce). The same quasi-random number is used for incrementing both the bid and ask nonces if both values are incremented in the same transaction. If this function is used twice in the same block, it will return the same quasiRandomNumber but this will not impact the overall business logic.

Parameters​

NameTypeDescription
bidboolWhether to increment the user bid nonce
askboolWhether to increment the user ask nonce

initiateOwnershipRenouncement​

function initiateOwnershipRenouncement() external nonpayable

This function is used to initiate the ownership renouncement.

initiateOwnershipTransfer​

function initiateOwnershipTransfer(address newPotentialOwner) external nonpayable

This function is used to initiate the transfer of ownership to a new owner.

Parameters​

NameTypeDescription
newPotentialOwneraddressNew potential owner address

isCurrencyAllowed​

function isCurrencyAllowed(address) external view returns (bool)

It checks whether the currency is allowed for transacting.

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
_0boolundefined

maxCreatorFeeBp​

function maxCreatorFeeBp() external view returns (uint16)

Maximum creator fee (in basis point).

Returns​

NameTypeDescription
_0uint16undefined

owner​

function owner() external view returns (address)

Address of the current owner.

Returns​

NameTypeDescription
_0addressundefined

ownershipStatus​

function ownershipStatus() external view returns (enum IOwnableTwoSteps.Status)

Ownership status.

Returns​

NameTypeDescription
_0enum IOwnableTwoSteps.Statusundefined

potentialOwner​

function potentialOwner() external view returns (address)

Address of the potential owner.

Returns​

NameTypeDescription
_0addressundefined

protocolFeeRecipient​

function protocolFeeRecipient() external view returns (address)

Protocol fee recipient.

Returns​

NameTypeDescription
_0addressundefined

strategyInfo​

function strategyInfo(uint256) external view returns (bool isActive, uint16 standardProtocolFeeBp, uint16 minTotalFeeBp, uint16 maxProtocolFeeBp, bytes4 selector, bool isMakerBid, address implementation)

This returns the strategy information for a strategy id.

Parameters​

NameTypeDescription
_0uint256undefined

Returns​

NameTypeDescription
isActiveboolundefined
standardProtocolFeeBpuint16undefined
minTotalFeeBpuint16undefined
maxProtocolFeeBpuint16undefined
selectorbytes4undefined
isMakerBidboolundefined
implementationaddressundefined

updateCreatorFeeManager​

function updateCreatorFeeManager(address newCreatorFeeManager) external nonpayable

This function allows the owner to update the creator fee manager address.

Only callable by owner.

Parameters​

NameTypeDescription
newCreatorFeeManageraddressAddress of the creator fee manager

updateCurrencyStatus​

function updateCurrencyStatus(address currency, bool isAllowed) external nonpayable

This function allows the owner to update the status of a currency.

Only callable by owner.

Parameters​

NameTypeDescription
currencyaddressCurrency address (address(0) for ETH)
isAllowedboolWhether the currency should be allowed for trading

updateMaxCreatorFeeBp​

function updateMaxCreatorFeeBp(uint16 newMaxCreatorFeeBp) external nonpayable

This function allows the owner to update the maximum creator fee (in basis point).

The maximum value that can be set is 25%. Only callable by owner.

Parameters​

NameTypeDescription
newMaxCreatorFeeBpuint16New maximum creator fee (in basis point)

updateProtocolFeeRecipient​

function updateProtocolFeeRecipient(address newProtocolFeeRecipient) external nonpayable

This function allows the owner to update the protocol fee recipient.

Only callable by owner.

Parameters​

NameTypeDescription
newProtocolFeeRecipientaddressNew protocol fee recipient address

updateStrategy​

function updateStrategy(uint256 strategyId, bool isActive, uint16 newStandardProtocolFee, uint16 newMinTotalFee) external nonpayable

This function allows the owner to update parameters for an existing execution strategy.

Only callable by owner.

Parameters​

NameTypeDescription
strategyIduint256Strategy id
isActiveboolWhether the strategy must be active
newStandardProtocolFeeuint16New standard protocol fee (in basis point)
newMinTotalFeeuint16New minimum total fee (in basis point)

userBidAskNonces​

function userBidAskNonces(address) external view returns (uint256 bidNonce, uint256 askNonce)

This tracks the bid and ask nonces for a user address.

Parameters​

NameTypeDescription
_0addressundefined

Returns​

NameTypeDescription
bidNonceuint256undefined
askNonceuint256undefined

userOrderNonce​

function userOrderNonce(address, uint256) external view returns (bytes32)

This checks whether the order nonce for a user was executed or cancelled.

Parameters​

NameTypeDescription
_0addressundefined
_1uint256undefined

Returns​

NameTypeDescription
_0bytes32undefined

userSubsetNonce​

function userSubsetNonce(address, uint256) external view returns (bool)

This checks whether the subset nonce for a user was cancelled.

Parameters​

NameTypeDescription
_0addressundefined
_1uint256undefined

Returns​

NameTypeDescription
_0boolundefined

Events​

CancelOwnershipTransfer​

event CancelOwnershipTransfer()

This is emitted if the ownership transfer is cancelled.

CurrencyStatusUpdated​

event CurrencyStatusUpdated(address currency, bool isAllowed)

It is emitted if the currency status in the allowlist is updated.

Parameters​

NameTypeDescription
currencyaddressundefined
isAllowedboolundefined

InitiateOwnershipRenouncement​

event InitiateOwnershipRenouncement()

This is emitted if the ownership renouncement is initiated.

InitiateOwnershipTransfer​

event InitiateOwnershipTransfer(address previousOwner, address potentialOwner)

This is emitted if the ownership transfer is initiated.

Parameters​

NameTypeDescription
previousOwneraddressundefined
potentialOwneraddressundefined

NewBidAskNonces​

event NewBidAskNonces(address user, uint256 bidNonce, uint256 askNonce)

It is emitted when there is an update of the global bid/ask nonces for a user.

Parameters​

NameTypeDescription
useraddressundefined
bidNonceuint256undefined
askNonceuint256undefined

NewCreatorFeeManager​

event NewCreatorFeeManager(address creatorFeeManager)

It is issued when there is a new creator fee manager.

Parameters​

NameTypeDescription
creatorFeeManageraddressundefined

NewMaxCreatorFeeBp​

event NewMaxCreatorFeeBp(uint256 maxCreatorFeeBp)

It is issued when there is a new maximum creator fee (in basis point).

Parameters​

NameTypeDescription
maxCreatorFeeBpuint256undefined

NewOwner​

event NewOwner(address newOwner)

This is emitted when there is a new owner.

Parameters​

NameTypeDescription
newOwneraddressundefined

NewProtocolFeeRecipient​

event NewProtocolFeeRecipient(address protocolFeeRecipient)

It is issued when there is a new protocol fee recipient address.

Parameters​

NameTypeDescription
protocolFeeRecipientaddressundefined

NewStrategy​

event NewStrategy(uint256 strategyId, uint16 standardProtocolFeeBp, uint16 minTotalFeeBp, uint16 maxProtocolFeeBp, bytes4 selector, bool isMakerBid, address implementation)

It is emitted when a new strategy is added.

Parameters​

NameTypeDescription
strategyIduint256undefined
standardProtocolFeeBpuint16undefined
minTotalFeeBpuint16undefined
maxProtocolFeeBpuint16undefined
selectorbytes4undefined
isMakerBidboolundefined
implementationaddressundefined

OrderNoncesCancelled​

event OrderNoncesCancelled(address user, uint256[] orderNonces)

It is emitted when order nonces are cancelled for a user.

Parameters​

NameTypeDescription
useraddressundefined
orderNoncesuint256[]undefined

StrategyUpdated​

event StrategyUpdated(uint256 strategyId, bool isActive, uint16 standardProtocolFeeBp, uint16 minTotalFeeBp)

It is emitted when an existing strategy is updated.

Parameters​

NameTypeDescription
strategyIduint256undefined
isActiveboolundefined
standardProtocolFeeBpuint16undefined
minTotalFeeBpuint16undefined

SubsetNoncesCancelled​

event SubsetNoncesCancelled(address user, uint256[] subsetNonces)

It is emitted when subset nonces are cancelled for a user.

Parameters​

NameTypeDescription
useraddressundefined
subsetNoncesuint256[]undefined

Errors​

CreatorFeeBpTooHigh​

error CreatorFeeBpTooHigh()

It is returned if the creator fee (in basis point) is too high.

LengthsInvalid​

error LengthsInvalid()

It is returned if there is either a mismatch or an error in the length of the array(s).

NewProtocolFeeRecipientCannotBeNullAddress​

error NewProtocolFeeRecipientCannotBeNullAddress()

It is returned if the new protocol fee recipient is set to address(0).

NoOngoingTransferInProgress​

error NoOngoingTransferInProgress()

This is returned when there is no transfer of ownership in progress.

NoSelectorForStrategy​

error NoSelectorForStrategy()

It is returned if there is no selector for maker ask/bid for a given strategyId, depending on the quote type.

NotOwner​

error NotOwner()

This is returned when the caller is not the owner.

NotV2Strategy​

error NotV2Strategy()

If the strategy has not set properly its implementation contract.

It can only be returned for owner operations.

OutsideOfTimeRange​

error OutsideOfTimeRange()

It is returned if the current block timestamp is not between start and end times in the maker order.

RenouncementNotInProgress​

error RenouncementNotInProgress()

This is returned when there is no renouncement in progress but the owner tries to validate the ownership renouncement.

StrategyHasNoSelector​

error StrategyHasNoSelector()

It is returned if the strategy has no selector.

It can only be returned for owner operations.

StrategyNotAvailable​

error StrategyNotAvailable(uint256 strategyId)

It is returned if the strategy id has no implementation.

It is returned if there is no implementation address and the strategyId is strictly greater than 0.

Parameters​

NameTypeDescription
strategyIduint256undefined

StrategyNotUsed​

error StrategyNotUsed()

It is returned if the strategyId is invalid.

StrategyProtocolFeeTooHigh​

error StrategyProtocolFeeTooHigh()

It is returned if the strategy's protocol fee is too high.

It can only be returned for owner operations.

TransferAlreadyInProgress​

error TransferAlreadyInProgress()

This is returned when the transfer is already in progress but the owner tries initiate a new ownership transfer.

TransferNotInProgress​

error TransferNotInProgress()

This is returned when there is no ownership transfer in progress but the ownership change tries to be approved.

WrongPotentialOwner​

error WrongPotentialOwner()

This is returned when the ownership transfer is attempted to be validated by the a caller that is not the potential owner.