deBridge
  • Introduction
  • The deBridge Messaging Protocol
    • Protocol Overview
    • Fees and Supported Chains
    • 🟒Deployed Contracts
    • Development Guides
      • Building an EVM-based dApp
        • EVM smart contract interfaces
          • Interfaces
            • ICallProxy
            • IDeBridgeGate
            • IDeBridgeToken
            • IDeBridgeTokenDeployer
            • IOraclesManager
            • ISignatureVerifier
            • IWethGate
          • Libraries
            • Flags
          • Periphery
            • CallProxy
            • DeBridgeToken
            • DeBridgeTokenProxy
            • SimpleFeeProxy
          • Transfers
            • DeBridgeGate
            • DeBridgeTokenDeployer
            • OraclesManager
            • SignatureVerifier
            • WethGate
      • Sending cross-chain messages from Solana
        • On-Chain external call preparation for Solana
        • Off-chain external call preparation for Solana
      • Lifecycle of a cross-chain call
      • Gathering data for the claim
    • Development Tools
    • Security
    • Slashing and Delegated Staking
  • πŸ”DLN: The deBridge Liquidity Network Protocol
    • Introduction
    • Protocol Overview
    • deBridge Hooks
    • Fees and Supported Chains
    • 🟒Deployed Contracts
    • Market and Limit Orders
    • Integration Guidelines
      • Interacting with the API
        • Authentication
        • Creating an Order
          • Quick Start
          • API Parameters
            • Estimation-Only
            • prependOperatingExpenses
          • API Response
            • JSON Example
          • Refreshing Estimates
        • Tracking Order Status
          • Order States
        • Integrating deBridge hooks
          • Creating Hook data for Solana
        • Submitting an Order Creation Transaction
        • Cancelling the Order
      • deBridge Widget
      • Interacting with smart contracts
        • Placing orders
        • Filling orders
      • Under the Hood
        • Reserve Assets
        • Bridging Reserve Assets
        • Bridging Non-Reserve Assets
        • Order Fulfillment
          • Detecting the Order
          • Fulfilling the Order
            • Pre-Fill-Swap
          • Claiming the Order
      • Affiliate fees
        • Withdrawing Affiliate Fees
      • Fees and operating expenses
    • Interacting with the deBridge App
      • Custom Linking
    • Protocol specs
      • Deterministic order ID
      • Hook data
        • Anatomy of a Hook for the EVM-based chains
        • Anatomy of a Hook for Solana
  • πŸ’ΈdePort
    • Getting started
    • Transfers Flow
  • ⚑deBridge Points
    • Referrers Overview
    • Integrators Overview
  • 🌐deBridge IaaS
    • Getting started
  • 🌐Legal
    • SDK & API License Agreement
  • External Links
    • deBridge Use Cases
      • πŸ’‘Examples
    • Talks, Videos, and Articles
    • Website
    • Github
    • Twitter
    • Social channels
      • Discord
      • Facebook
      • LinkedIn
      • Medium
      • Telegram
      • YouTube
Powered by GitBook
On this page

Was this helpful?

  1. DLN: The deBridge Liquidity Network Protocol
  2. Integration Guidelines
  3. Affiliate fees

Withdrawing Affiliate Fees

PreviousAffiliate feesNextFees and operating expenses

Last updated 6 days ago

Was this helpful?

Affiliate fees can be specified by any integration using the or the . The fees are free to be distributed to the designated beneficiary once β€”typically within a few hours after the order execution.

EVM chains

On EVM chains, affiliate fees are automatically transferred to the specified beneficiary address as part of the transaction in which the solver unlocks liquidity. No additional action is required.

Solana

On Solana, affiliate fees must be claimed manually by the beneficiary. This is done by invoking the withdrawAffiliateFee method of the DLN program. A complete working example for claiming affiliate fees in bulk is available .

Simplified example snippet:

import { Solana } from "@debridge-finance/dln-client"
import { Connection, PublicKey, clusterApiUrl } from "@solana/web3.js";

function findAssociatedTokenAddress(wallet: PublicKey, tokenMint: PublicKey)
    : [PublicKey, number] {
    return PublicKey.findProgramAddressSync(
        [wallet.toBytes(), 
        new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA").toBytes(), 
        tokenMint.toBytes()], 
        new PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL")
    );
}

const solanaClient = new Solana.DlnClient(
    // Replace with dedicated RPC for production
    new Connection(clusterApiUrl("mainnet-beta")), 
    new PublicKey("src5qyZHqTqecJV4aY6Cb6zDZLMDzrDKKezs22MPHr4"), 
    new PublicKey("dst5MGcFPoBeREFAA5E3tU5ij8m5uVYwkzkSAbsLbNo"), 
    new PublicKey("DEbrdGj3HsRsAzx6uH4MKyREKxVAfBydijLUF3ygsFfh"), 
    new PublicKey("DeSetTwWhjZq6Pz9Kfdo1KoS5NqtsM6G8ERbX4SSCSft"),
)

type Order = {
    orderId: string;
    beneficiary: PublicKey;
    giveToken: PublicKey;
}

// Load the order using known data or fetch via transaction hash
// const order = await solanaClient.getOrderFromTransaction(
//     { giveChain: ChainId.Solana, txHash: "CREATE_TX_HASH" }
// );
const order: Order = { /* order data */ };

// Build and send the withdraw transaction
const [associatedTokenAddress] = findAssociatedTokenAddress(
    order.beneficiary, 
    order.giveToken
);
const tx = await solanaClient.source.withdrawAffiliateFee(
    order.orderId, 
    order.beneficiary, 
    associatedTokenAddress
);
// Send the transaction...
πŸ”
DLN API
deBridge Widget
liquidity is unlocked by a solver from a fulfilled order
here