diff --git a/apps/developer-hub/content/docs/express-relay/how-to-guides/index.mdx b/apps/developer-hub/content/docs/express-relay/how-to-guides/index.mdx
deleted file mode 100644
index f6ff30c91f..0000000000
--- a/apps/developer-hub/content/docs/express-relay/how-to-guides/index.mdx
+++ /dev/null
@@ -1,8 +0,0 @@
----
-title: Express Relay How-To Guide
-description: A placeholder docs page
----
-
-# How To
-
-Integrate directly with searchers to recapture MEV. Go to market faster. Accelerate your protocol's growth.
diff --git a/apps/developer-hub/content/docs/express-relay/index.mdx b/apps/developer-hub/content/docs/express-relay/index.mdx
index 0f10295067..81d83067e4 100644
--- a/apps/developer-hub/content/docs/express-relay/index.mdx
+++ b/apps/developer-hub/content/docs/express-relay/index.mdx
@@ -6,6 +6,13 @@ icon: Gavel
full: true
---
+import { IntegrationCard } from "../../../src/components/IntegrationCard";
+import {
+ Files,
+ MagnifyingGlass,
+ Question,
+} from "@phosphor-icons/react/dist/ssr";
+
# Introduction
Express Relay is a priority auction which enables better orderflow mechanisms that eliminate [Maximal Extractable Value](https://www.ledger.com/academy/glossary/maximal-extractable-value-mev) (MEV).
@@ -25,11 +32,7 @@ To integrate with Express Relay, you can integrate as a protocol (to power token
colorScheme="blue"
title="Integrate as a Protocol"
description="Power token swaps and recapture MEV with Express Relay integration"
- icon={
-
- }
+ icon={}
/>
-
-
- }
+ icon={}
/>
@@ -55,15 +54,6 @@ To learn more about Express Relay, refer to the following resources:
colorScheme="purple"
title="How Express Relay Works"
description="Understand the mechanics behind Express Relay's priority auction system"
- icon={
-
- }
+ icon={}
/>
diff --git a/apps/developer-hub/content/docs/express-relay/integrate-as-protocol.mdx b/apps/developer-hub/content/docs/express-relay/integrate-as-protocol.mdx
new file mode 100644
index 0000000000..afeac17216
--- /dev/null
+++ b/apps/developer-hub/content/docs/express-relay/integrate-as-protocol.mdx
@@ -0,0 +1,83 @@
+---
+title: "Integrate as a Protocol"
+description: >-
+ Learn how frontends can integrate Express Relay to empower token swapping with better pricing and MEV recapture.
+---
+
+# How to Integrate Express Relay Swaps
+
+This guide will explain how frontends can integrate Express Relay to empower swapping.
+
+## Step 1: Install the Express Relay SDK
+
+Pyth provides a [Typescript SDK](https://www.npmjs.com/package/@pythnetwork/express-relay-js) to help developers integrate Express Relay into their frontends.
+
+You can install the SDK via npm or yarn. You can invoke the SDK client as below:
+
+```typescript
+import { Client } from "@pythnetwork/express-relay-js";
+
+const client = new Client(
+ { baseUrl: "https://per-mainnet.dourolabs.app" },
+ undefined, // Default WebSocket options
+);
+```
+
+## Step 2: Request a Quote
+
+You can request a quote by calling the [**getQuote**](https://github.com/pyth-network/per/blob/281de989db887aaf568fed39315a76acc16548fa/sdk/js/src/index.ts#L501-L506) SDK method.
+
+The example below shows how you can construct a quote request for a USDC → WSOL swap, with 100 USDC provided as input by the user:
+
+```typescript
+const userWallet = new PublicKey("");
+
+const quoteRequest = {
+ chainId: "solana",
+ inputTokenMint: new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"), // USDC mint
+ outputTokenMint: new PublicKey("So11111111111111111111111111111111111111112"), // WSOL mint
+ specifiedTokenAmount: {
+ side: "input",
+ amount: 100_000_000,
+ },
+ userWallet,
+};
+
+const quote = await client.getQuote(quoteRequest);
+```
+
+**quote** contains the full details, including the amount the searcher is quoting and the transaction that the user needs to sign. It also contains an **expirationTime**; after this time, the transaction will no longer succeed on chain, so you should request a new quote a few seconds before the **expirationTime**.
+
+## Step 3: Submit User Signature to the Express Relay Server
+
+Once you show the quote to the user, the user should sign the transaction if they wish to engage in the swap. The frontend can pass this signature along to the Express Relay server, which will handle aggregating all the required signatures for the transaction and submitting it to the RPC node.
+
+Below is an example showing how the frontend can submit the signed quote transaction to the server using the [**submitQuote**](https://github.com/pyth-network/per/blob/358eedc1f9072cdfc3418fba309697580f2474f9/sdk/js/src/index.ts#L537-L542) method. The response from the **getQuote** method includes a field called **referenceId**, which the frontend should use in its submission of the user signature.
+
+```typescript
+const submitQuote = {
+ chainId: "solana",
+ referenceId: quote.referenceId,
+ userSignature: signature,
+};
+
+const txSubmitted = await client.submitQuote(submitQuote);
+```
+
+**submitQuote** returns the fully signed transaction that the server submitted to the RPC node.
+
+## Additional Resources
+
+You may find these additional resources helpful for integrating Express Relay as a frontend.
+
+### Contract Addresses
+
+The [Contract Addresses](./contract-addresses) page lists the relevant addresses for Express Relay integration.
+
+### Error Codes
+
+The [Error Codes](./errors) page lists the error codes returned by Express Relay.
+
+### API Reference
+
+The [API Reference](https://per-mainnet.dourolabs.app/docs) provides detailed information on Express Relay APIs.
diff --git a/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/index.mdx b/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/index.mdx
new file mode 100644
index 0000000000..9297b6db46
--- /dev/null
+++ b/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/index.mdx
@@ -0,0 +1,98 @@
+---
+title: "Integrate as a Searcher"
+description: >-
+ Integrate once and access all existing and future opportunities across integrated DeFi protocols through Express Relay's bidding system.
+---
+
+import { IntegrationCard } from "../../../../src/components/IntegrationCard";
+import { Code } from "@phosphor-icons/react/dist/ssr";
+
+# How to Integrate Express Relay as a Searcher
+
+Express Relay allows searchers to integrate once and access all existing and future opportunities across integrated DeFi protocols. Searchers **bid** on these opportunities exposed by Express Relay.
+
+Express Relay exposes different endpoints for interaction, which can be used directly via HTTP, WebSocket, or one of the SDKs for convenience.
+
+## What is a Searcher?
+
+Searchers are sophisticated actors who monitor blockchain networks for profitable opportunities such as arbitrage, liquidations, and MEV extraction. With Express Relay, searchers can:
+
+- **Access unified opportunities** across multiple integrated DeFi protocols
+- **Compete in fair auctions** for the right to fulfill user transactions
+- **Capture value** while providing better execution for users
+
+## Integration Methods
+
+Express Relay provides multiple ways for searchers to integrate:
+
+- **Direct API integration** using HTTP and WebSocket endpoints
+- **SDK integration** with [Typescript](https://github.com/pyth-network/per/tree/main/sdk/js) and [Python](https://github.com/pyth-network/per/tree/main/sdk/python) SDKs
+- **Real-time subscriptions** for opportunity monitoring
+
+## Integration Process
+
+Searchers can integrate with Express Relay in three key steps:
+
+### Step 1: Subscribe to New Opportunities
+
+Monitor opportunities across integrated DeFi protocols in real-time using Express Relay's WebSocket or HTTP endpoints. Opportunities include:
+
+- **Market orders** from integrated protocols requiring immediate execution
+- **Limit orders** on supported order book systems
+- **Liquidation opportunities** from lending and borrowing protocols
+- **Arbitrage opportunities** across different decentralized exchanges
+
+### Step 2: Construct and Submit Your Bid
+
+Analyze opportunities and construct competitive bids based on:
+
+- **Your execution strategy** and available capital
+- **Gas costs** and transaction efficiency considerations
+- **Expected profit margins** and risk assessment
+- **Competition** from other searchers in the auction
+
+Submit bids to Express Relay's auction system where the highest bidder wins the right to fulfill the opportunity.
+
+### Step 3: Execute Won Opportunities
+
+If your bid wins the auction, execute the opportunity by:
+
+- **Fulfilling the user's transaction** according to the opportunity parameters
+- **Capturing the bid amount** as compensation for providing the service
+- **Ensuring proper execution** to maintain reputation in the system
+
+## Supported Chains
+
+Searchers can currently integrate with Express Relay on **Solana Virtual Machine (SVM)** chains, with support for additional chains coming soon.
+
+## Getting Started
+
+Ready to integrate as a searcher? Start with our detailed integration guides:
+
+
+ }
+ />
+
+
+## Additional Resources
+
+Explore these resources to enhance your searcher integration:
+
+### API Documentation
+
+- **[WebSocket API Reference](./websocket-api-reference)** - Real-time opportunity streaming
+- **[HTTP API Reference](./http-api-reference)** - REST endpoints for opportunities and bidding
+
+### Technical Resources
+
+- **[Contract Addresses](./contract-addresses)** - Smart contract addresses across supported chains
+- **[Error Codes](./errors)** - Complete list of error codes and troubleshooting guide
+
+### Understanding Express Relay
+
+- **[How Express Relay Works](./how-express-relay-works)** - Deep dive into the auction mechanism and architecture
diff --git a/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/meta.json b/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/meta.json
new file mode 100644
index 0000000000..e0250669e5
--- /dev/null
+++ b/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/meta.json
@@ -0,0 +1,4 @@
+{
+ "title": "Integrate as a Searcher",
+ "pages": ["svm"]
+}
diff --git a/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/svm.mdx b/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/svm.mdx
new file mode 100644
index 0000000000..ce6c2e5021
--- /dev/null
+++ b/apps/developer-hub/content/docs/express-relay/integrate-as-searcher/svm.mdx
@@ -0,0 +1,305 @@
+---
+title: "SVM Searcher Integration"
+description: >-
+ Learn how to integrate Express Relay as a searcher on Solana Virtual Machine chains to fulfill market orders and limit orders.
+---
+
+# SVM Searcher Integration
+
+SVM Express Relay searchers fulfill market order opportunities as well as limit orders on the [Limo](https://solscan.io/account/LiMoM9rMhrdYrfzUCxQppvxCSG1FcrUK9G8uLq4A1GF) program.
+
+## Step 1: Subscribe to New Opportunities
+
+Express Relay provides searchers with [Typescript](https://github.com/pyth-network/per/tree/358eedc1f9072cdfc3418fba309697580f2474f9/sdk/js) and [Python](https://github.com/pyth-network/per/tree/358eedc1f9072cdfc3418fba309697580f2474f9/sdk/python) SDKs to interact with Express Relay. Searchers can also directly fetch available opportunities via HTTP or subscribe to them via WebSocket.
+
+### Typescript SDK
+
+Pyth provides a Typescript SDK, which allows searchers to subscribe to opportunities:
+
+```typescript
+import { Client, Opportunity } from "@pythnetwork/express-relay-js";
+
+const handleOpportunity = async (opportunity: Opportunity) => {
+ console.log("Received opportunity");
+ // Implement your opportunity handler here
+};
+
+const client = new Client(
+ { baseUrl: "https://per-mainnet.dourolabs.app" },
+ undefined, // Default WebSocket options
+ handleOpportunity,
+);
+
+async function main() {
+ await client.subscribeChains(["solana"]);
+}
+
+main();
+```
+
+### Python SDK
+
+Pyth provides a Python SDK, which allows searchers to subscribe to opportunities:
+
+```python
+import asyncio
+from express_relay.client import (
+ ExpressRelayClient,
+)
+from express_relay.models import Opportunity
+
+async def opportunity_callback(opportunity: Opportunity):
+ print("Received opportunity")
+ # Implement your opportunity handler here
+
+client = ExpressRelayClient(
+ "https://per-mainnet.dourolabs.app",
+ None,
+ opportunity_callback,
+ None,
+)
+
+async def main():
+ await client.subscribe_chains(["solana"])
+ task = await client.get_ws_loop()
+ await task
+
+if __name__ == "__main__":
+ asyncio.run(main())
+```
+
+### HTTP API
+
+Searchers can request opportunities through an HTTP **GET** call to the [/v1/opportunities](https://per-mainnet.dourolabs.app/docs#tag/opportunity/operation/get_opportunities) endpoint.
+
+```bash
+curl -X 'GET' \
+ 'https://per-mainnet.dourolabs.app/v1/opportunities?chain_id=solana&mode=live'
+```
+
+Opportunities are short-lived and could be executed in a matter of seconds. So, the above endpoint could return an empty response.
+
+### WebSocket API
+
+Searchers can connect to the server via WebSocket to reduce latency and subscribe to various events. The WebSocket endpoint lives at `/v1/ws` (e.g `wss://per-mainnet.dourolabs.app/v1/ws`). Here is a sample JSON payload to subscribe to opportunities:
+
+```json
+{
+ "id": "1",
+ "method": "subscribe",
+ "params": {
+ "chain_ids": ["solana"]
+ }
+}
+```
+
+Consult the [Websocket API reference](../websocket-api-reference) for a complete list of methods and parameters.
+
+The server responds with opportunities in the following format:
+
+```json
+{
+ "order": "UxMUbQAsjrfQUp5stVwMJ6Mucq7VWTvt4ICe69BJ8lVXqwM+0sysV8OqZTdM0W4p...", // The Limo order to be executed, encoded in base64
+ "order_address": "DUcTi3rDyS5QEmZ4BNRBejtArmDCWaPYGfN44vBJXKL5", // Address of the order account
+ "program": "limo", // Identifier of the program that the order exists in
+ "chain_id": "development-solana",
+ "version": "v1" // Opportunity format version
+}
+```
+
+## Step 2: Construct the Bid
+
+Searchers should construct a bid by evaluating the fetched opportunity.
+
+> **Warning**: Before constructing the bid, make sure your wallet has the required assets to fulfill the limit order and SOL to pay the bid amount.
+
+See the following examples of how to construct a bid object via the SDKs:
+
+### Typescript SDK
+
+Below is an excerpt of example code. See the full example in the [Typescript SDK](https://github.com/pyth-network/per/blob/4be711525948cf24c0ebd4ebab007dc7f51b7069/sdk/js/src/examples/simpleSearcherLimo.ts).
+
+```typescript
+import { OpportunitySvm } from "../index";
+import { BidSvm } from "../types";
+
+import * as anchor from "@coral-xyz/anchor";
+import * as limo from "@kamino-finance/limo-sdk";
+
+/**
+ * Generates a bid for a given opportunity.
+ * The transaction in this bid transfers assets from the searcher's wallet to fulfill the limit order.
+ * @param opportunity The SVM opportunity to bid on.
+ * @returns The generated bid object.
+ */
+async generateBid(opportunity: OpportunitySvm): Promise {
+ const order = opportunity.order;
+ const limoClient = new limo.LimoClient(
+ this.connectionSvm,
+ order.state.globalConfig
+ );
+
+ const { bid: bidAmountLamports, transaction } = await this.fulfillLimoOrder(
+ limoClient,
+ order,
+ this.searcherKeypair,
+ this.bidAmountLamports
+ );
+
+ return {
+ amount: bidAmountLamports.toString(),
+ transaction: transaction,
+ valid_until: this.getValidUntil(),
+ };
+}
+```
+
+### Python SDK
+
+Below is an excerpt of example code. See the full example in the [Python SDK](https://github.com/pyth-network/per/blob/4be711525948cf24c0ebd4ebab007dc7f51b7069/sdk/python/express_relay/examples/simple_searcher_limo.py).
+
+```python
+import asyncio
+from typing import Dict, Any
+
+from solders.keypair import Keypair # type: ignore
+from solders.transaction import VersionedTransaction # type: ignore
+
+async def construct_bid(self, opportunity: Dict[str, Any]) -> Dict[str, Any]:
+ """
+ Constructs a bid for the given opportunity.
+ """
+ order = opportunity["order"]
+ order_address = opportunity["order_address"]
+
+ # Calculate bid amount and construct fulfillment transaction
+ bid_amount, transaction = await self.fulfill_limo_order(
+ order, order_address, self.searcher_keypair, self.bid_amount_lamports
+ )
+
+ return {
+ "amount": str(bid_amount),
+ "transaction": transaction,
+ "valid_until": self.get_valid_until(),
+ }
+```
+
+## Step 3: Submit the Bid
+
+After constructing the bid, searchers should submit it to Express Relay to participate in the auction.
+
+### Typescript SDK
+
+```typescript
+// Submit the bid to Express Relay
+const bidResponse = await client.submitBid(bid);
+console.log("Bid submitted:", bidResponse);
+```
+
+### Python SDK
+
+```python
+# Submit the bid to Express Relay
+bid_response = await client.submit_bid(bid)
+print(f"Bid submitted: {bid_response}")
+```
+
+### HTTP API
+
+Searchers can submit bids through an HTTP **POST** call to the [/v1/bids](https://per-mainnet.dourolabs.app/docs#tag/bid/operation/post_bid) endpoint.
+
+```bash
+curl -X 'POST' \
+ 'https://per-mainnet.dourolabs.app/v1/bids' \
+ -H 'accept: application/json' \
+ -H 'Content-Type: application/json' \
+ -d '{
+ "amount": "1000000",
+ "transaction": "...",
+ "chain_id": "solana",
+ "valid_until": "2024-05-30T13:23:00.000Z"
+ }'
+```
+
+## Step 4: Monitor Bid Results
+
+After submitting a bid, searchers should monitor whether their bid was accepted and the transaction was successfully executed.
+
+### Winning Bids
+
+If your bid wins the auction, Express Relay will execute your transaction on-chain. You can monitor the transaction status through:
+
+- **Transaction hash** returned in the bid response
+- **WebSocket notifications** for bid status updates
+- **HTTP polling** of bid status endpoints
+
+### Failed Bids
+
+If your bid is not selected or execution fails, you'll receive appropriate error notifications. Common reasons for bid failure include:
+
+- **Insufficient bid amount** - Another searcher bid higher
+- **Transaction execution failure** - Insufficient funds or invalid transaction
+- **Timeout** - Bid submitted after opportunity expired
+
+## Error Handling
+
+Implement proper error handling for common scenarios:
+
+### Network Errors
+
+```typescript
+try {
+ const bidResponse = await client.submitBid(bid);
+} catch (error) {
+ if (error.code === "NETWORK_ERROR") {
+ // Retry submission
+ console.log("Network error, retrying...");
+ }
+}
+```
+
+### Invalid Opportunities
+
+```typescript
+const handleOpportunity = async (opportunity: Opportunity) => {
+ try {
+ // Validate opportunity before bidding
+ if (!isValidOpportunity(opportunity)) {
+ console.log("Invalid opportunity, skipping");
+ return;
+ }
+
+ const bid = await generateBid(opportunity);
+ await client.submitBid(bid);
+ } catch (error) {
+ console.error("Error processing opportunity:", error);
+ }
+};
+```
+
+## Best Practices
+
+### Performance Optimization
+
+- **Use WebSocket connections** for real-time opportunity updates
+- **Implement efficient bid calculation** to minimize latency
+- **Cache frequently used data** like token prices and account information
+
+### Risk Management
+
+- **Set maximum bid amounts** to control potential losses
+- **Implement position limits** to manage overall exposure
+- **Monitor profitability** and adjust strategies accordingly
+
+### Monitoring and Logging
+
+- **Log all opportunities** received for analysis
+- **Track bid success rates** and profitability metrics
+- **Monitor system health** and performance indicators
+
+## Additional Resources
+
+- [Express Relay HTTP API Documentation](../http-api-reference)
+- [WebSocket API Reference](../websocket-api-reference)
+- [Contract Addresses](../contract-addresses)
+- [Error Codes Reference](../errors)
diff --git a/apps/developer-hub/content/docs/express-relay/meta.json b/apps/developer-hub/content/docs/express-relay/meta.json
index 37cb671029..f1ac3ac4cf 100644
--- a/apps/developer-hub/content/docs/express-relay/meta.json
+++ b/apps/developer-hub/content/docs/express-relay/meta.json
@@ -3,5 +3,17 @@
"title": "Express Relay",
"description": "Eliminate MEV",
"icon": "Gavel",
- "pages": ["index", "---Guides---", "how-to-guides"]
+ "pages": [
+ "index",
+ "---How-To Guides---",
+ "integrate-as-protocol",
+ "integrate-as-searcher",
+ "---Reference Material---",
+ "http-api-reference",
+ "websocket-api-reference",
+ "contract-addresses",
+ "errors",
+ "---Understanding Express Relay---",
+ "how-express-relay-works"
+ ]
}
diff --git a/apps/developer-hub/src/components/IntegrationCard/index.tsx b/apps/developer-hub/src/components/IntegrationCard/index.tsx
index 80467970e0..76c7e7708a 100644
--- a/apps/developer-hub/src/components/IntegrationCard/index.tsx
+++ b/apps/developer-hub/src/components/IntegrationCard/index.tsx
@@ -6,6 +6,24 @@ type IntegrationCardProps = {
colorScheme?: "blue" | "green" | "purple";
};
+const colorClasses = {
+ blue: {
+ bg: "bg-blue-100 dark:bg-blue-900",
+ text: "text-blue-600 dark:text-blue-400",
+ hoverText: "group-hover:text-blue-600 dark:group-hover:text-blue-400",
+ },
+ green: {
+ bg: "bg-green-100 dark:bg-green-900",
+ text: "text-green-600 dark:text-green-400",
+ hoverText: "group-hover:text-green-600 dark:group-hover:text-green-400",
+ },
+ purple: {
+ bg: "bg-purple-100 dark:bg-purple-900",
+ text: "text-purple-600 dark:text-purple-400",
+ hoverText: "group-hover:text-purple-600 dark:group-hover:text-purple-400",
+ },
+};
+
export const IntegrationCard = ({
href,
icon,
@@ -13,24 +31,6 @@ export const IntegrationCard = ({
description,
colorScheme = "blue",
}: IntegrationCardProps) => {
- const colorClasses = {
- blue: {
- bg: "bg-blue-100 dark:bg-blue-900",
- text: "text-blue-600 dark:text-blue-400",
- hoverText: "group-hover:text-blue-600 dark:group-hover:text-blue-400",
- },
- green: {
- bg: "bg-green-100 dark:bg-green-900",
- text: "text-green-600 dark:text-green-400",
- hoverText: "group-hover:text-green-600 dark:group-hover:text-green-400",
- },
- purple: {
- bg: "bg-purple-100 dark:bg-purple-900",
- text: "text-purple-600 dark:text-purple-400",
- hoverText: "group-hover:text-purple-600 dark:group-hover:text-purple-400",
- },
- };
-
const colors = colorClasses[colorScheme];
return (
diff --git a/apps/developer-hub/src/mdx-components.tsx b/apps/developer-hub/src/mdx-components.tsx
index d13fc7ba15..c6a3bb3106 100644
--- a/apps/developer-hub/src/mdx-components.tsx
+++ b/apps/developer-hub/src/mdx-components.tsx
@@ -3,8 +3,6 @@ import { Tab, Tabs } from "fumadocs-ui/components/tabs";
import defaultMdxComponents from "fumadocs-ui/mdx";
import type { MDXComponents } from "mdx/types";
-import { IntegrationCard } from "./components/IntegrationCard";
-
export function getMDXComponents(components?: MDXComponents): MDXComponents {
return {
...defaultMdxComponents,
@@ -14,6 +12,5 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents {
InfoBox: InfoBox,
// Fuma has a Callout component in `defaultMdxComponents` which we still want to overwrite
Callout: InfoBox,
- IntegrationCard,
};
}
diff --git a/target_chains/ethereum/entropy_sdk/solidity/IEntropy.sol b/target_chains/ethereum/entropy_sdk/solidity/IEntropy.sol
index 0990d1a30b..90085429bb 100644
--- a/target_chains/ethereum/entropy_sdk/solidity/IEntropy.sol
+++ b/target_chains/ethereum/entropy_sdk/solidity/IEntropy.sol
@@ -45,10 +45,11 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
//
// This method will revert unless the caller provides a sufficient fee (at least getFee(provider)) as msg.value.
// Note that excess value is *not* refunded to the caller.
- function request(address provider, bytes32 userCommitment, bool useBlockHash)
- external
- payable
- returns (uint64 assignedSequenceNumber);
+ function request(
+ address provider,
+ bytes32 userCommitment,
+ bool useBlockHash
+ ) external payable returns (uint64 assignedSequenceNumber);
// Request a random number. The method expects the provider address and a secret random number
// in the arguments. It returns a sequence number.
@@ -64,10 +65,10 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
//
// This method will revert unless the caller provides a sufficient fee (at least `getFee(provider)`) as msg.value.
// Note that excess value is *not* refunded to the caller.
- function requestWithCallback(address provider, bytes32 userRandomNumber)
- external
- payable
- returns (uint64 assignedSequenceNumber);
+ function requestWithCallback(
+ address provider,
+ bytes32 userRandomNumber
+ ) external payable returns (uint64 assignedSequenceNumber);
// Fulfill a request for a random number. This method validates the provided userRandomness and provider's proof
// against the corresponding commitments in the in-flight request. If both values are validated, this function returns
@@ -76,9 +77,12 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
// Note that this function can only be called once per in-flight request. Calling this function deletes the stored
// request information (so that the contract doesn't use a linear amount of storage in the number of requests).
// If you need to use the returned random number more than once, you are responsible for storing it.
- function reveal(address provider, uint64 sequenceNumber, bytes32 userRevelation, bytes32 providerRevelation)
- external
- returns (bytes32 randomNumber);
+ function reveal(
+ address provider,
+ uint64 sequenceNumber,
+ bytes32 userRevelation,
+ bytes32 providerRevelation
+ ) external returns (bytes32 randomNumber);
// Fulfill a request for a random number. This method validates the provided userRandomness
// and provider's revelation against the corresponding commitment in the in-flight request. If both values are validated
@@ -97,22 +101,30 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
bytes32 providerRevelation
) external;
- function getProviderInfo(address provider) external view returns (EntropyStructs.ProviderInfo memory info);
+ function getProviderInfo(
+ address provider
+ ) external view returns (EntropyStructs.ProviderInfo memory info);
- function getRequest(address provider, uint64 sequenceNumber)
- external
- view
- returns (EntropyStructs.Request memory req);
+ function getRequest(
+ address provider,
+ uint64 sequenceNumber
+ ) external view returns (EntropyStructs.Request memory req);
// Get the fee charged by provider for a request with the default gasLimit (`request` or `requestWithCallback`).
// If you are calling any of the `requestV2` methods, please use `getFeeV2`.
function getFee(address provider) external view returns (uint128 feeAmount);
- function getAccruedPythFees() external view returns (uint128 accruedPythFeesInWei);
+ function getAccruedPythFees()
+ external
+ view
+ returns (uint128 accruedPythFeesInWei);
function setProviderFee(uint128 newFeeInWei) external;
- function setProviderFeeAsFeeManager(address provider, uint128 newFeeInWei) external;
+ function setProviderFeeAsFeeManager(
+ address provider,
+ uint128 newFeeInWei
+ ) external;
function setProviderUri(bytes calldata newUri) external;
@@ -131,13 +143,19 @@ interface IEntropy is EntropyEvents, EntropyEventsV2, IEntropyV2 {
// Advance the provider commitment and increase the sequence number.
// This is used to reduce the `numHashes` required for future requests which leads to reduced gas usage.
- function advanceProviderCommitment(address provider, uint64 advancedSequenceNumber, bytes32 providerRevelation)
- external;
+ function advanceProviderCommitment(
+ address provider,
+ uint64 advancedSequenceNumber,
+ bytes32 providerRevelation
+ ) external;
- function constructUserCommitment(bytes32 userRandomness) external pure returns (bytes32 userCommitment);
+ function constructUserCommitment(
+ bytes32 userRandomness
+ ) external pure returns (bytes32 userCommitment);
- function combineRandomValues(bytes32 userRandomness, bytes32 providerRandomness, bytes32 blockHash)
- external
- pure
- returns (bytes32 combinedRandomness);
+ function combineRandomValues(
+ bytes32 userRandomness,
+ bytes32 providerRandomness,
+ bytes32 blockHash
+ ) external pure returns (bytes32 combinedRandomness);
}