The OnRe program enables token exchanges through offers. Each offer represents a trading pair (e.g., USDC → ONyc) with dynamic pricing based on time-based APR growth.
Key Concepts:
Offer: A PDA account identified by a token pair (token_in_mint, token_out_mint)
Token In: The token users pay (e.g., USDC, USDG)
Token Out: The token users receive (e.g., ONyc)
Pricing Vectors: Time-based price schedules with APR-driven growth
Choosing Your Integration Path
take_offer vs take_offer_permissionless
Feature
take_offer
take_offer_permissionless
Token Routing
Direct user-to-boss transfers
Routes through program-owned intermediary accounts
Smart Contract Integration
Works well
Simpler setup (recommended)
Approval Message
Optional (when offer requires)
Optional (when offer requires)
Pricing
Same
Same
Fees
Same
Same
Account Setup
Fewer accounts needed
More accounts, but program-controlled
Recommendation
Use take_offer_permissionless for most integrations:
Simpler integration – no direct user-to-boss token account relationships needed
Atomic routing through program-controlled PDAs
Better for smart contract CPI calls
PDA Seeds Reference
All PDAs are derived from the program ID: onreuGhHHgVzMWSkj2oQDLDtvvGvoepBPkqyaubFcwe
PDA
Seed
Description
State
"state"
Program state (contains boss, kill switch, approvers)
Offer
"offer" + token_in_mint + token_out_mint
Offer account for a token pair
Vault Authority
"offer_vault_authority"
Authority for vault token accounts
Permissionless Authority
"permissionless-1"
Authority for intermediary token routing
Mint Authority
"mint_authority"
Authority for mint operations
Integration: take_offer_permissionless
This is the recommended integration path for most use cases.
Instruction Discriminator
[37, 190, 224, 77, 197, 39, 203, 230]
Arguments
Name
Type
Description
token_in_amount
u64
Amount of token_in the user is paying (including fees)
approval_message
Option<ApprovalMessage>
Pass null for permissionless offers
Using Anchor Client (Recommended)
Building Transaction Manually (Low-Level)
Use this approach when building transactions without Anchor or for CPI.
Integration: take_offer
The direct flow requires fewer accounts but uses direct user-to-boss transfers.
Instruction Discriminator
[137, 6, 172, 191, 222, 117, 178, 131]
Using Anchor Client
Fetching Market Data
Get Boss Address
Check Offer Configuration
Get Current NAV (Price)
Get Current APY
Calculate Expected Output
Pricing Model
The OnRe program uses a discrete interval pricing model with APR-based growth.
How Price is Calculated
Find Active Vector: The program finds the pricing vector with the latest start_time ≤ current time
try {
await takeOfferPermissionless(/* params */);
} catch (error) {
if (error.message.includes("No active vector")) {
console.error("No pricing vector is currently active. Check offer configuration.");
} else if (error.message.includes("Kill switch is activated")) {
console.error("Program is temporarily halted. Try again later.");
} else if (error.message.includes("Permissionless take offer not allowed")) {
console.error("This offer requires the direct take_offer instruction.");
} else if (error.message.includes("insufficient funds")) {
console.error("Insufficient token balance or vault liquidity.");
}
throw error;
}