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
          • Reserve Assets
          • Bridging Reserve Assets
          • Bridging non-reserve assets
          • API Parameters
            • Estimation-Only
            • prependOperatingExpenses
          • API Response
            • JSON Example
          • Refreshing Estimates
          • Fees and operating expenses
          • Order Fulfillment
            • Detecting the Order
            • Fulfilling the Order
              • Pre-Fill-Swap
            • Claiming the Order
        • Tracking Order Status
          • Order States
        • Integrating deBridge hooks
          • Creating Hook data for Solana
        • Submitting an Order Creation Transaction
        • Cancelling the Order
        • Affiliate fees
      • deBridge Widget
      • Interacting with smart contracts
        • Placing orders
        • Filling orders
        • Withdrawing Affiliate Fees
    • 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. Interacting with smart contracts

Withdrawing Affiliate Fees

PreviousFilling ordersNextInteracting with the deBridge App

Last updated 10 months ago

Was this helpful?

The affiliate fee can be specified by anyone who integrates with the DLN API or uses the . The fee is received by the beneficiary at the moment when the solvers unlocks liquidity from the fulfilled order (usually a few hours after the order is fulfilled).

EVM chains

For orders initiated on EVM chains, the affiliate fee is transferred to the beneficiary address automatically in the same transaction where the solver unlocks liquidity from the fulfilled order.

Solana

For orders initiated from Solana, the affiliate fee is claimed by the beneficiary who should call the withdrawAffiliateFee method of the DLN program on Solana. 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(
    new Connection(clusterApiUrl("mainnet-beta")), // better use your own RPC
    new PublicKey("src5qyZHqTqecJV4aY6Cb6zDZLMDzrDKKezs22MPHr4"), 
    new PublicKey("dst5MGcFPoBeREFAA5E3tU5ij8m5uVYwkzkSAbsLbNo"), 
    new PublicKey("DEbrdGj3HsRsAzx6uH4MKyREKxVAfBydijLUF3ygsFfh"), 
    new PublicKey("DeSetTwWhjZq6Pz9Kfdo1KoS5NqtsM6G8ERbX4SSCSft"),
)
type Order = {
    orderId: string;
    beneficiary: PublicKey;
    giveToken: PublicKey;
}
// load order in expected format
const order: Order; 
// order could also be loaded from chain by order creation tx hash
// const order = solanaClient.getOrderFromTransaction({ giveChain: ChainId.Solana, txHash: "create tx hash" }, {});

// build withdraw tx
const tx = await solanaClient.source.withdrawAffiliateFee(order.orderId, order.beneficiary, findAssociatedTokenAddress(order.beneficiary, order.giveToken)[0]);
// send withdraw tx
🔁
deBridge Widget