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.

function buy(Buy[] calldata buys, uint256 deadline, bool payRoyalties) public payable;

Parameters

sell

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

function sell(Sell[] calldata sells, uint256 minOutputAmount, uint256 deadline, bool payRoyalties) public;

Parameters

deposit

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

function deposit(
    address payable privatePool,
    address nft,
    uint256[] calldata tokenIds,
    uint256 minPrice,
    uint256 maxPrice,
    uint256 deadline
) public payable;

Parameters

change

Executes a series of change operations against a private pool.

function change(Change[] calldata changes, uint256 deadline) public payable;

Parameters

getRoyalty

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

function getRoyalty(address nft, uint256 tokenId, uint256 salePrice)
    public
    view
    returns (uint256 royaltyFee, address recipient);

Parameters

Returns

Errors

DeadlinePassed

error DeadlinePassed();

OutputAmountTooSmall

error OutputAmountTooSmall();

PriceOutOfRange

error PriceOutOfRange();

InvalidRoyaltyFee

error InvalidRoyaltyFee();

Structs

Buy

struct Buy {
    address payable pool;
    address nft;
    uint256[] tokenIds;
    uint256[] tokenWeights;
    PrivatePool.MerkleMultiProof proof;
    uint256 baseTokenAmount;
    bool isPublicPool;
}

Sell

struct Sell {
    address payable pool;
    address nft;
    uint256[] tokenIds;
    uint256[] tokenWeights;
    PrivatePool.MerkleMultiProof proof;
    IStolenNftOracle.Message[] stolenNftProofs;
    bool isPublicPool;
    bytes32[][] publicPoolProofs;
}

Change

struct Change {
    address payable pool;
    address nft;
    uint256[] inputTokenIds;
    uint256[] inputTokenWeights;
    PrivatePool.MerkleMultiProof inputProof;
    uint256[] outputTokenIds;
    uint256[] outputTokenWeights;
    PrivatePool.MerkleMultiProof outputProof;
}

Last updated