BenjiSwap
BenjiSwap is a permissioned, fixed-rate 1:1 swap venue. It exists so a tokenized fund share and a stablecoin can be exchanged at par against a reserve.
This section covers contract-to-contract swap — calling the swap contract directly from your own smart contract. The alternative is to use the BenjiSwap dApp.
Two things worth knowing before you build, because neither can be undone afterwards:
- Send tokens to your own contract, not to the swap contract. Nothing you can call will return tokens transferred to it directly — recovery, where it is possible at all, is an operator action you would have to request. Treat it as a one-way transfer.
- Do not send native currency with a call. The swap contract does not handle it.
The three steps
Every swap follows the same sequence:
- Check eligibility — confirm you are authorized, the pool is live, and both your contract and the pool's reserve hold enough
- Preview a swap — get the exact amount you would receive, then pass that amount as your floor when you execute
- Execute a swap — submit with that floor in place
If a swap is refused at any point, see When a swap is refused.
Every function your contract needs is listed on one page — see Pool interface.
Before you start
Authorization is granted by Franklin Templeton, so there is an onboarding step before your first swap will succeed — it is not self-service. Your Franklin Templeton contact provides the deployment addresses, the authorizations your contract and any recipients need, and notice of upgrades. See Checklist for the full list.
The swap contract is upgradeable. These pages describe version 7 — confirm yours with getVersion()
before you build against them. See Pool interface.
Code examples in this section
Read examples use JavaScript with viem, and the caller contract template is Solidity. They are illustrative — any library that can read from and write to your target network will work equally well.
Some capabilities are arranged during onboarding rather than integrated against directly. If what you need is not described on these pages, raise it with your Franklin Templeton contact.