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
Name | Type | Description |
---|---|---|
_owner | address | Owner address |
_protocolFeeRecipient | address | Protocol fee recipient address |
_transferManager | address | Transfer manager address |
_weth | address | Wrapped 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
Name | Type | Description |
---|---|---|
takerAsk | struct OrderStructs.Taker | Taker ask struct |
makerBid | struct OrderStructs.Maker | Maker bid struct |
makerSignature | bytes | Maker signature |
merkleTree | struct OrderStructs.MerkleTree | Merkle tree struct (if the signature contains multiple maker orders) |
affiliate | address | Affiliate 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
Name | Type | Description |
---|---|---|
takerBid | struct OrderStructs.Taker | Taker bid struct |
makerAsk | struct OrderStructs.Maker | Maker ask struct |
makerSignature | bytes | Maker signature |
merkleTree | struct OrderStructs.MerkleTree | Merkle tree struct (if the signature contains multiple maker orders) |
affiliate | address | Affiliate 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
Name | Type | Description |
---|---|---|
takerBids | struct OrderStructs.Taker[] | Array of taker bid structs |
makerAsks | struct OrderStructs.Maker[] | Array of maker ask structs |
makerSignatures | bytes[] | Array of maker signatures |
merkleTrees | struct OrderStructs.MerkleTree[] | Array of merkle tree structs if the signature contains multiple maker orders |
affiliate | address | Affiliate address |
isAtomic | bool | Whether 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
Name | Type | Description |
---|---|---|
takerBid | struct OrderStructs.Taker | Taker bid struct |
makerAsk | struct OrderStructs.Maker | Maker ask struct |
sender | address | Sender address (i.e. the initial msg sender) |
orderHash | bytes32 | Hash of the maker ask order |
Return Values
Name | Type | Description |
---|---|---|
protocolFeeAmount | uint256 | Protocol 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
Name | Type | Description |
---|---|---|
newGasLimitETHTransfer | uint256 | New 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
Name | Type | Description |
---|---|---|
takerAsk | struct OrderStructs.Taker | Taker ask order struct |
makerBid | struct OrderStructs.Maker | Maker bid order struct |
orderHash | bytes32 | Hash of the maker bid order |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | protocolFeeAmount 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
Name | Type | Description |
---|---|---|
takerBid | struct OrderStructs.Taker | Taker bid order struct |
makerAsk | struct OrderStructs.Maker | Maker ask order struct |
sender | address | Sender of the transaction (i.e. msg.sender) |
orderHash | bytes32 | Hash of the maker ask order |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | protocolFeeAmount 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
Name | Type | Description |
---|---|---|
currency | address | Currency address to transfer (address(0) is ETH) |
bidUser | address | Bid user address |
affiliate | address | Affiliate address (address(0) if none) |
totalProtocolFeeAmount | uint256 | Total 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
Name | Type | Description |
---|---|---|
currency | address | Currency address |
sender | address | Sender address |
recipient | address | Recipient address |
amount | uint256 | Amount (in fungible tokens) |