Mdex

Mdex first swap: checks before signing and completion evidence

last updated

On Mdex, a selected input token, output token, and amount produce an automated market maker quote, but the quote is not an execution record. A first swap stays bounded when the network, token contracts, route, minimum received, and deadline are reviewed before signing, then the final balances and transaction record are checked before any follow-up action.

Choose one swap and keep the exit reversible

Prepare one swap at a time. Reading a quote, changing the amount, or closing the interface does not submit an on-chain call, so the action remains reversible until the wallet signs and broadcasts a transaction.

Establish readiness

The connected account needs the intended input token and enough of the network's native asset to cover execution. Match the wallet network with the selected market, then identify both tokens by contract address rather than relying on names or symbols. The quoted output should correspond to the asset that the account is meant to receive.

Stop before signing

A wallet request marks the last review point before signing and broadcast. Read whether it requests an approval or a swap, which contract will receive the call, what amount or allowance it carries, and which network will process it. Reject the request if any field differs from the prepared action. Rejection leaves the proposed swap unsubmitted.

Each stage has its own evidence and stopping condition:

Stage Evidence to read Condition that limits the action
Prepare Connected account, selected network, and token contracts The account needs enough input balance and native network asset for execution.
Quote Input amount, route, estimated output, minimum output, and deadline The minimum output and deadline constrain execution; the unsigned quote may still be abandoned.
Review Wallet call type, target contract, amount, and requested permission Any network, token, spender, or amount mismatch is a reason to reject the request.
Broadcast Transaction hash and pending, successful, or failed status Pending is not completion. A failed included call reverts its state changes, although execution can consume a network fee.
Reconcile Successful receipt, transfer records, and resulting balances The receipt, transfer records, and resulting balances must match the intended swap before another action begins.

If the quote changes while the wallet request is open, reject that request and prepare a fresh one. The earlier request still contains its original parameters. Review the new quote separately. Signing and broadcasting again before reconciliation can submit a second swap after the first already succeeded.


Which choices change the transaction you sign?

The network, token contracts, amount, path, recipient, deadline, and output constraint determine the swap call. Changing any of them changes the requested transaction, its execution constraints, or the account that receives the output.

Network and contract identity

A token symbol is not a unique identifier. The same visible symbol can belong to different contracts, and a contract address has meaning only on its own network. The wallet network, input contract, and output contract must therefore agree with the quote before the request reaches the signing screen.

Path and trade direction

The asset path starts with the input contract and ends with the output contract. A selected path may pass through intermediate pools. Reversing the direction changes which token and reserve are treated as the input, so it produces a different quote. An earlier route can also become stale as pool state changes.

Output and time boundaries

Mdex router calls encode an asset path, a deadline, and either a minimum output or maximum input, depending on the swap method. For an exact-input swap, lowering the minimum output permits execution at a worse result. For an exact-output swap, raising the maximum input permits more of the input token to be spent. An expired deadline causes the call to fail rather than execute later under an old time limit.


Readiness before the commitment point

Readiness requires more than a connected wallet. The account must hold the selected input, maintain enough native network balance for execution, and provide any allowance that the router needs to transfer the input token. A connection exposes an address to the interface, but it does not establish token identity, sufficient balances, or an available route.

Current configuration determines whether a particular action is available. A historical market name or an old interface image does not prove that a route still works. A live quote reflects a proposed output for a selected path and the current pool state, but inclusion can occur later, after reserves or other relevant on-chain state have changed. Do not sign when the interface cannot produce a coherent quote.


What proves that the bounded swap finished?

Completion requires a successful on-chain transaction for the intended network and contract call, followed by balance changes that agree with its transfer records. A quote, wallet confirmation screen, or transaction hash alone does not establish that result.

Receipt status

A transaction hash identifies a submitted candidate. While the transaction remains pending, the requested state change has not reached a final recorded outcome. A successful receipt establishes that the included call did not revert, but the contract address and call data still need to match the intended swap. A failed receipt records an attempt, not an exchange.

Pool events

Mdex pair contracts emit a Swap event when a pool executes an exchange. A route through more than one pool can produce multiple exchange events within the same transaction. Those records connect the call to particular token flows and pool contracts, which is more precise than a wallet label that merely says a contract interaction succeeded.

Balance reconciliation

Compare the account's resulting token balances with the receipt's transfer records. The network fee affects the native balance separately from the exchanged assets, and token-specific transfer behavior can affect the recorded movement. A stale wallet display may need a refresh, but it should not trigger another swap while any discrepancy between the successful receipt and displayed balance remains unresolved.


Approval and swap records preserve different evidence

A token approval sets an allowance for a spender and does not, by itself, exchange the approved token. Its successful receipt shows that the approval call did not revert; read the resulting allowance before treating the permission as changed. The allowance may remain if the later swap fails, is rejected, or is never submitted, and any unused portion depends on the approved amount and subsequent transfers. Reducing or revoking that permission is another on-chain action, with its own signature, status, and network fee.

Approval and swap records preserve different evidence: A token approval sets an allowance for a spender and does not, by itself, exchange the approved token.; Its successful receipt shows that the approval call did not revert; read the resulting allowance before treating the permission as changed.; The allowance may remain if the later swap fails, is rejected, or is never submitted, and any unused portion depends on the approved amount and subsequent transfers.; Reducing or revoking that permission is another on-chain action, with its own signature, status, and network fee.

View full-size image


A mismatch calls for the smallest safe retreat

Before signing, reject the request and correct only the disputed input. A wrong network calls for network alignment; a wrong token calls for contract re-selection; an outdated quote calls for a refresh. Loosening the output constraint or enlarging an allowance does not repair an identity mismatch. Those changes widen the commitment instead.

After broadcast, use the transaction state rather than the interface animation. A pending call may still succeed or fail, so an immediate duplicate can create a second trade. A confirmed failure leaves the requested swap state reverted, although an execution fee may have been consumed. Refresh the quote only after identifying whether the failure came from an expired deadline, an unmet output boundary, insufficient allowance, insufficient balance, or another recorded cause.

The next action begins from a reconciled state

After a successful swap, the new balances, remaining allowance, and transaction receipt form the starting state for any later action. Obtain a new quote because pool reserves, balances, and time limits may have changed. If the receipt and balances conflict, stop until the discrepancy is resolved. For example, a confirmed approval without a successful swap receipt is permission evidence, not completion evidence.

Mdex: quick answers

Can I inspect a quote on Mdex without signing a transaction?

Yes. A quote on Mdex can be inspected without signing or submitting a transaction. Connecting a wallet may disclose the selected public account to the interface, but it does not authorize a token transfer. The commitment begins when the wallet signs and broadcasts a specific approval or swap transaction. Until then, the amount, route, output constraint, or selected tokens can be changed without creating an on-chain transaction.

Does rejecting a wallet request on Mdex cost a network fee?

No. Rejecting an unsigned wallet request on Mdex does not create an on-chain transaction or consume a network fee. The interface may already have prepared the call data, but preparation is not broadcast. If a request was signed and submitted before another prompt appeared, rejecting the later prompt will not cancel the earlier transaction. Its hash and receipt determine that earlier call's status.

Why did the Mdex output estimate change before I signed?

The estimate can change because the quote calculation uses current pool reserves for the selected route. Other transactions may alter those reserves before the wallet signs, and a refreshed route may use different intermediate pools. Changing the input amount also changes the calculation. The latest quote remains a proposal until the transaction executes within its output and deadline constraints.

Is the first Mdex action always a token approval?

No, a separate approval is required only when the router needs an allowance that the token contract does not already provide. An existing sufficient allowance can remove that preliminary transaction from the immediate flow. The wallet request identifies whether the pending call is an approval or a swap. Treat those as separate actions because an approval changes permission, while a swap changes token balances.

What happens if I close Mdex after submitting a swap?

Closing the page does not stop a transaction that has already been broadcast. It may remain pending, be dropped, or be included with a successful or failed receipt independently of the browser session. Use the transaction hash to recover its status before preparing another swap. Reopening the interface may update the display, but the on-chain receipt and resulting balances remain the evidence of completion.

Can a failed Mdex swap be resubmitted unchanged?

A failed swap can be retried with a new transaction, but unchanged parameters may produce the same failure. An expired deadline or unmet minimum output requires a fresh quote, while insufficient allowance or balance requires that specific prerequisite to change. The failed call's intended state changes revert, although execution may consume a network fee. Inspect the failure and current account state before creating another request.

What does the swap deadline on Mdex protect against?

The deadline prevents the router from executing that call after its encoded time limit. It does not guarantee that the network will include the transaction before the limit, nor does it preserve the displayed quote. If the call reaches execution too late, it reverts. A fresh request should carry a newly calculated quote and deadline rather than reusing the expired transaction data.