Integrating a Front End

Anyone is able to create a UI for Perennial. The markets are open for all to interact with & the platform has a method to charge extra fees on flow originating from a particular UI.

While the Perennial team initially created the first markets and user interface, Perennial would prefer to support teams in their efforts to build new & exciting experiences on top of the protocol rather than directly compete.

By integrating Perennial as the underlying markets infrastructure you can reduce the technical burden for developers & improve time to market for new products.

Adding Application Fees

Applications utilizing Perennial's MultiInvoker.sol contract are able to add fees to their order bundles. This allows application developers to focus on creating a great experience for traders/LPs on the front end without having to write Solidity to collect fees on order flow.

See the MultiInvoker.sol section to learn more

MultiInvoker.sol

In order to reduce the amount of transactions required to interact with the protocol & simplify the user experience, the MultiInvoker.sol was developed to batch market actions & liquidity provisioning actions into a single transaction.

For example, a new user wants to create a trade on one of Perennial's markets & pay a fee to the UI. Without the MultiInvoker following 4 transactions would be required:

  1. approve() market #1 to transfer collateral

  2. Request latest oracle price by calling commitPrice()

  3. Make a trade on market #1 by calling update()

  4. Transfer fee to UI developer

Furthermore, every new market the user would interact with they'd need to approve() the collateral for that market. Now compare this with the MultiInvoker:

  1. approve() MultiInvoker to transfer collateral (only required once)

  2. Call invoke():

    1. Request oracle via commitPrice()

    2. Make trade via update()

    3. Transfer fee to UI developer

Example:

In order to your to improve development speed we’ve created an example repo which covers the basic calls you’ll need to populate a UI & submit trades.

See the repo here

Last updated