|
| 1 | +# Revenue Share |
| 2 | + |
| 3 | +rder Router Rev Share enables third-party order routers to direct orders to dYdX and earn a portion of the trading fees (maker and taker). The revenue share, specified in parts per million (ppm), must be voted in via Governance and set in the `order_router_address` field in the order message itself. |
| 4 | + |
| 5 | +The revenue will be distributed based on filled orders that were routed through the participating order router. |
| 6 | + |
| 7 | +Order router details and revenue share percentages can be monitored through the indexer using the `/orders` and `/fills` endpoints. The `/orders` endpoint provides information on the order router address, while the `/fills` endpoint shows the order router address and the specific revenue amount distributed per fill. |
| 8 | + |
| 9 | +To participate in the Order Router Rev Share program, users need to propose and have a passing vote for their order router address & revenue split. |
| 10 | + |
| 11 | +- The maximum revenue share allowed is `800,000` ppm (80% of trading fees). |
| 12 | +- Affiliate revenue takes priority in the distribution hierarchy. |
| 13 | +- If there is an active affiliate split that has not reached its maximum within a 30-day rolling window, no revenue will be shared with the order router |
| 14 | + |
| 15 | +## Implementation Details |
| 16 | + |
| 17 | +::::steps |
| 18 | + |
| 19 | +## Voting in via Governance |
| 20 | + |
| 21 | +To participate in the Order Router Rev Share program, you need to create and submit a governance proposal. Below is an example of what the governance message structure looks like: |
| 22 | +```json |
| 23 | +message Order { |
| 24 | +"messages": [ |
| 25 | + { |
| 26 | + "@type": "/dydxprotocol.revshare.MsgSetOrderRouterRevShare", |
| 27 | + "authority": authority, |
| 28 | + "order_router_rev_share": { |
| 29 | + "address": {{your address}}, |
| 30 | + "sharePpm": {{your requested ppm}}, |
| 31 | + } |
| 32 | + } |
| 33 | +] |
| 34 | +} |
| 35 | +``` |
| 36 | +The key components of this message are: |
| 37 | + |
| 38 | +- `address` - The address of the order router that will receive the revenue share. This is also the id you place in your order message |
| 39 | +- `sharePpm` - The revenue share percentage in parts per million (ppm). This should be between `[0, 800,000)` ppm |
| 40 | + |
| 41 | +After submitting the proposal, it must go through the standard governance voting process and receive a passing vote before the order router address and revenue share percentage are activated in the system. |
| 42 | + |
| 43 | +## Updating Revenue Share (Optional) |
| 44 | + |
| 45 | +The process for updating an existing order router's revenue share is the same as setting up a new one. You will need to submit a governance proposal with the updated parameters. |
| 46 | + |
| 47 | +To update the revenue share percentage for an existing order router, create a governance message with the same structure: |
| 48 | + |
| 49 | +```json |
| 50 | +"messages": [ |
| 51 | + { |
| 52 | + "@type": "/dydxprotocol.revshare.MsgSetOrderRouterRevShare", |
| 53 | + "authority": authority, |
| 54 | + "order_router_rev_share": { |
| 55 | + "address": {{your existing address}}, |
| 56 | + "sharePpm": {{your new requested ppm}}, |
| 57 | + } |
| 58 | + } |
| 59 | +] |
| 60 | +``` |
| 61 | + |
| 62 | +The proposal must go through the standard governance voting process and receive a passing vote before the updated revenue share percentage takes effect. |
| 63 | + |
| 64 | +Note that: |
| 65 | + |
| 66 | +- The updated sharePpm must still be within the allowable range of `[0, 800,000)` ppm |
| 67 | +- You must use the exact same address that was previously approved |
| 68 | +- The update will completely replace the previous configuration once approved |
| 69 | + |
| 70 | +## Deleting an Order Router Rev Share (Optional) |
| 71 | + |
| 72 | +To delete an order router's revenue share configuration, you simply need to set the revenue share percentage to 0. This process follows the same governance workflow as setting up or updating a revenue share. |
| 73 | + |
| 74 | +Submit a governance proposal with the following message structure: |
| 75 | +```json |
| 76 | +"messages": [ |
| 77 | + { |
| 78 | + "@type": "/dydxprotocol.revshare.MsgSetOrderRouterRevShare", |
| 79 | + "authority": authority, |
| 80 | + "order_router_rev_share": { |
| 81 | + "address": {{your existing address}}, |
| 82 | + "sharePpm": 0, |
| 83 | + } |
| 84 | + } |
| 85 | +] |
| 86 | +``` |
| 87 | + |
| 88 | +Key points to note: |
| 89 | + |
| 90 | +- Setting `sharePpm` to 0 effectively disables the revenue share for that order router |
| 91 | +- The address must match the previously approved order router address |
| 92 | +- The proposal must still pass through the standard governance voting process |
| 93 | +- Once approved, the order router will no longer receive any revenue share |
| 94 | + |
| 95 | +After the proposal passes, any orders that include this order router address will no longer generate revenue share for the router. |
| 96 | + |
| 97 | +## Changes to the Order Message |
| 98 | +The `order_router_address` field is set when an order is placed |
| 99 | + |
| 100 | +- `order_router_address` - the ID of the order router and where fees will be sent to |
| 101 | + |
| 102 | +```go |
| 103 | +message Order { |
| 104 | + // The unique ID of this order. Meant to be unique across all orders. |
| 105 | + OrderId order_id = 1 [ (gogoproto.nullable) = false ]; |
| 106 | + ... |
| 107 | + // order_router_address is the metadata for the frontend order router. |
| 108 | + string order_router_address = 13; |
| 109 | +} |
| 110 | +``` |
| 111 | + |
| 112 | +## Order Validation Checks |
| 113 | + |
| 114 | +- Ensure the `order_router_address` field is valid and already voted in via governance |
| 115 | + |
| 116 | +:::: |
0 commit comments