Summary
When building and submitting a PactFi swap ALGO → xUSD (pool app id 2967083464), the transaction group is built and signed successfully, but broadcast fails with a logic eval error in the pool application: the app expects the xUSD asset in the transaction's foreign assets, but the built app-call transaction does not include it.
Steps to reproduce
- Build swap: Call PactFi swap builder for ALGO → xUSD, e.g.:
poolAppId: 2967083464 (ALGO/xUSD CONST pool)
fromToken: ALGO
toToken: xUSD
amount: 0.1
sender: any Algorand address
- Sign the returned transaction group with a wallet.
- Broadcast the signed group to Algorand mainnet.
Actual result
Broadcast returns:
TransactionPool.Remember: transaction <txid>: logic eval error: invalid Assets index 1.
Details: app=2967083464, pc=264, opcodes===; &&; txna Assets 1 (network: algorand-mainnet)
So the pool contract is reading txna Assets 1 (second foreign asset), but the app-call transaction in the group does not have that asset in its Foreign Assets array (or the index is wrong).
Expected result
The swap should succeed: the app-call transaction that performs the swap should include xUSD (asset id 760037151) in its Foreign Assets so that txna Assets 1 (or the index the pool uses for the secondary asset) is valid.
Context
- Pool: PactFi app id 2967083464 (ALGO/xUSD, primary = ALGO id 0, secondary = xUSD id 760037151).
- Direction: Primary → secondary (ALGO in, xUSD out).
- Sender was opted in to xUSD; the failure is in the pool app logic eval, not opt-in.
- The same swap path works on Tinyman (ALGO → xUSD), so the failure is specific to how the PactFi swap transaction group is built (likely missing or misordered foreign assets on the app call).
Suggested fix
When building the PactFi swap app-call transaction for a pool where the output asset is an ASA (e.g. xUSD), ensure that transaction's Foreign Assets array includes that ASA (e.g. 760037151) at the index the pool program expects (e.g. index 1 for secondary asset). If the pool expects [primary_asset_id, secondary_asset_id], the builder should set the app call's foreign assets accordingly so txna Assets 0 and txna Assets 1 are valid.
Environment
- Network: algorand-mainnet
- PactFi pool: 2967083464 (ALGO/xUSD, CONST, fee 30 bps)
- Reproduced via MCP PactFi swap tooling (UluOS / Nautilus tooling that builds PactFi swap txns).
Summary
When building and submitting a PactFi swap ALGO → xUSD (pool app id
2967083464), the transaction group is built and signed successfully, but broadcast fails with a logic eval error in the pool application: the app expects the xUSD asset in the transaction's foreign assets, but the built app-call transaction does not include it.Steps to reproduce
poolAppId: 2967083464 (ALGO/xUSD CONST pool)fromToken: ALGOtoToken: xUSDamount: 0.1sender: any Algorand addressActual result
Broadcast returns:
So the pool contract is reading
txna Assets 1(second foreign asset), but the app-call transaction in the group does not have that asset in its Foreign Assets array (or the index is wrong).Expected result
The swap should succeed: the app-call transaction that performs the swap should include xUSD (asset id 760037151) in its Foreign Assets so that
txna Assets 1(or the index the pool uses for the secondary asset) is valid.Context
Suggested fix
When building the PactFi swap app-call transaction for a pool where the output asset is an ASA (e.g. xUSD), ensure that transaction's Foreign Assets array includes that ASA (e.g. 760037151) at the index the pool program expects (e.g. index 1 for secondary asset). If the pool expects
[primary_asset_id, secondary_asset_id], the builder should set the app call's foreign assets accordingly sotxna Assets 0andtxna Assets 1are valid.Environment