Rust SDK
Rust Integration
Dynamic Bonding Curve
The dynamic-bonding-curve-sdk
provides a convenient way to interact with the Dynamic Bonding Curve program and get swap quotes.
Before you begin, here are some important resources:
- Program ID (Mainnet & Devnet):
dbcij3LWUppWqq96dh6gJWwBifmcGfLSB5D4DuSMaqN
- Rust SDK: Dynamic Bonding Curve
quote_exact_in
This function calculates the result of a swap for a given amount of an exact input token. It’s useful for estimating the outcome of a trade before executing it on-chain.
Function Signature
Parameters
virtual_pool
: A reference to theVirtualPool
state.config
: A reference to thePoolConfig
for the pool.swap_base_for_quote
: A boolean indicating the direction of the trade.true
for swapping base token for quote token,false
otherwise.current_timestamp
: The current Solana cluster timestamp.current_slot
: The current Solana cluster slot.transfer_fee_excluded_amount_in
: The amount of input tokens for the swap, excluding any transfer fees.has_referral
: A boolean indicating if a referral fee should be considered.
Returns
It returns a Result<SwapResult>
, where SwapResult
contains detailed information about the outcome of the swap, such as the amount out, fees, and the new state of the pool.