Single limit order placement fails with unknown variant 'place_limit_order_batch' — standard CW20 hook sends wrong variant #232

Closed
opened 2026-05-29 15:04:05 +00:00 by totdking · 5 comments
totdking commented 2026-05-29 15:04:05 +00:00 (Migrated from gitlab.com)
No description provided.
totdking commented 2026-05-29 15:05:18 +00:00 (Migrated from gitlab.com)

Issue Summary

Placing a standard single limit order on /trade via wallet extension fails on-chain. The frontend sends a CW20 send hook with the variant place_limit_order_batch, but the deployed pair contract does not recognise this variant — its Cw20HookMsg only accepts swap, place_limit_order, and withdraw_liquidity. This affects the standard single-order placement flow (not the ladder), meaning the core limit order feature is broken on the current build.


Reproduction Steps

  1. Complete full local setup (LocalTerra running, contracts deployed via make deploy-local, indexer running, frontend running at VITE_NETWORK=local npm run dev)
  2. Connect a Keplr wallet configured for localterra with sufficient LUNC and escrow token balance
  3. Navigate to /trade (or /limits), select a pair, and fill in a standard single limit order — Price, Amount, Expiry
  4. Click Place Limit
  5. Approve the transaction in Keplr
  6. Observe: transaction is rejected on-chain with the error below

Expected Behavior

A single limit order placement should send a CW20 send hook with the place_limit_order variant and succeed on-chain, landing the order in the pair's order book.


Actual Behavior

The transaction is rejected with:

Transaction failed: failed to execute message; message index: 0: dispatch: submessages:
Error parsing into type dex_common::pair::Cw20HookMsg: unknown variant `place_limit_order_batch`,
expected one of `swap`, `place_limit_order`, `withdraw_liquidity`: execute wasm contract failed

The frontend is sending place_limit_order_batch instead of place_limit_order for a regular single order. The variant does not exist on the deployed contract. No order is placed and gas is consumed.


Console Logs

error: Error: Transaction failed: failed to execute message; message index: 0:
dispatch: submessages: Error parsing into type dex_common::pair::Cw20HookMsg:
unknown variant `place_limit_order_batch`, expected one of `swap`,
`place_limit_order`, `withdraw_liquidity`: execute wasm contract failed
    at broadcastTerraExecuteContracts (terraBroadcast.ts:117:13)

Environment Details

Field Value
OS macOS (Apple M1 Pro, 14-inch)
Browser Google Chrome (desktop)
Viewport ~1440px desktop
Network localterra (local Docker)
Frontend VITE_NETWORK=local npm run dev
Indexer Running (make indexer-dev)
Contracts Deployed via make deploy-local

Wallet / Device Details

  • Wallet: Keplr browser extension
  • Network configured in Keplr: localterra — RPC http://localhost:26657
  • Flow: Standard single limit order placement on /trade

Severity / Impact

P1 (Blocker) — core single limit order placement is broken. Every standard limit order placement fails at the contract level. The frontend's single-order broadcast path is emitting place_limit_order_batch as the CW20 hook variant, which does not exist in the deployed contract. This is likely a code path that was updated for batch/ladder support but inadvertently replaced the single-order variant. Fix requires correcting the hook message variant in the single-order placement path in pair.ts or transactions.ts.

cc: @PlasticDigits ~"blocker:limit-orders"

### Issue Summary Placing a standard single limit order on `/trade` via wallet extension fails on-chain. The frontend sends a CW20 `send` hook with the variant `place_limit_order_batch`, but the deployed pair contract does not recognise this variant — its `Cw20HookMsg` only accepts `swap`, `place_limit_order`, and `withdraw_liquidity`. This affects the standard single-order placement flow (not the ladder), meaning the core limit order feature is broken on the current build. --- ### Reproduction Steps 1. Complete full local setup (LocalTerra running, contracts deployed via `make deploy-local`, indexer running, frontend running at `VITE_NETWORK=local npm run dev`) 2. Connect a Keplr wallet configured for localterra with sufficient LUNC and escrow token balance 3. Navigate to `/trade` (or `/limits`), select a pair, and fill in a standard single limit order — Price, Amount, Expiry 4. Click **Place Limit** 5. Approve the transaction in Keplr 6. Observe: transaction is rejected on-chain with the error below --- ### Expected Behavior A single limit order placement should send a CW20 `send` hook with the `place_limit_order` variant and succeed on-chain, landing the order in the pair's order book. --- ### Actual Behavior The transaction is rejected with: ``` Transaction failed: failed to execute message; message index: 0: dispatch: submessages: Error parsing into type dex_common::pair::Cw20HookMsg: unknown variant `place_limit_order_batch`, expected one of `swap`, `place_limit_order`, `withdraw_liquidity`: execute wasm contract failed ``` The frontend is sending `place_limit_order_batch` instead of `place_limit_order` for a regular single order. The variant does not exist on the deployed contract. No order is placed and gas is consumed. --- ### Console Logs ``` error: Error: Transaction failed: failed to execute message; message index: 0: dispatch: submessages: Error parsing into type dex_common::pair::Cw20HookMsg: unknown variant `place_limit_order_batch`, expected one of `swap`, `place_limit_order`, `withdraw_liquidity`: execute wasm contract failed at broadcastTerraExecuteContracts (terraBroadcast.ts:117:13) ``` --- ### Environment Details | Field | Value | |-------|-------| | OS | macOS (Apple M1 Pro, 14-inch) | | Browser | Google Chrome (desktop) | | Viewport | \~1440px desktop | | Network | `localterra` (local Docker) | | Frontend | `VITE_NETWORK=local npm run dev` | | Indexer | Running (`make indexer-dev`) | | Contracts | Deployed via `make deploy-local` | --- ### Wallet / Device Details - **Wallet:** Keplr browser extension - **Network configured in Keplr:** localterra — RPC `http://localhost:26657` - **Flow:** Standard single limit order placement on `/trade` --- ### Severity / Impact **P1 (Blocker) — core single limit order placement is broken.** Every standard limit order placement fails at the contract level. The frontend's single-order broadcast path is emitting `place_limit_order_batch` as the CW20 hook variant, which does not exist in the deployed contract. This is likely a code path that was updated for batch/ladder support but inadvertently replaced the single-order variant. Fix requires correcting the hook message variant in the single-order placement path in `pair.ts` or `transactions.ts`. cc: @PlasticDigits ~"blocker:limit-orders"
totdking commented 2026-05-29 15:08:47 +00:00 (Migrated from gitlab.com)

mentioned in issue #233

mentioned in issue #233
PlasticDigits commented 2026-05-29 15:15:49 +00:00 (Migrated from gitlab.com)

@totdking This is due to changes to the smart contracts. You need to rebuild the contracts and reset your localterra.

@totdking This is due to changes to the smart contracts. You need to rebuild the contracts and reset your localterra.
totdking commented 2026-05-29 15:18:58 +00:00 (Migrated from gitlab.com)

mentioned in issue #204

mentioned in issue #204
Brouie commented 2026-05-31 12:41:39 +00:00 (Migrated from gitlab.com)

qa @PlasticDigits — confirmed resolved by a fresh contract redeploy on the QA box.

the unknown variant place_limit_order_batch reproduced exactly during e2e seed on stale wasm. after make deploy-local refreshed the contracts (git_sha 6be0a13), the hybrid-book seed places the bid clean ("resting bid seeded for hybrid E2E") and the variant error is gone. matches your call to totdking — rebuild contracts + reset localterra — same fix applied here.

deployed-wasm drift, not a code bug. good to close once totdking confirms his side, or your call.

qa @PlasticDigits — confirmed resolved by a fresh contract redeploy on the QA box. the unknown variant `place_limit_order_batch` reproduced exactly during e2e seed on stale wasm. after make deploy-local refreshed the contracts (git_sha 6be0a13), the hybrid-book seed places the bid clean ("resting bid seeded for hybrid E2E") and the variant error is gone. matches your call to totdking — rebuild contracts + reset localterra — same fix applied here. deployed-wasm drift, not a code bug. good to close once totdking confirms his side, or your call.
PlasticDigits (Migrated from gitlab.com) closed this issue 2026-05-31 14:09:17 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#232
No description provided.