Code Monkey home page Code Monkey logo

l2-auction-sdk's Introduction

L2 Auction SDK

SDK for L2 auction bidders.

Table of Contents

RPC Endpoints

  • L2 RPC (TESTNET):

  • Beta bundle RPC (Testnet):

    • Description: Beta bundle submission RPC
    • URL: https://holesky-api.securerpc.com/v2
    • Method: mev_sendBetaBundle
    • Parameters:
      • txs: List of txs as bundle e.g. [0x2323...,]
      • slot: slot number e.g. "11282389"
    • ChainId: 17000

Bundle JSON Requests and Responses

Example JSON request

{
    "jsonrpc": "2.0",
    "method": "mev_sendBetaBundle",
    "params": [
      {
        "txs": [0x... ],
        "slot": "1001"
      }
    ],
    "id": 8
}

Example JSON response

{
    'jsonrpc': '2.0',
    'id': 1,
    'method': 'mev_sendBetaBundle',
    'result': '0x79e5cba7876f532218ac35a357209800be2362dd2e3f1e6dc5974698f0d7cee4'
}

L1 Bridge

Fund L2 address by sending ETH to the bridge address.

Deployed Address (Testnet)

L1_BRIDGE="0x3Ae5Ca0B05bE12d4FF9983Ed70D86de9C34e820C"

WETH

Deployed Address (Testnet)

WETH="0x4200000000000000000000000000000000000006"

Auction Contracts

Deployed Addresses (Testnet)

AUCTIONEER="0x10DeC79E201FE7b27b8c4A1524d9733727D60ea4"
SETTLEMENT="0x46bb4fE80C04b5C28C761ADdd43FD10fFCcB57CE"
ACCOUNTANT="0x6B5021E079a3941cac287a4F24F411B1Ee87222f"

Registering a bidder

Only registered bidders can participate in the auction. Operators can onboard new bidders through the contract.

To check for bidderId when registered, call IdMap on the contract:

function IdMap(address bidder) external view returns (uint8 id);

Packing a bid

Bids are packed by price, amount, bidderId

    /**
     * @dev Packed Bid details into a uint256 for submission.
     *
     * @param bidPrice Price per item.
     * @param itemsToBuy Items to buy in the auction.
     * @param bidderId Id for bidder
     * @return packedBid for auction submission
     */
    function packBid(uint256 bidPrice, uint256 itemsToBuy, uint256 bidderId)
        external
        pure
        returns (uint256 packedBid);

Winning bid info

After an auction is closed, bidders can query their bid results:

    /**
     * @dev Retrieve information about a bidder after auction settlement.
     *
     * @param slot The slot identifier of the auction.
     * @param bidder The address of the bidder for whom information is requested.
     * @return itemsBought The number of items bought by the bidder in the specified auction.
     * @return amountOwed The amount owed by the bidder for the items bought in the specified auction.
     *
     * Requirements:
     * - The auction must have been settled.
     * - The provided `bidder` address must be valid and have participated in the auction.
     *
     */
    function getBidderInfo(uint256 slot, address bidder)
        external
        view
        returns (uint120 itemsBought, uint128 amountOwed);

Bidder Contracts

Source code for a fully functional open bidder is provided

Bundler Examples

Source code for a fully functional bundler is provided

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License.

l2-auction-sdk's People

Contributors

sandybradley avatar sambacha avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.