FAQs
Do I need an API key or an access token?
No. Contract-to-contract swap is entirely onchain — there is no Franklin Templeton endpoint involved and nothing to authenticate against.
For a contract-to-contract swap, you will need your calling contract authorized onchain, a funded wallet to sign with, and an RPC endpoint.
My preview succeeded but the swap reverted. Why?
A preview answers the question "What would I receive?". It does not check:
- whether your calling contract is authorized to trade the pair
- whether the pool is currently accepting swaps
- whether your calling contract holds enough, or whether the pool's reserve covers your amount
All three are separate reads. See Check eligibility.
Can I send the output to a different wallet?
It depends on the direction.
Swapping iBENJI → stablecoin, the output goes to the account that did the swap — your calling contract. A misdirected stablecoin cannot be recovered by anyone, so this direction is locked to the address that initiated the trade. Deliver to your contract and transfer onward from there.
Swapping the other way — stablecoin → iBENJI — you may name a different address, provided it is
authorized on that pair and your contract has granted its own
per-destination approval. You can check a destination's
authorization with isTraderAllowed — see
Check eligibility.
How do I find out what fee I will pay?
Use quoteNet — it returns the fee that applies to your address alongside the exact amount you would receive. See Preview a swap.
Do not assume the fee follows the direction. A rate is set per input token, per calling contract, so either direction may carry one and two contracts may be charged differently on the same pair. Quote the exact swap, as your contract's address, every time.
Can I swap my entire balance?
Yes, subject to the pool having enough of the token you are buying.
The fee is taken from the output rather than added to your input, so holding exactly the amount you want to swap is sufficient — you do not need to hold extra to cover the fee.
What is my maximum swap size?
Whichever is smaller: what the calling contract holds, or what the pool can deliver. Both are readable — see Check eligibility, steps 4 and 5.
Reserves move as other participants swap, so treat any maximum as valid only for the moment you read it.
If I ask for more than is available, do I get a partial fill?
No. Swaps are all-or-nothing — the transaction reverts and delivers nothing. Reduce the amount and resubmit.
The error did not tell me what the maximum was. How do I find it?
Refusals carry no numbers, so the ceiling is not readable from a failure. Re-read your balance and getTokenBalance(token), recompute your amount, re-quote, and resubmit — checking the size before you submit is part of calling the contract directly.
Why is my iBENJI swap refused when the amount looks fine?
Your input amount cannot be represented exactly in the output token's precision. Trim it to a whole multiple of 10^12 before quoting — see Preview a swap for the calculation, or When a swap is refused.
This is the single most common first-time error.
Which address does the pool take the tokens from?
The calling contract. Not the wallet that signs the transaction, and not the destination.
This is worth checking carefully if you hit an insufficient-balance error while looking at a wallet that visibly holds the tokens — the tokens are likely in the wrong one of those three addresses.
Do I need to approve the pool first?
Yes. The calling contract must grant the pool an ERC-20 allowance for the token being swapped from, as with any ERC-20 transfer. Insufficient allowance and insufficient balance produce different errors.
Can I be authorized for one direction but not the other?
No. Authorization is per pair, and the pair identifier is order-independent — so authorization covers both directions, and revoking it removes both.
How long before my swap appears in Benji?
Onchain settlement is immediate. Platform views update shortly afterwards, so allow a little time before raising a support request about a swap you can already see onchain.
Can I test this before going to production?
Yes. Ask your Sales Contact for access to a test environment during onboarding.