Ir al contenido principal

LooksRareProtocol

This contract is the core smart contract of the LooksRare protocol ("v2"). It is the main entry point for users to initiate transactions with taker orders and manage the cancellation of maker orders, which exist off-chain.

WETH

address WETH

Wrapped ETH.

chainId

uint256 chainId

Current chainId.

domainSeparator

bytes32 domainSeparator

Current domain separator.

constructor

constructor(address _owner, address _protocolFeeRecipient, address _transferManager, address _weth) public

Constructor

Parameters

NameTypeDescription
_owneraddressOwner address
_protocolFeeRecipientaddressProtocol fee recipient address
_transferManageraddressTransfer manager address
_wethaddressWrapped ETH address

executeTakerAsk

function executeTakerAsk(struct OrderStructs.Taker takerAsk, struct OrderStructs.Maker makerBid, bytes makerSignature, struct OrderStructs.MerkleTree merkleTree, address affiliate) external

This function allows a user to execute a taker ask (against a maker bid).

Parameters

NameTypeDescription
takerAskstruct OrderStructs.TakerTaker ask struct
makerBidstruct OrderStructs.MakerMaker bid struct
makerSignaturebytesMaker signature
merkleTreestruct OrderStructs.MerkleTreeMerkle tree struct (if the signature contains multiple maker orders)
affiliateaddressAffiliate address

executeTakerBid

function executeTakerBid(struct OrderStructs.Taker takerBid, struct OrderStructs.Maker makerAsk, bytes makerSignature, struct OrderStructs.MerkleTree merkleTree, address affiliate) external payable

This function allows a user to execute a taker bid (against a maker ask).

Parameters

NameTypeDescription
takerBidstruct OrderStructs.TakerTaker bid struct
makerAskstruct OrderStructs.MakerMaker ask struct
makerSignaturebytesMaker signature
merkleTreestruct OrderStructs.MerkleTreeMerkle tree struct (if the signature contains multiple maker orders)
affiliateaddressAffiliate address

executeMultipleTakerBids

function executeMultipleTakerBids(struct OrderStructs.Taker[] takerBids, struct OrderStructs.Maker[] makerAsks, bytes[] makerSignatures, struct OrderStructs.MerkleTree[] merkleTrees, address affiliate, bool isAtomic) external payable

This function allows a user to batch buy with an array of taker bids (against an array of maker asks).

Parameters

NameTypeDescription
takerBidsstruct OrderStructs.Taker[]Array of taker bid structs
makerAsksstruct OrderStructs.Maker[]Array of maker ask structs
makerSignaturesbytes[]Array of maker signatures
merkleTreesstruct OrderStructs.MerkleTree[]Array of merkle tree structs if the signature contains multiple maker orders
affiliateaddressAffiliate address
isAtomicboolWhether the execution should be atomic i.e. whether it should revert if 1 or more transactions fail

restrictedExecuteTakerBid

function restrictedExecuteTakerBid(struct OrderStructs.Taker takerBid, struct OrderStructs.Maker makerAsk, address sender, bytes32 orderHash) external returns (uint256 protocolFeeAmount)

This function is used to do a non-atomic matching in the context of a batch taker bid.

This function is only callable by this contract. It is used for non-atomic batch order matching.

Parameters

NameTypeDescription
takerBidstruct OrderStructs.TakerTaker bid struct
makerAskstruct OrderStructs.MakerMaker ask struct
senderaddressSender address (i.e. the initial msg sender)
orderHashbytes32Hash of the maker ask order

Return Values

NameTypeDescription
protocolFeeAmountuint256Protocol fee amount

updateDomainSeparator

function updateDomainSeparator() external

This function allows the owner to update the domain separator (if possible).

Only callable by owner. If there is a fork of the network with a new chainId, it allows the owner to reset the domain separator for the new chain id.

updateETHGasLimitForTransfer

function updateETHGasLimitForTransfer(uint256 newGasLimitETHTransfer) external

This function allows the owner to update the maximum ETH gas limit for a standard transfer.

Only callable by owner.

Parameters

NameTypeDescription
newGasLimitETHTransferuint256New gas limit for ETH transfer

_executeTakerAsk

function _executeTakerAsk(struct OrderStructs.Taker takerAsk, struct OrderStructs.Maker makerBid, bytes32 orderHash) internal returns (uint256)

This function is internal and is used to execute a taker ask (against a maker bid).

Parameters

NameTypeDescription
takerAskstruct OrderStructs.TakerTaker ask order struct
makerBidstruct OrderStructs.MakerMaker bid order struct
orderHashbytes32Hash of the maker bid order

Return Values

NameTypeDescription
[0]uint256protocolFeeAmount Protocol fee amount

_executeTakerBid

function _executeTakerBid(struct OrderStructs.Taker takerBid, struct OrderStructs.Maker makerAsk, address sender, bytes32 orderHash) internal returns (uint256)

This function is internal and is used to execute a taker bid (against a maker ask).

Parameters

NameTypeDescription
takerBidstruct OrderStructs.TakerTaker bid order struct
makerAskstruct OrderStructs.MakerMaker ask order struct
senderaddressSender of the transaction (i.e. msg.sender)
orderHashbytes32Hash of the maker ask order

Return Values

NameTypeDescription
[0]uint256protocolFeeAmount Protocol fee amount

_payProtocolFeeAndAffiliateFee

function _payProtocolFeeAndAffiliateFee(address currency, address bidUser, address affiliate, uint256 totalProtocolFeeAmount) internal

This function is internal and is used to pay the protocol fee and affiliate fee (if any).

Parameters

NameTypeDescription
currencyaddressCurrency address to transfer (address(0) is ETH)
bidUseraddressBid user address
affiliateaddressAffiliate address (address(0) if none)
totalProtocolFeeAmountuint256Total protocol fee amount (denominated in the currency)

_transferFungibleTokens

function _transferFungibleTokens(address currency, address sender, address recipient, uint256 amount) internal

This function is internal and is used to transfer fungible tokens.

Parameters

NameTypeDescription
currencyaddressCurrency address
senderaddressSender address
recipientaddressRecipient address
amountuint256Amount (in fungible tokens)