EthRouter

Git Source

Inherits: ERC721TokenReceiver

Author: out.eth (@outdoteth)

This contract is used to route buy, sell, and change orders to multiple pools in one transaction. It will route the orders to either a private pool or a public pool. If the order goes to a public pool, then users can choose whether or not they would like to pay royalties. The only base token which is supported is native ETH.

State Variables

royaltyRegistry

address public royaltyRegistry;

Functions

receive

receive() external payable;

constructor

constructor(address _royaltyRegistry);

buy

Executes a series of buy operations against public or private pools.

Parameters

Name
Type
Description

buys

Buy[]

The buy operations to execute.

deadline

uint256

The deadline for the transaction to be mined. Will revert if timestamp is greater than deadline. If it's set to 0 then there is no deadline.

payRoyalties

bool

Whether to pay royalties or not.

sell

Executes a series of sell operations against public or private pools.

Parameters

Name
Type
Description

sells

Sell[]

The sell operations to execute.

minOutputAmount

uint256

The minimum amount of output tokens that must be received for the transaction to succeed.

deadline

uint256

The deadline for the transaction to be mined. Will revert if timestamp is greater than deadline. Set to 0 for there to be no deadline.

payRoyalties

bool

Whether to pay royalties or not.

deposit

Executes a deposit to a private pool (transfers NFTs and ETH to the pool).

Parameters

Name
Type
Description

privatePool

address payable

The private pool to deposit to.

nft

address

The NFT contract address.

tokenIds

uint256[]

The token IDs of the NFTs to deposit.

minPrice

uint256

The minimum price of the pool. Will revert if price is smaller than this.

maxPrice

uint256

The maximum price of the pool. Will revert if price is greater than this.

deadline

uint256

The deadline for the transaction to be mined. Will revert if timestamp is greater than deadline. Set to 0 for deadline to be ignored.

change

Executes a series of change operations against a private pool.

Parameters

Name
Type
Description

changes

Change[]

The change operations to execute.

deadline

uint256

The deadline for the transaction to be mined. Will revert if timestamp is greater than deadline. Set to 0 for deadline to be ignored.

getRoyalty

Gets the royalty and recipient for a given NFT and sale price. Looks up the royalty info from the manifold registry.

Parameters

Name
Type
Description

nft

address

tokenId

uint256

The token ID of the NFT.

salePrice

uint256

The sale price of the NFT.

Returns

Name
Type
Description

royaltyFee

uint256

The royalty fee to pay.

recipient

address

The address to pay the royalty fee to.

Errors

DeadlinePassed

OutputAmountTooSmall

PriceOutOfRange

InvalidRoyaltyFee

Structs

Buy

Sell

Change

Last updated