Skip to Content

Builder Codes

Builder Codes (DBC) let integrators earn fees by routing flow. In practice, you initialize a revenue share account for the builder, and users initialize a revenue share escrow and approve builders.

Builder: initialize revenue share

await builderClient.initializeRevenueShare(builderAuthority);
Method DriftClient.initializeRevenueShareReference ↗
Parameters:
NameTypeDefault
authorityPublicKey
txParamsTxParams
Returns:
Promise<string>

User: initialize escrow

await userClient.initializeRevenueShareEscrow(takerAuthority, 16);
Method DriftClient.initializeRevenueShareEscrowReference ↗
Parameters:
NameTypeDefault
authorityPublicKey
numOrdersnumber
txParamsTxParams
Returns:
Promise<string>

User: approve a builder (max fee)

// max fee is expressed in tenths of a basis point (100 = 10 bps) await userClient.changeApprovedBuilder(builderAuthority, 200, true);
Method DriftClient.changeApprovedBuilderReference ↗
Parameters:
NameTypeDefault
builderPublicKey

The public key of the builder to add or update.

maxFeeTenthBpsnumber

The maximum fee tenth bps to set for the builder.

addboolean

Whether to add or update the builder. If the builder already exists, add = true will update the maxFeeTenthBps, otherwise it will add the builder. If add = false, the builder’s maxFeeTenthBps will be set to 0.

txParamsTxParams

The transaction parameters to use for the transaction.

Returns:
Promise<string>
Last updated on